-
Notifications
You must be signed in to change notification settings - Fork 114
/
CMakeLists.txt
83 lines (65 loc) · 2.04 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
cmake_minimum_required(VERSION 3.16.3 FATAL_ERROR)
# CPM downloader
include(external/cpm.cmake)
# project declaration
project(
MoBaGEn
VERSION 0.0.1
HOMEPAGE_URL "https://infinbrains.com"
DESCRIPTION "Module Based Game Engine"
)
# Include guards
if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(
FATAL_ERROR
"In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there."
)
endif()
# compiler checks
include(external/compilerchecks.cmake)
# set output dirs
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/libs)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/libs)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# set linkage
link_directories(${CMAKE_BINARY_DIR}/libs)
# LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/libs/Debug)
if(EMSCRIPTEN)
message(STATUS "emscripten build")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Oz -s WASM=2 -s USE_SDL=0 -s ASYNCIFY -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1"
)
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -Oz -s WASM=2 -s USE_SDL=0 -s ASYNCIFY -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1"
)
file(GLOB HTML "${CMAKE_CURRENT_SOURCE_DIR}/html/*")
file(COPY ${HTML} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
set(ENABLE_TEST_COVERAGE OFF)
endif()
include(cmake/subdirlist.cmake)
include(external/external.cmake)
add_subdirectory(modules)
add_subdirectory(core)
option(ENABLE_TEST_COVERAGE "ENABLE_TEST_COVERAGE" ON)
if(ENABLE_TEST_COVERAGE)
add_subdirectory(test)
endif()
option(BUILD_EXAMPLES "BUILD_EXAMPLES" ON)
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
option(ENABLE_DOCUMENTATION "ENABLE_DOCUMENTATION" OFF)
if(ENABLE_DOCUMENTATION)
add_subdirectory(documentation)
endif()
option(ENABLE_EDITOR "ENABLE_EDITOR" ON)
if(ENABLE_EDITOR)
add_subdirectory(editor)
endif()
CPMAddPackage(
NAME CPMLicenses.cmake
GITHUB_REPOSITORY cpm-cmake/CPMLicenses.cmake
VERSION 0.0.5
)
write_license_disclaimer("third_party.txt" "${CPM_PACKAGES}")
# todo: follow https://github.com/TheLartians/ModernCppStarter