forked from cocos2d/cocos2d-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
203 lines (166 loc) · 8.23 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
#/****************************************************************************
# Copyright (c) 2014 Chukong Technologies Inc.
#
# http://www.cocos2d-x.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# ****************************************************************************/
cmake_minimum_required(VERSION 2.8)
project (Cocos2djs)
# The version number
#set(Cocos2djsSamples_VERSION_MAJOR 3)
#set(Cocos2djsSamples_VERSION_MINOR 0)
include(frameworks/js-bindings/cocos2d-x/cmake/BuildHelpers.CMakeLists.txt)
option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
option(USE_BOX2D "Use box2d for physics library" OFF)
option(DEBUG_MODE "Debug or release?" ON)
option(BUILD_LIBS_LUA "Build lua libraries" ON)
option(BUILD_EXTENSIONS "Build extension library" ON)
option(BUILD_EDITOR_SPINE "Build editor support for spine" ON)
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON)
option(BUILD_JSTests "build TestJS sample" ON)
option(BUILD_JSMOONWARRIORS "build MoonWarriors sample" ON)
if(DEBUG_MODE)
set(CMAKE_BUILD_TYPE DEBUG)
else(DEBUG_MODE)
set(CMAKE_BUILD_TYPE RELEASE)
endif(DEBUG_MODE)
set(CMAKE_C_FLAGS_DEBUG "-DCOCOS2D_DEBUG=1")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
if(WIN32)
ADD_DEFINITIONS (-D_USRDLL -DCOCOS2DXWIN32_EXPORTS -D_WINDOWS -DWIN32)
if(MSVC)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS
-D_SCL_SECURE_NO_WARNINGS
-wd4251 -wd4244 -wd4334
-wd4005 -wd4820 -wd4710
-wd4514 -wd4056 -wd4996 -wd4099)
else(MSVC)#MINGW
endif(MSVC)
elseif(APPLE)
else()#Linux
ADD_DEFINITIONS(-DLINUX)
endif()
if(NOT MSVC)# all gcc
set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-std=c99")
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11")
endif()
if(MINGW)
add_definitions(-DGLEW_STATIC)
endif()
if(USE_CHIPMUNK)
message("Using chipmunk ...")
add_definitions(-DCC_ENABLE_CHIPMUNK_INTEGRATION=1)
elseif(USE_BOX2D)
message("Using box2d ...")
add_definitions(-DCC_ENABLE_BOX2D_INTEGRATION=1)
else(USE_CHIPMUNK)
message(FATAL_ERROR "Must choose a physics library.")
endif(USE_CHIPMUNK)
# architecture
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(ARCH_DIR "64-bit")
else()
set(ARCH_DIR "32-bit")
endif()
if(WIN32) # Win32
set(PLATFORM_FOLDER win32)
elseif(APPLE)# osx or ios
set(PLATFORM_FOLDER mac)
else() # Assume Linux
set(PLATFORM_FOLDER linux)
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/cocos
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/cocos/platform
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/cocos/platform/desktop
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/cocos/platform/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/cocos/audio/include
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/cocos/editor-support
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/cocos/scripting/lua-bindings/auto
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/cocos/scripting/lua-bindings/manual
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/extensions
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/tinyxml2
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/unzip
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/edtaa3func
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/chipmunk/include/chipmunk
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/jpeg/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/png/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/tiff/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/webp/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/glfw3/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/freetype2/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/websockets/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/xxhash
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/external/spidermonkey/include/${PLATFORM_FOLDER}
)
if(WIN32)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/${PLATFORM_FOLDER}-specific/gles/include/OGLES
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/${PLATFORM_FOLDER}-specific/icon/include
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/${PLATFORM_FOLDER}-specific/zlib/include
external/curl/include/${PLATFORM_FOLDER}
)
elseif(APPLE)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/curl/include/${PLATFORM_FOLDER}
)
else()
include_directories(
/usr/include
/usr/include/GLFW
/usr/local/include/GLFW
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/${PLATFORM_FOLDER}-specific/fmod/include/${ARCH_DIR}
)
endif()
link_directories(
/usr/local/lib
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/chipmunk/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/jpeg/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/tiff/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/webp/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/png/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/freetype2/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/websockets/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/${PLATFORM_FOLDER}-specific/fmod/prebuilt/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/external/spidermonkey/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
)
# build for 3rd party libraries
if(LINUX OR APPLE)
add_subdirectory(frameworks/js-bindings/cocos2d-x/external/Box2D)
add_subdirectory(frameworks/js-bindings/cocos2d-x/external/unzip)
add_subdirectory(frameworks/js-bindings/cocos2d-x/external/xxhash)
add_subdirectory(frameworks/js-bindings/cocos2d-x/external/tinyxml2)
add_subdirectory(frameworks/js-bindings/cocos2d-x/external/protobuf-lite)
endif()
# cocos2d library
add_subdirectory(frameworks/js-bindings/cocos2d-x/cocos)
# jsbindings library
add_subdirectory(frameworks/js-bindings/bindings)
#js-moonwarriors sample
if(BUILD_JSMOONWARRIORS)
add_subdirectory(samples/js-moonwarriors)
endif(BUILD_JSMOONWARRIORS)
#js-tests sample
if(BUILD_JSTests)
add_subdirectory(samples/js-tests)
endif(BUILD_JSTests)