axmol/CMakeLists.txt

275 lines
8.5 KiB
CMake
Raw Normal View History

#/****************************************************************************
# Copyright (c) 2013 cocos2d-x.org
# Copyright (c) 2012-2013 martell malone
#
# 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 (Cocos2dx)
2013-11-02 14:40:07 +08:00
# The version number
set(Cocos2dxSamples_VERSION_MAJOR 3)
set(Cocos2dxSamples_VERSION_MINOR 0)
2013-11-02 16:31:52 +08:00
include(build/BuildHelpers.CMakeLists.txt)
2013-11-02 14:40:07 +08:00
2013-12-02 15:41:27 +08:00
if(WIN32 OR APPLE)
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" OFF)
2014-01-08 16:58:36 +08:00
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)
2014-03-11 17:52:28 +08:00
option(BUILD_CppTests "Only build TestCpp sample" ON)
option(BUILD_LuaTests "Only build TestLua sample" OFF)
2013-12-02 15:41:27 +08:00
else()#temp
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)
2013-12-02 15:41:27 +08:00
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)
2014-03-11 17:52:28 +08:00
option(BUILD_CppTests "Only build TestCpp sample" ON)
option(BUILD_LuaTests "Only build TestLua sample" ON)
2013-12-02 15:41:27 +08:00
endif()#temp
if(DEBUG_MODE)
2013-11-07 05:24:33 +08:00
set(CMAKE_BUILD_TYPE DEBUG)
else(DEBUG_MODE)
2013-11-07 05:24:33 +08:00
set(CMAKE_BUILD_TYPE RELEASE)
endif(DEBUG_MODE)
2013-11-30 14:09:12 +08:00
set(CMAKE_C_FLAGS_DEBUG "-DCOCOS2D_DEBUG=1")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
2013-11-30 16:08:58 +08:00
if(WIN32)
2013-12-02 14:57:47 +08:00
ADD_DEFINITIONS (-D_USRDLL -DCOCOS2DXWIN32_EXPORTS -D_WINDOWS -DWIN32)
2013-11-30 14:09:12 +08:00
2013-11-30 16:08:58 +08:00
if(MSVC)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS
-D_SCL_SECURE_NO_WARNINGS
-wd4251 -wd4244 -wd4334
-wd4005 -wd4820 -wd4710
-wd4514 -wd4056 -wd4996 -wd4099)
2013-11-30 16:08:58 +08:00
else(MSVC)#MINGW
endif(MSVC)
elseif(APPLE)
2013-11-02 16:31:52 +08:00
2013-11-30 16:08:58 +08:00
else()#Linux
ADD_DEFINITIONS(-DLINUX)
endif()
2013-11-30 14:09:12 +08:00
2013-11-30 16:08:58 +08:00
if(NOT MSVC)# all gcc
2013-12-02 14:57:47 +08:00
set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1")
2013-11-30 16:08:58 +08:00
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")
2013-11-30 14:09:12 +08:00
endif()
2013-12-02 14:57:47 +08:00
if(MINGW)
add_definitions(-DGLEW_STATIC)
2014-05-28 00:17:09 +08:00
add_definitions(-D__SSIZE_T)
2013-12-02 14:57:47 +08:00
endif()
2013-11-30 14:09:12 +08:00
if(USE_CHIPMUNK)
message("Using chipmunk ...")
2013-11-30 14:09:12 +08:00
add_definitions(-DCC_ENABLE_CHIPMUNK_INTEGRATION=1)
elseif(USE_BOX2D)
message("Using box2d ...")
2013-11-30 14:09:12 +08:00
add_definitions(-DCC_ENABLE_BOX2D_INTEGRATION=1)
else(USE_CHIPMUNK)
message(FATAL_ERROR "Must choose a physics library.")
endif(USE_CHIPMUNK)
2013-11-02 14:40:07 +08:00
# architecture
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(ARCH_DIR "64-bit")
else()
set(ARCH_DIR "32-bit")
endif()
2013-11-30 14:09:12 +08:00
if(WIN32) # Win32
set(PLATFORM_FOLDER win32)
elseif(APPLE)# osx or ios
set(PLATFORM_FOLDER mac)
else() # Assume Linux
set(PLATFORM_FOLDER linux)
endif()
2013-11-02 14:40:07 +08:00
include_directories(
2013-11-30 14:09:12 +08:00
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/cocos
Squashed commit of the following: commit a794d107ad85667e3d754f0b6251fc864dfbf288 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 14:33:49 2014 -0700 Yeah... everything compiles on win32 and wp8 commit 4740be6e4a0d16f742c27996e7ab2c100adc76af Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 13:58:38 2014 -0700 CCIME moved to base and compiles on Android commit ff3e1bf1eb27a01019f4e1b56d1aebbe2d385f72 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 13:02:57 2014 -0700 compiles Ok for Windows Phone 8 commit 8160a4eb2ecdc61b5bd1cf56b90d2da6f11e3ebd Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 12:25:31 2014 -0700 fixes for Windows Phone 8 commit 418197649efc93032aee0adc205e502101cdb53d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 11:15:13 2014 -0700 Compiles on Win32 commit 08813ed7cf8ac1079ffadeb1ce78ea9e833e1a33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 10:08:31 2014 -0700 Compiles on linux! commit 118896521e5b335a5257090b6863f1fb2a2002fe Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 09:30:42 2014 -0700 moves cocos/2d/platform -> cocos/platform commit 4fe9319d7717b0c1bccb2db0156eeb86255a89e0 Merge: bd68ec2 511295e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 08:24:41 2014 -0700 Merge remote-tracking branch 'cocos2d/v3' into files commit bd68ec2f0e3a826d8b2f4b60564ba65ce766bc56 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu May 15 19:36:23 2014 -0700 files in the correct directory
2014-05-17 05:36:00 +08:00
${CMAKE_CURRENT_SOURCE_DIR}/cocos/platform/desktop
${CMAKE_CURRENT_SOURCE_DIR}/cocos/platform/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/cocos/audio/include
2013-11-30 14:09:12 +08:00
${CMAKE_CURRENT_SOURCE_DIR}/cocos/editor-support
2014-03-11 18:18:19 +08:00
${CMAKE_CURRENT_SOURCE_DIR}/cocos/scripting/lua-bindings/auto
${CMAKE_CURRENT_SOURCE_DIR}/cocos/scripting/lua-bindings/manual
2013-11-30 14:09:12 +08:00
${CMAKE_CURRENT_SOURCE_DIR}/extensions
${CMAKE_CURRENT_SOURCE_DIR}/external
${CMAKE_CURRENT_SOURCE_DIR}/external/tinyxml2
${CMAKE_CURRENT_SOURCE_DIR}/external/unzip
${CMAKE_CURRENT_SOURCE_DIR}/external/edtaa3func
2013-11-30 14:09:12 +08:00
${CMAKE_CURRENT_SOURCE_DIR}/external/chipmunk/include/chipmunk
${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/png/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/webp/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/glfw3/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/include/${PLATFORM_FOLDER}
2014-02-11 22:21:15 +08:00
${CMAKE_CURRENT_SOURCE_DIR}/external/websockets/include/${PLATFORM_FOLDER}
2014-03-31 15:43:35 +08:00
${CMAKE_CURRENT_SOURCE_DIR}/external/xxhash
2013-11-02 14:40:07 +08:00
)
if(WIN32 AND NOT MINGW)
2013-11-30 14:09:12 +08:00
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/gles/include/OGLES
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/icon/include
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/zlib/include
external/curl/include/${PLATFORM_FOLDER}
2013-11-30 14:09:12 +08:00
)
elseif(APPLE)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/external/curl/include/${PLATFORM_FOLDER}
)
else()
include_directories(
/usr/include
2014-02-11 23:35:52 +08:00
/usr/include/GLFW
/usr/local/include/GLFW
2013-11-30 14:09:12 +08:00
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/fmod/include/${ARCH_DIR}
)
endif()
if(WIN32)
2013-12-02 14:57:47 +08:00
if(NOT MINGW)
2013-11-30 14:09:12 +08:00
link_directories(
${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/prebuilt/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/prebuilt/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/png/prebuilt/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/prebuilt/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/curl/prebuilt/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/icon/prebuilt
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/zlib/prebuilt
2013-11-30 14:09:12 +08:00
)
2013-12-02 14:57:47 +08:00
endif()
2013-11-30 14:09:12 +08:00
elseif(APPLE)
else()
link_directories(
/usr/local/lib
${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/external/webp/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/external/png/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
2014-02-11 22:21:15 +08:00
${CMAKE_CURRENT_SOURCE_DIR}/external/websockets/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
2013-11-30 14:09:12 +08:00
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/fmod/prebuilt/${ARCH_DIR}
)
endif()
2013-11-02 14:40:07 +08:00
# chipmunk library
add_subdirectory(external/chipmunk/src)
2013-11-02 18:07:34 +08:00
# box2d library
add_subdirectory(external/Box2D)
2013-11-02 14:40:07 +08:00
# unzip library
add_subdirectory(external/unzip)
# tinyxml2 library
add_subdirectory(external/tinyxml2)
2014-04-01 16:49:24 +08:00
# xxhash library
2014-03-31 15:43:35 +08:00
add_subdirectory(external/xxhash)
2013-11-02 18:07:34 +08:00
# audio
add_subdirectory(cocos/audio)
# cocos2d library
add_subdirectory(cocos)
2013-11-02 18:07:34 +08:00
if(BUILD_EXTENSIONS)
# extensions
2013-11-04 13:10:04 +08:00
add_subdirectory(extensions)
endif(BUILD_EXTENSIONS)
2013-11-04 13:10:04 +08:00
## Editor Support
if(BUILD_EDITOR_SPINE)
# spine
2013-11-02 18:07:34 +08:00
add_subdirectory(cocos/editor-support/spine)
endif(BUILD_EDITOR_SPINE)
if(BUILD_EDITOR_COCOSBUILDER)
# cocosbuilder
2013-11-02 18:07:34 +08:00
add_subdirectory(cocos/editor-support/cocosbuilder)
endif(BUILD_EDITOR_COCOSBUILDER)
2013-11-02 18:07:34 +08:00
if(BUILD_EDITOR_COCOSTUDIO)
# cocostudio
add_subdirectory(cocos/editor-support/cocostudio)
endif(BUILD_EDITOR_COCOSTUDIO)
2013-11-02 18:07:34 +08:00
## Scripting
if(BUILD_LIBS_LUA)
# lua
add_subdirectory(external/lua/lua)
# tolua
add_subdirectory(external/lua/tolua)
# luabinding
add_subdirectory(cocos/scripting/lua-bindings)
endif(BUILD_LIBS_LUA)
2014-02-01 06:09:28 +08:00
# build tests
2013-12-31 15:08:21 +08:00
2014-03-11 17:52:28 +08:00
add_subdirectory(tests/cpp-empty-test)
2013-12-31 15:08:21 +08:00
2014-03-11 17:52:28 +08:00
if(BUILD_CppTests)
add_subdirectory(tests/cpp-tests)
endif(BUILD_CppTests)
if(BUILD_LuaTests)
add_subdirectory(tests/lua-tests/project)
2014-04-25 15:10:37 +08:00
add_subdirectory(tests/lua-empty-test/project)
2014-03-11 17:52:28 +08:00
endif(BUILD_LuaTests)