-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
55 lines (40 loc) · 1.84 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
cmake_minimum_required(VERSION 3.6)
project(Polypropylene)
### DEFINITIONS #########################################
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(cmake/Prepend.cmake)
include(cmake/OptionInfo.cmake)
### OPTIONS #############################################
option(POLYPROPYLENE_WITH_EXAMPLES "Build examples" ON)
option(POLYPROPYLENE_WITH_JSON "Enable entity prefab loading from json files" ON)
option(POLYPROPYLENE_WITH_TESTS "Build unit tests; Requires POLYPROPYLENE_WITH_EXAMPLES=ON" ON)
message("Building Polypropylene")
message(" FOR C++${CMAKE_CXX_STANDARD}")
printOptionInfo(POLYPROPYLENE_WITH_EXAMPLES Examples PAX_WITH_EXAMPLES)
printOptionInfo(POLYPROPYLENE_WITH_JSON Json PAX_WITH_JSON)
printOptionInfo(POLYPROPYLENE_WITH_TESTS Tests PAX_WITH_TESTS)
### OPTION CONSTRAINTS #################################
# Building tests also requires the examples
if (POLYPROPYLENE_WITH_TESTS AND NOT POLYPROPYLENE_WITH_EXAMPLES)
message(FATAL_ERROR "Building Tests (POLYPROPYLENE_WITH_TESTS) requires examples but POLYPROPYLENE_WITH_EXAMPLES is set to OFF.")
endif()
### FLAGS ###############################################
if (${CMAKE_BUILD_TYPE} MATCHES Release)
add_definitions(-DPAX_BUILD_TYPE_RELEASE)
message(" AS Release")
elseif(${CMAKE_BUILD_TYPE} MATCHES Debug)
add_definitions(-DPAX_BUILD_TYPE_DEBUG)
message(" AS Debug")
endif(${CMAKE_BUILD_TYPE} MATCHES Release)
### SOURCE FILES ########################################
include_directories(include)
add_subdirectory(src)
### EXAMPLES ############################################
if (POLYPROPYLENE_WITH_EXAMPLES)
add_subdirectory(examples)
endif(POLYPROPYLENE_WITH_EXAMPLES)
### TEST ################################################
if (POLYPROPYLENE_WITH_TESTS)
add_subdirectory(test)
endif(POLYPROPYLENE_WITH_TESTS)