axmol/CMakeLists.txt

165 lines
3.9 KiB
CMake
Raw Normal View History

2013-11-02 14:40:07 +08:00
cmake_minimum_required(VERSION 2.6)
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
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_GUI "Build GUI library" ON)
option(BUILD_NETWORK "Build network library" 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_HelloCpp "Only build HelloCpp sample" ON)
option(BUILD_TestCpp "Only build TestCpp sample" ON)
option(BUILD_HelloLua "Only build HelloLua sample" ON)
option(BUILD_TestLua "Only build TestLua sample" ON)
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-02 16:31:52 +08:00
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")
if(USE_CHIPMUNK)
message("Using chipmunk ...")
add_definitions(-DLINUX -DCC_ENABLE_CHIPMUNK_INTEGRATION=1)
elseif(USE_BOX2D)
message("Using box2d ...")
add_definitions(-DLINUX -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()
include_directories(
2013-11-02 18:07:34 +08:00
.
cocos
cocos/audio/include
2013-11-02 14:40:07 +08:00
cocos/2d
cocos/2d/platform
cocos/2d/platform/linux
cocos/base
cocos/physics
2013-11-02 18:07:34 +08:00
cocos/editor-support
2013-11-02 14:40:07 +08:00
cocos/math/kazmath/include
2013-11-02 19:14:29 +08:00
extensions
2013-11-02 18:07:34 +08:00
external
2013-11-02 14:40:07 +08:00
external/jpeg/include/linux
external/tiff/include/linux
external/webp/include/linux
external/glfw3/include/linux
2013-11-02 18:07:34 +08:00
external/curl/include/linux/${ARCH_DIR}
2013-11-02 14:40:07 +08:00
external/tinyxml2
external/unzip
external/chipmunk/include/chipmunk
external/freetype2/include/linux
external/linux-specific/fmod/include/${ARCH_DIR}
2013-11-02 14:40:07 +08:00
)
link_directories(
/usr/local/lib
${CMAKE_SOURCE_DIR}/external/jpeg/prebuilt/linux/${ARCH_DIR}
${CMAKE_SOURCE_DIR}/external/tiff/prebuilt/linux/${ARCH_DIR}
${CMAKE_SOURCE_DIR}/external/webp/prebuilt/linux/${ARCH_DIR}
${CMAKE_SOURCE_DIR}/external/freetype2/prebuilt/linux/${ARCH_DIR}
2013-11-02 18:07:34 +08:00
${CMAKE_SOURCE_DIR}/external/curl/prebuilt/linux/${ARCH_DIR}
${CMAKE_SOURCE_DIR}/external/linux-specific/fmod/prebuilt/${ARCH_DIR}
2013-11-02 14:40:07 +08:00
)
2013-11-02 14:40:07 +08:00
# kazmath
add_subdirectory(cocos/math/kazmath)
# 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)
2013-11-02 18:07:34 +08:00
# audio
add_subdirectory(cocos/audio)
2013-11-02 14:40:07 +08:00
# cocos base library
add_subdirectory(cocos/base)
# cocos 2d library
add_subdirectory(cocos/2d)
if(BUILD_GUI)
# gui
2013-11-02 18:07:34 +08:00
add_subdirectory(cocos/gui)
endif(BUILD_GUI)
2013-11-02 18:07:34 +08:00
if(BUILD_NETWORK)
# network
2013-11-02 18:07:34 +08:00
add_subdirectory(cocos/network)
endif(BUILD_NETWORK)
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)
# jsoncpp library, cocostuido depends on jsoncpp
add_subdirectory(external/json)
endif(BUILD_EDITOR_COCOSTUDIO)
2013-11-02 18:07:34 +08:00
if(BUILD_LIBS_LUA)
## Scripting
# lua
2013-11-02 19:14:29 +08:00
add_subdirectory(external/lua/lua)
# tolua
2013-11-02 19:14:29 +08:00
add_subdirectory(external/lua/tolua)
# luabinding
2013-11-02 19:14:29 +08:00
add_subdirectory(cocos/scripting)
endif(BUILD_LIBS_LUA)
2013-11-02 19:14:29 +08:00
2013-11-02 16:31:52 +08:00
# build samples
add_subdirectory(samples)