-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
140 lines (122 loc) · 4.16 KB
/
CMakeLists.txt
File metadata and controls
140 lines (122 loc) · 4.16 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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
cmake_minimum_required(VERSION 3.24)
set(MACOSX_DEPLOYMENT_TARGET 10.10)
# Use release build type as default (assimp complains if this is unset)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
project(PrimeWorldEditor LANGUAGES C CXX)
option(PWE_PUBLIC_RELEASE "Enable end-user deployment configuration for PWE" ON)
if (PWE_PUBLIC_RELEASE AND "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
add_compile_definitions(PUBLIC_RELEASE)
message(STATUS "Enabled public release mode")
endif()
# Ensure submodules checked out
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/externals/LibCommon/CMakeLists.txt)
message(FATAL_ERROR "Please run 'git submodule update --init --recursive' to fetch submodules.")
endif()
include(cmake/generate_product_version.cmake)
set(CMAKE_CXX_STANDARD 23)
# Dependencies
include(FetchContent)
set(ASSIMP_BUILD_ASSIMP_TOOLS OFF)
set(ASSIMP_BUILD_MINIZIP ON)
set(ASSIMP_BUILD_TESTS OFF)
set(ASSIMP_BUILD_ZLIB OFF)
set(ASSIMP_WARNINGS_AS_ERRORS OFF)
set(tinyxml2_BUILD_TESTING OFF)
set(BUILD_SHARED_LIBS OFF)
set(ZLIB_BUILD_EXAMPLES OFF)
set(ZLIB_LIBRARY zlibstatic)
FetchContent_Declare(
zlib
GIT_REPOSITORY https://github.com/madler/zlib.git
GIT_TAG v1.3.1
OVERRIDE_FIND_PACKAGE
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(zlib)
set(ZLIB_INCLUDE_DIR ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR})
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 12.1.0
OVERRIDE_FIND_PACKAGE
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(fmt)
set(SPDLOG_FMT_EXTERNAL ON)
FetchContent_Declare(
spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog.git
GIT_TAG v1.17.0
OVERRIDE_FIND_PACKAGE
EXCLUDE_FROM_ALL
)
FetchContent_Declare(
assimp
GIT_REPOSITORY https://github.com/assimp/assimp.git
GIT_TAG v6.0.2
OVERRIDE_FIND_PACKAGE
EXCLUDE_FROM_ALL
)
FetchContent_Declare(
nod
GIT_REPOSITORY https://github.com/AxioDL/nod.git
GIT_TAG 20fa7905b99a81d335769459ee8f6d7b81c923c2
OVERRIDE_FIND_PACKAGE
EXCLUDE_FROM_ALL
)
FetchContent_Declare(
lzokay
GIT_REPOSITORY https://github.com/AxioDL/lzokay.git
GIT_TAG db2df1fcbebc2ed06c10f727f72567d40f06a2be
OVERRIDE_FIND_PACKAGE
EXCLUDE_FROM_ALL
)
FetchContent_Declare(
tinyxml2
GIT_REPOSITORY https://github.com/leethomason/tinyxml2.git
GIT_TAG 11.0.0
OVERRIDE_FIND_PACKAGE
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(spdlog assimp nod lzokay tinyxml2)
if(MSVC)
# I hate hate hate microsoft compiler devs for not just letting /utf-8 and /source-charset:utf-8 be present
# alongside one another without errors (assimp requires this).
get_target_property(EXTLIB_COMPILE_FLAGS assimp COMPILE_OPTIONS)
list(REMOVE_ITEM EXTLIB_COMPILE_FLAGS /source-charset:utf-8)
set_target_properties(assimp PROPERTIES COMPILE_OPTIONS "${EXTLIB_COMPILE_FLAGS}")
add_compile_options(
/MP # Multiprocessor compilation
/WX # Warnings as errors
/wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data
/wd4100 # 'identifier' : unreferenced formal parameter
/wd4101 # 'identifier': unreferenced local variable
/wd4189 # 'identifier' : local variable is initialized but not referenced
# Compiler conformance settings
/permissive-
/volatile:iso
/Zc:enumTypes
/Zc:inline
/Zc:preprocessor
/Zc:templateScope
/Zc:throwingNew
)
else()
add_compile_options(-Wno-multichar -Wno-undefined-var-template -Wno-error=array-bounds -fcommon)
endif()
if(APPLE)
add_compile_definitions(GL_SILENCE_DEPRECATION)
endif()
# Set where the binary files will be built. The program will not execute from
# here. You must run "make install" to install these to the proper location
# as defined above.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Directly integrate libcommon and block install targets
set(LIBCOMMON_GENERATE_INSTALL_TARGETS OFF CACHE BOOL "Make libcommon install targets" FORCE)
set(CODEGEN_BUILD_PACKAGE_DURING_CONFIGURE ON)
add_subdirectory(externals/LibCommon)
add_subdirectory(src/Core)
add_subdirectory(src/Editor)