-
Notifications
You must be signed in to change notification settings - Fork 340
/
CMakeLists.txt
202 lines (189 loc) · 6.18 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
190
191
192
193
194
195
196
197
198
199
200
201
cmake_minimum_required(VERSION 3.6)
project(external)
option(BUILD_EXT_BOX2D "Build with internal Box2D support" ON)
option(BUILD_EXT_CHIPMUNK "Build with internal chipmunk support" ON)
option(BUILD_EXT_FREETYPE2 "Build with internal freetype2 support" ON)
option(BUILD_EXT_RECAST "Build with internal recast support" ON)
option(BUILD_EXT_BULLET "Build with internal bullet support" ON)
option(BUILD_EXT_JPEG "Build with internal jpeg support" ON)
option(BUILD_EXT_OPENSSL "Build with internal openssl support" ON)
option(BUILD_EXT_TIFF "Build with internal tiff support" ON)
option(BUILD_EXT_UV "Build with internal uv support" ON)
option(BUILD_EXT_WEBP "Build with internal webp support" ON)
option(BUILD_EXT_WEBSOCKETS "Build with internal websockets support" ON)
option(BUILD_EXT_TINYXML2 "Build with internal tinyxml2 support" ON)
option(BUILD_EXT_XXHASH "Build with internal xxhash support" ON)
option(BUILD_EXT_XXTEA "Build with internal xxtea support" ON)
option(BUILD_EXT_CLIPPER "Build with internal clipper support" ON)
option(BUILD_EXT_EDTAA3FUNC "Build with internal edtaa3func support" ON)
option(BUILD_EXT_CONVERTUTF "Build with internal ConvertUTF support" ON)
option(BUILD_EXT_POLY2TRI "Build with internal poly2tri support" ON)
option(BUILD_EXT_MD5 "Build with internal md5 support" ON)
option(BUILD_EXT_SQLITE "Build with internal SQLite support" ON)
option(BUILD_EXT_ZLIB "Build with internal zlib support" ON)
option(BUILD_EXT_CURL "Build with internal curl support" ON)
option(BUILD_EXT_UNZIP "Build with internal unzip support" ON)
add_library(external empty.cpp)
if(BUILD_EXT_BOX2D)
add_subdirectory(Box2D)
target_link_libraries(external ext_box2d)
endif(BUILD_EXT_BOX2D)
if(BUILD_EXT_CHIPMUNK)
add_subdirectory(chipmunk)
target_link_libraries(external ext_chipmunk)
endif(BUILD_EXT_CHIPMUNK)
if(BUILD_EXT_FREETYPE2)
add_subdirectory(freetype2)
target_link_libraries(external ext_freetype)
endif(BUILD_EXT_FREETYPE2)
if(BUILD_EXT_RECAST)
add_subdirectory(recast)
target_link_libraries(external ext_recast)
endif(BUILD_EXT_RECAST)
if(BUILD_EXT_BULLET)
add_subdirectory(bullet)
target_link_libraries(external ext_bullet)
endif(BUILD_EXT_BULLET)
if(BUILD_EXT_JPEG)
add_subdirectory(jpeg)
target_link_libraries(external ext_jpeg)
endif(BUILD_EXT_JPEG)
if(BUILD_EXT_OPENSSL)
add_subdirectory(openssl)
target_link_libraries(external ext_ssl)
target_link_libraries(external ext_crypto)
endif(BUILD_EXT_OPENSSL)
if(BUILD_EXT_TIFF)
add_subdirectory(tiff)
target_link_libraries(external ext_tiff)
endif(BUILD_EXT_TIFF)
if(BUILD_EXT_UV)
add_subdirectory(uv)
target_link_libraries(external ext_uv)
endif(BUILD_EXT_UV)
if(BUILD_EXT_WEBP)
add_subdirectory(webp)
target_link_libraries(external ext_webp)
endif(BUILD_EXT_WEBP)
if(BUILD_EXT_WEBSOCKETS)
add_subdirectory(websockets)
target_link_libraries(external ext_websockets)
endif(BUILD_EXT_WEBSOCKETS)
if(BUILD_EXT_TINYXML2)
add_subdirectory(tinyxml2)
target_link_libraries(external ext_tinyxml2)
endif(BUILD_EXT_TINYXML2)
if(BUILD_EXT_XXHASH)
add_subdirectory(xxhash)
target_link_libraries(external ext_xxhash)
endif(BUILD_EXT_XXHASH)
if(BUILD_EXT_XXTEA)
add_subdirectory(xxtea)
target_link_libraries(external ext_xxtea)
endif(BUILD_EXT_XXTEA)
if(BUILD_EXT_CLIPPER)
add_subdirectory(clipper)
target_link_libraries(external ext_clipper)
endif(BUILD_EXT_CLIPPER)
if(BUILD_EXT_EDTAA3FUNC)
add_subdirectory(edtaa3func)
target_link_libraries(external ext_edtaa3func)
endif(BUILD_EXT_EDTAA3FUNC)
if(BUILD_EXT_CONVERTUTF)
add_subdirectory(ConvertUTF)
target_link_libraries(external ext_convertUTF)
endif(BUILD_EXT_CONVERTUTF)
if(BUILD_EXT_POLY2TRI)
add_subdirectory(poly2tri)
target_link_libraries(external ext_poly2tri)
endif(BUILD_EXT_POLY2TRI)
if(BUILD_EXT_MD5)
add_subdirectory(md5)
target_link_libraries(external ext_md5)
endif(BUILD_EXT_MD5)
# use lua/js specific libs by property to prevent conflict
if(BUILD_JS_LIBS)
add_subdirectory(spidermonkey)
set_property(TARGET external APPEND PROPERTY
CC_JS_DEPEND ext_spidermonkey
)
endif()
if(BUILD_LUA_LIBS)
add_subdirectory(lua/luajit)
add_subdirectory(lua/tolua)
add_subdirectory(lua/luasocket)
set_property(TARGET external APPEND PROPERTY
CC_LUA_DEPEND ext_luajit ext_tolua ext_luasocket
)
endif()
if(NOT LINUX)
if(BUILD_EXT_CURL)
add_subdirectory(curl)
target_link_libraries(external ext_curl)
endif(BUILD_EXT_CURL)
add_subdirectory(png)
target_link_libraries(external
ext_png
)
endif(NOT LINUX)
if(LINUX)
add_subdirectory(linux-specific/fmod)
target_link_libraries(external
ext_fmod
)
endif()
if(ANDROID)
add_subdirectory(android-specific/cpufeatures)
add_subdirectory(android-specific/pvmp3dec)
add_subdirectory(android-specific/tremolo)
target_link_libraries(external
ext_cpufeatures
ext_pvmp3dec
ext_tremolo
)
endif()
if(WINDOWS)
# sqlite3 prebuilt only existed at windows
if(BUILD_EXT_SQLITE)
add_subdirectory(sqlite3)
target_link_libraries(external ext_sqlite3)
endif(BUILD_EXT_SQLITE)
add_subdirectory(win32-specific/gles)
add_subdirectory(win32-specific/icon)
add_subdirectory(win32-specific/MP3Decoder)
add_subdirectory(win32-specific/OggDecoder)
add_subdirectory(win32-specific/OpenalSoft)
target_link_libraries(external
ext_gles
ext_icon
ext_MP3Decoder
ext_OggDecoder
ext_OpenalSoft
)
endif()
if(WINDOWS OR MACOSX OR LINUX)
add_subdirectory(glfw3)
target_link_libraries(external
ext_glfw3
)
endif()
if(MACOSX OR ANDROID OR WINDOWS)
if(BUILD_EXT_ZLIB)
add_subdirectory(zlib)
target_link_libraries(external
ext_zlib
)
endif(BUILD_EXT_ZLIB)
endif()
# unzip depend on zlib
if(BUILD_EXT_UNZIP)
add_subdirectory(unzip)
target_link_libraries(external ext_unzip)
endif(BUILD_EXT_UNZIP)
# put "external" into External folder, too
set_target_properties(external
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
FOLDER "External"
)