COSC-4P80-Assignment-2/CMakeLists.txt

56 lines
2.0 KiB
CMake
Raw Normal View History

2024-10-21 19:25:00 -04:00
cmake_minimum_required(VERSION 3.25)
2024-10-31 14:43:37 -04:00
project(COSC-4P80-Assignment-2 VERSION 0.1.1)
2024-10-21 16:42:03 -04: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-10-25 01:22:32 -04:00
option(ENABLE_GRAPHICS "Enable usage of graphics package" OFF)
2024-10-23 01:51:32 -04:00
#option(EIGEN_TEST_CXX11 "Enable testing with C++11 and C++11 features (e.g. Tensor module)." ON)
2024-10-21 16:42:03 -04:00
set(CMAKE_CXX_STANDARD 17)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
2024-10-25 01:22:32 -04:00
if (ENABLE_GRAPHICS)
add_subdirectory(lib/blt-graphics)
add_compile_definitions(BLT_USE_GRAPHICS)
2024-10-27 18:09:37 -04:00
set(EXTRA_SOURCES lib/implot/implot.cpp lib/implot/implot_demo.cpp lib/implot/implot_items.cpp)
include_directories(lib/implot)
2024-10-25 01:22:32 -04:00
else ()
add_subdirectory(lib/blt)
endif ()
2024-10-21 16:42:03 -04:00
2024-10-23 01:51:32 -04:00
#add_subdirectory(lib/eigen-3.4.0)
2024-10-21 16:42:03 -04:00
include_directories(include/)
file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
2024-10-27 18:09:37 -04:00
add_executable(COSC-4P80-Assignment-2 ${PROJECT_BUILD_FILES} ${EXTRA_SOURCES})
2024-10-21 16:42:03 -04:00
target_compile_options(COSC-4P80-Assignment-2 PRIVATE -Wall -Wextra -Wpedantic -Wno-comment)
target_link_options(COSC-4P80-Assignment-2 PRIVATE -Wall -Wextra -Wpedantic -Wno-comment)
2024-10-23 01:51:32 -04:00
#target_link_libraries(COSC-4P80-Assignment-2 PRIVATE BLT Eigen3::Eigen)
2024-10-25 01:22:32 -04:00
if (ENABLE_GRAPHICS)
target_link_libraries(COSC-4P80-Assignment-2 PRIVATE BLT_WITH_GRAPHICS)
else ()
target_link_libraries(COSC-4P80-Assignment-2 PRIVATE BLT)
endif ()
2024-10-21 16:42:03 -04:00
if (${ENABLE_ADDRSAN} MATCHES ON)
target_compile_options(COSC-4P80-Assignment-2 PRIVATE -fsanitize=address)
target_link_options(COSC-4P80-Assignment-2 PRIVATE -fsanitize=address)
endif ()
if (${ENABLE_UBSAN} MATCHES ON)
target_compile_options(COSC-4P80-Assignment-2 PRIVATE -fsanitize=undefined)
target_link_options(COSC-4P80-Assignment-2 PRIVATE -fsanitize=undefined)
endif ()
if (${ENABLE_TSAN} MATCHES ON)
target_compile_options(COSC-4P80-Assignment-2 PRIVATE -fsanitize=thread)
target_link_options(COSC-4P80-Assignment-2 PRIVATE -fsanitize=thread)
endif ()