discord-bot/CMakeLists.txt

63 lines
1.9 KiB
CMake
Raw Permalink Normal View History

2024-02-26 12:17:59 -05:00
cmake_minimum_required(VERSION 3.25)
2024-02-22 16:09:56 -05:00
project(discord_bot)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF)
2024-02-27 23:58:07 -05:00
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2024-02-22 16:09:56 -05:00
set(CMAKE_CXX_STANDARD 17)
2024-05-01 19:39:03 -04:00
#cmake_policy(SET CMP0069 NEW)
#include(CheckIPOSupported)
#check_ipo_supported(RESULT supported OUTPUT error)
2024-02-27 23:58:07 -05:00
#set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
#set(BUILD_SHARED_LIBS OFF)
#set(POSITION_INDEPENDENT_CODE ON)
2024-02-25 14:05:45 -05:00
add_compile_options(-march=native)
set(SQLITE_ORM_ENABLE_CXX_17 ON)
2024-02-22 16:09:56 -05:00
add_subdirectory(libs/blt)
add_subdirectory(libs/DPP-10.0.29)
2024-02-25 14:05:45 -05:00
add_subdirectory(libs/sqlite_orm-1.8.2)
2024-02-26 15:40:05 -05:00
find_package(CURL)
2024-02-22 16:09:56 -05:00
2024-05-01 19:39:03 -04:00
if( supported )
message(STATUS "IPO / LTO enabled")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
set_property(TARGET BLT PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
message(STATUS "IPO / LTO not supported: <${error}>")
endif()
2024-02-22 16:09:56 -05:00
include_directories(include/)
file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
add_executable(discord_bot ${PROJECT_BUILD_FILES})
2024-02-25 14:05:45 -05:00
target_compile_options(discord_bot PUBLIC -Wall -Wpedantic -Wno-comment -march=native)
target_link_options(discord_bot PUBLIC -Wall -Wpedantic -Wno-comment)
2024-02-22 16:09:56 -05:00
2024-02-27 23:58:07 -05:00
target_link_libraries(discord_bot PUBLIC curl)
2024-02-22 16:09:56 -05:00
target_link_libraries(discord_bot PUBLIC dpp)
2024-02-25 14:05:45 -05:00
target_link_libraries(discord_bot PUBLIC sqlite_orm)
2024-02-27 23:58:07 -05:00
target_link_libraries(discord_bot PUBLIC BLT)
2024-02-22 16:09:56 -05:00
if (${ENABLE_ADDRSAN} MATCHES ON)
target_compile_options(discord_bot PRIVATE -fsanitize=address)
target_link_options(discord_bot PRIVATE -fsanitize=address)
endif ()
if (${ENABLE_UBSAN} MATCHES ON)
target_compile_options(discord_bot PRIVATE -fsanitize=undefined)
target_link_options(discord_bot PRIVATE -fsanitize=undefined)
endif ()
if (${ENABLE_TSAN} MATCHES ON)
target_compile_options(discord_bot PRIVATE -fsanitize=thread)
target_link_options(discord_bot PRIVATE -fsanitize=thread)
endif ()