-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
109 lines (91 loc) · 3.24 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Speedup tips:
# - use jom instead of make -> parallel builds
cmake_minimum_required(VERSION 3.20)
include(ExternalProject)
project(ac_worldgen_master VERSION 1.0.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
list(APPEND EXTERNAL_ARGS
-D "CMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}"
-D "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
-D "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
-G "${CMAKE_GENERATOR}"
)
set(CMAKE_BASE_DIR "${CMAKE_BINARY_DIR}")
set(PROJECT_BASE_DIR "${PROJECT_SOURCE_DIR}")
include(platform_config.cmake)
# ===========================================
# Tracy
# ===========================================
ExternalProject_Add(
tracy
SOURCE_DIR "${PROJECT_SOURCE_DIR}/deps/tracy"
EXCLUDE_FROM_ALL ON
CMAKE_ARGS ${EXTERNAL_ARGS}
-D "CMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/install/tracy"
-D TRACY_ENABLE=ON
-D TRACY_ON_DEMAND=ON
)
# ===========================================
# Antlr
# ===========================================
ExternalProject_Add(
antlr
SOURCE_DIR "${PROJECT_SOURCE_DIR}/deps/antlr/runtime/Cpp"
EXCLUDE_FROM_ALL ON
TEST_COMMAND ""
CMAKE_ARGS ${EXTERNAL_ARGS}
-D ANTLR_BUILD_CPP_TESTS=OFF
-D WITH_STATIC_CRT=OFF
-D "CMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/install/antlr"
)
# ===========================================
# FastNoise2
# ===========================================
ExternalProject_Add(
fastNoise2
SOURCE_DIR "${PROJECT_SOURCE_DIR}/deps/fastNoise2"
EXCLUDE_FROM_ALL ON
TEST_COMMAND ""
CMAKE_ARGS ${EXTERNAL_ARGS}
-D FASTNOISE2_NOISETOOL=OFF
-D FASTNOISE2_TESTS=OFF
-D "CMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/install/fastNoise2"
)
# ===========================================
# Worldgen
# ===========================================
ExternalProject_Add(ac_worldgen_nodeploy
SOURCE_DIR "${PROJECT_SOURCE_DIR}/src"
BUILD_ALWAYS ON
INSTALL_COMMAND ""
EXCLUDE_FROM_ALL ON
CMAKE_ARGS ${EXTERNAL_ARGS}
)
ExternalProject_Add(ac_worldgen_deploy
DEPENDS antlr tracy fastNoise2
BUILD_ALWAYS ON
SOURCE_DIR "${PROJECT_SOURCE_DIR}/src"
INSTALL_COMMAND ""
CMAKE_ARGS ${EXTERNAL_ARGS}
)
# ===========================================
# Dummy target for intellisense
# ===========================================
add_executable(x_ac_worldgen_dummy WIN32 EXCLUDE_FROM_ALL)
file(
GLOB_RECURSE ac_client_src CONFIGURE_DEPENDS
"${PROJECT_BASE_DIR}/src/*.cc"
"${PROJECT_BASE_DIR}/src/*.cpp"
"${PROJECT_BASE_DIR}/src/*.h"
)
target_compile_definitions(x_ac_worldgen_dummy PRIVATE TRACY_ENABLE)
target_sources(x_ac_worldgen_dummy PRIVATE ${ac_client_src})
target_precompile_headers(x_ac_worldgen_dummy PRIVATE "${PROJECT_BASE_DIR}/src/pch.h")
target_include_directories(x_ac_worldgen_dummy PRIVATE "${PROJECT_BASE_DIR}/src")
target_include_directories(x_ac_worldgen_dummy SYSTEM PRIVATE
"${PROJECT_BASE_DIR}/include"
"${CMAKE_BASE_DIR}/install/tracy/include"
"${CMAKE_BASE_DIR}/install/antlr/include"
"${CMAKE_BASE_DIR}/install/fastNoise2/include"
)