75 lines
1.9 KiB
CMake
75 lines
1.9 KiB
CMake
cmake_minimum_required(VERSION 3.31)
|
|
project(Destrum)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
include(CTest)
|
|
|
|
option(DESTRUM_ENABLE_WARNINGS "Enable warnings for first-party targets" ON)
|
|
|
|
function(destrum_enable_warnings target)
|
|
if (NOT DESTRUM_ENABLE_WARNINGS)
|
|
return()
|
|
endif()
|
|
|
|
if (MSVC)
|
|
target_compile_options(${target} PRIVATE /W4 /permissive-)
|
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
|
|
target_compile_options(${target} PRIVATE -Wall -Wextra -Wpedantic)
|
|
endif()
|
|
endfunction()
|
|
|
|
if (MSVC)
|
|
# Disable Just My Code debugging
|
|
add_compile_options(/JMC-)
|
|
endif()
|
|
|
|
add_subdirectory(destrum)
|
|
add_subdirectory(lightkeeper)
|
|
add_subdirectory(TheChef)
|
|
|
|
if (TARGET _internal_validate_engine_shaders)
|
|
add_custom_target(ValidateShaders)
|
|
add_dependencies(ValidateShaders _internal_validate_engine_shaders)
|
|
endif()
|
|
|
|
destrum_enable_warnings(destrum)
|
|
destrum_enable_warnings(lightkeeper)
|
|
|
|
add_custom_target(CleanupAssets
|
|
COMMAND ${CMAKE_COMMAND} -E rm -rf "$<TARGET_FILE_DIR:lightkeeper>/assets/game"
|
|
COMMAND ${CMAKE_COMMAND} -E rm -rf "$<TARGET_FILE_DIR:lightkeeper>/assets/engine"
|
|
DEPENDS
|
|
_internal_clean_game_assets
|
|
_internal_clean_engine_assets
|
|
)
|
|
|
|
add_custom_target(CookAssets)
|
|
add_dependencies(CookAssets
|
|
_internal_cook_game_assets
|
|
_internal_cook_engine_assets
|
|
)
|
|
|
|
option(ENABLE_SANITIZERS "Enable Address/Undefined sanitizers" OFF)
|
|
|
|
if (ENABLE_SANITIZERS AND CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
|
|
foreach(target destrum lightkeeper)
|
|
target_compile_options(${target} PRIVATE
|
|
-fsanitize=address,undefined
|
|
-fno-omit-frame-pointer
|
|
-fno-stack-protector
|
|
-g3
|
|
)
|
|
|
|
target_link_options(${target} PRIVATE
|
|
-fsanitize=address,undefined
|
|
)
|
|
endforeach()
|
|
endif()
|
|
|
|
if (BUILD_TESTING)
|
|
add_subdirectory(tests)
|
|
endif()
|