-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
92 lines (82 loc) · 2.97 KB
/
CMakeLists.txt
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
cmake_minimum_required(VERSION 3.11.1)
project(simulator)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-sign-compare")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
# Add the cmake folder to the module search path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
# Something to help out Google Test
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# Set configs args from CMake
set(BUILD_PROJECT "all" CACHE STRING "Set the name of the project to build")
set(BOOST_ROOT "" CACHE PATH "Path to Boost libraries")
set(NUM_PLAYERS "2" CACHE STRING "Number of players in the game")
# Always enable colors, since Ninja strips them
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-fdiagnostics-color=always)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options(-fcolor-diagnostics)
endif ()
# Include Header Export module
include(GenerateExportHeader)
# Set C++ standard to C++14
set(CMAKE_CXX_STANDARD 14)
# Include ClangFormat
if((NOT BUILD_PROJECT STREQUAL "no_tests") AND (NOT BUILD_PROJECT STREQUAL "player_code"))
include(cmake/clang-format.cmake)
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
if(BUILD_PROJECT STREQUAL "physics")
add_subdirectory(src/physics)
elseif(BUILD_PROJECT STREQUAL "constants")
add_subdirectory(src/constants)
elseif(BUILD_PROJECT STREQUAL "state")
add_subdirectory(src/state)
elseif(BUILD_PROJECT STREQUAL "logger")
add_subdirectory(src/logger)
elseif(BUILD_PROJECT STREQUAL "llvm_pass")
add_subdirectory(src/llvm_pass)
elseif(BUILD_PROJECT STREQUAL "drivers")
add_subdirectory(src/drivers)
elseif(BUILD_PROJECT STREQUAL "player_wrapper")
add_subdirectory(src/player_wrapper)
elseif(BUILD_PROJECT STREQUAL "player_code")
add_subdirectory(src/player_code)
elseif(BUILD_PROJECT STREQUAL "game")
add_subdirectory(src/game)
elseif(BUILD_PROJECT STREQUAL "test")
add_subdirectory(ext/googletest)
add_subdirectory(test)
elseif(BUILD_PROJECT STREQUAL "main")
add_subdirectory(src/main)
elseif(BUILD_PROJECT STREQUAL "no_tests")
add_subdirectory(src/physics)
add_subdirectory(src/constants)
add_subdirectory(src/simulator_constants)
add_subdirectory(src/state)
add_subdirectory(src/logger)
add_subdirectory(src/llvm_pass)
add_subdirectory(src/drivers)
add_subdirectory(src/player_wrapper)
add_subdirectory(src/player_code)
add_subdirectory(src/game)
add_subdirectory(src/main)
add_subdirectory(src/players)
else()
add_subdirectory(src/physics)
add_subdirectory(src/constants)
add_subdirectory(src/simulator_constants)
add_subdirectory(src/state)
add_subdirectory(src/logger)
add_subdirectory(src/llvm_pass)
add_subdirectory(src/drivers)
add_subdirectory(ext/googletest)
add_subdirectory(src/player_wrapper)
add_subdirectory(src/player_code)
add_subdirectory(src/game)
add_subdirectory(src/main)
add_subdirectory(src/players)
add_subdirectory(test)
endif()