-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
44 lines (36 loc) · 1.37 KB
/
CMakeLists.txt
File metadata and controls
44 lines (36 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
cmake_minimum_required(VERSION 3.16)
project(afterimage VERSION 0.1.0 LANGUAGES CXX)
option(USE_WASM "Enable WebAssembly builds" OFF)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(USE_WASM AND EMSCRIPTEN)
if(DEFINED CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1.0)
message(WARNING "Emscripten < 3.1.0 detected; downgrading to C++17 for WASM build.")
set(CMAKE_CXX_STANDARD 17)
endif()
endif()
option(ENABLE_SANITIZERS "Build with ASAN/UBSAN (non-MSVC)" OFF)
if(ENABLE_SANITIZERS AND NOT MSVC)
add_compile_options(-fsanitize=address,undefined -fno-omit-frame-pointer)
add_link_options(-fsanitize=address,undefined -fno-omit-frame-pointer)
endif()
# Add compiler warnings
if(MSVC)
# /Zc:__cplusplus makes __cplusplus report the correct standard level on MSVC
add_compile_options(/W4 /permissive- /Zc:preprocessor /Zc:__cplusplus)
else()
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# Add subdirectories
add_subdirectory(engine)
add_subdirectory(server)
add_subdirectory(tools)
add_subdirectory(desktop)
# add_subdirectory(client) # uncomment later
# Simple test executable
add_executable(afterimage_test main.cpp)
target_link_libraries(afterimage_test PRIVATE afterimage_engine)
# Optional: Enable testing
enable_testing()
add_test(NAME afterimage_test COMMAND afterimage_test)