BLT-Graphics/CMakeLists.txt

52 lines
1.6 KiB
CMake
Raw Permalink Normal View History

2023-07-29 18:58:56 -04:00
cmake_minimum_required(VERSION 3.5)
2023-07-29 16:45:13 -04:00
project(BLT_GRAPHICS VERSION 0.0.1)
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)
set(CMAKE_CXX_STANDARD 20)
set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL)
add_subdirectory(libraries/BLT)
2023-07-29 17:15:24 -04:00
add_subdirectory(libraries/glfw)
2023-07-29 16:45:13 -04:00
set(OLD_CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE})
set(CMAKE_BUILD_TYPE "Release")
set(ASSIMP_INSTALL OFF)
set(ASSIMP_WARNINGS_AS_ERRORS OFF)
set(ASSIMP_BUILD_TESTS OFF)
add_subdirectory(libraries/assimp)
set(CMAKE_BUILD_TYPE ${OLD_CMAKE_BUILD_TYPE})
include_directories(include/)
file(GLOB_RECURSE source_files src/*.cpp)
2023-07-29 18:58:56 -04:00
add_library(BLT_GRAPHICS ${source_files})
2023-07-29 16:45:13 -04:00
target_link_libraries(BLT_GRAPHICS PUBLIC glfw)
target_link_libraries(BLT_GRAPHICS PUBLIC BLT)
target_link_libraries(BLT_GRAPHICS PUBLIC OpenGL)
target_link_libraries(BLT_GRAPHICS PUBLIC assimp)
2023-07-29 18:58:56 -04:00
target_include_directories(BLT_GRAPHICS PUBLIC include/)
2023-07-29 16:45:13 -04:00
target_compile_options(BLT_GRAPHICS PRIVATE -Wall -Wextra -Wpedantic)
if (${ENABLE_ADDRSAN} MATCHES ON)
target_compile_options(BLT_GRAPHICS PRIVATE -fsanitize=address)
target_link_options(BLT_GRAPHICS PRIVATE -fsanitize=address)
endif ()
if (${ENABLE_UBSAN} MATCHES ON)
target_compile_options(BLT_GRAPHICS PRIVATE -fsanitize=undefined)
target_link_options(BLT_GRAPHICS PRIVATE -fsanitize=undefined)
endif ()
if (${ENABLE_TSAN} MATCHES ON)
target_compile_options(BLT_GRAPHICS PRIVATE -fsanitize=thread)
target_link_options(BLT_GRAPHICS PRIVATE -fsanitize=thread)
endif ()