2024-02-16 15:54:03 -05:00
|
|
|
cmake_minimum_required(VERSION 3.25)
|
2024-03-19 11:46:18 -04:00
|
|
|
project(lilfbtf5 VERSION 0.1.30)
|
2024-02-16 15:54:03 -05:00
|
|
|
|
|
|
|
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-21 20:24:15 -05:00
|
|
|
if(!MSVC)
|
2024-02-17 20:46:05 -05:00
|
|
|
add_compile_options(-march=native)
|
2024-02-21 20:24:15 -05:00
|
|
|
endif()
|
2024-02-17 20:46:05 -05:00
|
|
|
|
2024-03-05 00:23:43 -05:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
2024-02-16 15:54:03 -05:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
|
|
|
|
add_subdirectory(libs/BLT)
|
|
|
|
|
|
|
|
file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
|
|
|
|
file(GLOB_RECURSE PROJECT_TESTS_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/tests/src/*.cpp")
|
|
|
|
|
|
|
|
add_library(lilfbtf5 ${PROJECT_BUILD_FILES})
|
|
|
|
|
|
|
|
target_include_directories(lilfbtf5 PUBLIC include/)
|
|
|
|
target_link_libraries(lilfbtf5 PUBLIC BLT)
|
|
|
|
|
2024-02-21 20:24:15 -05:00
|
|
|
message("Is MSVC ${MSVC}")
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
message("Using MSVC")
|
|
|
|
#target_compile_options(${BLT_TARGET} PRIVATE /W4)
|
|
|
|
else()
|
|
|
|
message("Using non MSVC options")
|
|
|
|
# perhaps we should warn on unused variables, but BLT will have lots of them.
|
|
|
|
target_compile_options(lilfbtf5 PRIVATE -Wall -Wextra -Wpedantic -Wno-comment)
|
|
|
|
target_link_options(lilfbtf5 PRIVATE -Wall -Wextra -Wpedantic -Wno-comment)
|
|
|
|
endif()
|
2024-02-16 15:54:03 -05:00
|
|
|
|
|
|
|
if (${ENABLE_ADDRSAN} MATCHES ON)
|
|
|
|
target_compile_options(lilfbtf5 PRIVATE -fsanitize=address)
|
|
|
|
target_link_options(lilfbtf5 PRIVATE -fsanitize=address)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (${ENABLE_UBSAN} MATCHES ON)
|
|
|
|
target_compile_options(lilfbtf5 PRIVATE -fsanitize=undefined)
|
|
|
|
target_link_options(lilfbtf5 PRIVATE -fsanitize=undefined)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (${ENABLE_TSAN} MATCHES ON)
|
|
|
|
target_compile_options(lilfbtf5 PRIVATE -fsanitize=thread)
|
|
|
|
target_link_options(lilfbtf5 PRIVATE -fsanitize=thread)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
project(lilfbtf5_test)
|
|
|
|
|
|
|
|
add_executable(lilfbtf5_test ${PROJECT_TESTS_BUILD_FILES})
|
|
|
|
|
|
|
|
target_include_directories(lilfbtf5_test PUBLIC tests/include/)
|
|
|
|
target_link_libraries(lilfbtf5_test PUBLIC lilfbtf5)
|
|
|
|
|
2024-02-21 20:24:15 -05:00
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
message("Using MSVC")
|
|
|
|
#target_compile_options(${BLT_TARGET} PRIVATE /W4)
|
|
|
|
else()
|
|
|
|
message("Using non MSVC options")
|
|
|
|
# perhaps we should warn on unused variables, but BLT will have lots of them.
|
|
|
|
target_compile_options(lilfbtf5_test PRIVATE -Wall -Wextra -Wpedantic -Wno-comment)
|
|
|
|
target_link_options(lilfbtf5_test PRIVATE -Wall -Wextra -Wpedantic -Wno-comment)
|
|
|
|
endif()
|
|
|
|
|
2024-02-16 15:54:03 -05:00
|
|
|
|
|
|
|
if (${ENABLE_ADDRSAN} MATCHES ON)
|
|
|
|
target_compile_options(lilfbtf5_test PRIVATE -fsanitize=address)
|
|
|
|
target_link_options(lilfbtf5_test PRIVATE -fsanitize=address)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (${ENABLE_UBSAN} MATCHES ON)
|
|
|
|
target_compile_options(lilfbtf5_test PRIVATE -fsanitize=undefined)
|
|
|
|
target_link_options(lilfbtf5_test PRIVATE -fsanitize=undefined)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (${ENABLE_TSAN} MATCHES ON)
|
|
|
|
target_compile_options(lilfbtf5_test PRIVATE -fsanitize=thread)
|
|
|
|
target_link_options(lilfbtf5_test PRIVATE -fsanitize=thread)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
project(lilfbtf5)
|