forked from RobertBeckebans/RBDOOM-3-BFG
-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
189 lines (137 loc) · 3.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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
project(OpenTechEngine)
################################################################################
option(USE_MFC_TOOLS
"Compile the built-in MFC based tools" OFF)
option(MONOLITH
"Embed game logic into main executable" ON)
option(SDL2
"Use SDL2 instead of SDL1.2" ON)
option(OPENAL
"Use OpenAL soft instead of XAudio2" OFF)
if(NOT MSVC)
# on other platforms we must use openal because they don't have xaudio - and mingw is missing XAudio2.h
# FIXME: can we somehow have it default to OFF on windows and ON everywhere else?
set(OPENAL TRUE)
endif()
option(FFMPEG
"Use FMPEG to render Bink videos" OFF)
option(IDTOOLS
"Compile the built-in game tools" ON)
option(CEGUI
"Use cegui" ON)
option(libJPEG
"Use jpeg" ON)
if((WIN32 AND (CMAKE_COMPILER_IS_GNUCC OR NOT $ENV{VSINSTALLDIR})) OR
${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# breakpad doesn't work on mingw out of the box
# and it requires DIA SDK which is under VSINSTALLDIR
option(BREAKPAD
"Use breakpad" OFF)
else()
option(BREAKPAD
"Use breakpad" ON)
endif()
#options########################################################################
# FIXME: should autodetect if there is a version available by CMake and use that if yes?
option(BUNDLED_JPEG
"Use bundled libjpeg" ON)
option(BUNDLED_PNG
"Use bundled libpng" ON)
option(BUNDLED_ZLIB
"Use bundled zlib" ON)
option(BUNDLED_MINIZIP
"Use bundled minizip" ON)
option(BUNDLED_IRRXML
"Use bundled irrxml" OFF)
option(BUNDLED_GLEW
"Use bundled glew" ON)
option(BUNDLED_OGGVORBIS
"Use bundled oggvorbis" OFF)
option(BUNDLED_OPENAL
"Use bundled openal" OFF)
if(NOT MSVC)
# on other platforms we must use openal because they don't have xaudio - and mingw is missing XAudio2.h
# FIXME: can we somehow have it default to OFF on windows and ON everywhere else?
set(BUNDLED_OPENAL TRUE)
endif()
option(BUNDLED_SDL
"Use bundled SDL" OFF)
option(BUNDLED_CEGUI
"Use bundled CEGUI" ON)
################################################################################
message(STATUS CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE})
###############
# libjpeg
if(BUNDLED_JPEG AND libJPEG)
add_subdirectory(libs/jpeg)
endif()
# zlib and minizip
if(BUNDLED_ZLIB)
add_subdirectory(libs/zlib)
endif()
# libpng
if(BUNDLED_PNG)
add_subdirectory(libs/png)
endif()
# glew
if(BUNDLED_GLEW)
add_subdirectory(libs/glew)
endif()
# oggvorbis
if(BUNDLED_OGGVORBIS)
add_subdirectory(libs/oggvorbis)
endif()
# openal
if(BUNDLED_OPENAL)
add_subdirectory(libs/openal-soft)
endif()
# sdl
if(BUNDLED_SDL)
# add_subdirectory(libs/sdl)
endif()
# cegui
if(BUNDLED_CEGUI)
# freetype, if not found, we build ours
find_package(Freetype)
if(NOT FREETYPE_FOUND)
add_subdirectory(libs/freetype)
set(BUNDLED_FREETYPE ON CACHE BOOL "Select BUNDLED_FREETYPE for cegui" FORCE)
endif()
add_subdirectory(libs/cegui)
endif()
# breakpad
if(BREAKPAD)
add_subdirectory(libs/breakpad)
endif()
####
# imgui is always bundled
add_subdirectory(libs/imgui)
add_subdirectory(neo)
#### install and packaging
if(UNIX)
install(DIRECTORY "base" DESTINATION "bin" COMPONENT Assets)
elseif(WIN32)
install(DIRECTORY "base" DESTINATION "." COMPONENT Assets)
else()
install(DIRECTORY "base" DESTINATION "bin" COMPONENT Assets)
endif()
#### create symlinks for unix so game can be run from build
if(UNIX)
add_custom_target(
"OpenTechEngine_symlinks" ALL
COMMAND ln -sf "${CMAKE_SOURCE_DIR}/base" "${CMAKE_BINARY_DIR}/base"
COMMAND ln -sf "${CMAKE_SOURCE_DIR}/base" "${CMAKE_BINARY_DIR}/neo/base"
COMMAND ln -sf "${CMAKE_BINARY_DIR}/neo/OpenTechEngine" "${CMAKE_BINARY_DIR}/OpenTechEngine"
)
if(BUNDLED_CEGUI)
add_custom_target(
"CEGUI_lib_symlinks" ALL
COMMAND ln -sf "${CMAKE_BINARY_DIR}/libs/cegui/CEGUI.git/lib" "${CMAKE_BINARY_DIR}/lib"
)
endif()
endif()
# cpack
include(${CMAKE_CURRENT_SOURCE_DIR}/CPackConfig.cmake)
include(CPack)