2013-12-05 11:37:27 +08:00
|
|
|
#/****************************************************************************
|
|
|
|
# Copyright (c) 2013 cocos2d-x.org
|
2014-08-06 22:43:19 +08:00
|
|
|
# Copyright (c) 2014 martell malone
|
|
|
|
#
|
2013-12-05 11:37:27 +08:00
|
|
|
# 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.
|
|
|
|
# ****************************************************************************/
|
|
|
|
|
2013-11-30 17:11:36 +08:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2014-09-11 07:26:32 +08:00
|
|
|
project (Cocos2d-X)
|
2013-11-02 14:40:07 +08:00
|
|
|
|
|
|
|
# The version number
|
2014-09-10 03:18:31 +08:00
|
|
|
set(COCOS2D_X_VERSION 3.3.0)
|
|
|
|
#set(CMAKE_C_COMPILER_INIT g++)
|
2013-11-02 14:40:07 +08:00
|
|
|
|
2013-11-02 16:31:52 +08:00
|
|
|
include(build/BuildHelpers.CMakeLists.txt)
|
2013-11-02 14:40:07 +08:00
|
|
|
|
2014-08-06 22:43:19 +08:00
|
|
|
message(${BUILDING_STRING})
|
2013-12-02 15:41:27 +08:00
|
|
|
|
2013-11-06 19:15:20 +08:00
|
|
|
if(DEBUG_MODE)
|
2013-11-07 05:24:33 +08:00
|
|
|
set(CMAKE_BUILD_TYPE DEBUG)
|
2013-11-06 19:15:20 +08:00
|
|
|
else(DEBUG_MODE)
|
2013-11-07 05:24:33 +08:00
|
|
|
set(CMAKE_BUILD_TYPE RELEASE)
|
2013-11-06 19:15:20 +08:00
|
|
|
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})
|
|
|
|
|
2014-08-06 22:43:19 +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)
|
|
|
|
else()
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
|
2014-08-06 22:06:37 +08:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions -std=c99")
|
2014-08-24 18:52:51 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -std=c++11 -Wno-deprecated-declarations -Wno-reorder")
|
2014-08-06 22:43:19 +08:00
|
|
|
endif(MSVC)
|
2013-11-30 14:09:12 +08:00
|
|
|
|
2014-08-06 22:43:19 +08:00
|
|
|
if(WINDOWS)
|
|
|
|
ADD_DEFINITIONS (-D_USRDLL -DCOCOS2DXWIN32_EXPORTS -D_WINDOWS -DWIN32)
|
|
|
|
set(PLATFORM_FOLDER win32)
|
|
|
|
elseif(MACOSX)
|
2014-09-10 03:18:31 +08:00
|
|
|
ADD_DEFINITIONS (-DCC_TARGET_OS_MAC)
|
|
|
|
ADD_DEFINITIONS (-DUSE_FILE32API)
|
2014-08-06 22:43:19 +08:00
|
|
|
set(PLATFORM_FOLDER mac)
|
2014-09-10 03:18:31 +08:00
|
|
|
elseif(LINUX)
|
2014-08-06 22:43:19 +08:00
|
|
|
ADD_DEFINITIONS(-DLINUX)
|
|
|
|
set(PLATFORM_FOLDER linux)
|
2014-09-10 03:18:31 +08:00
|
|
|
else()
|
|
|
|
message( FATAL_ERROR "Unsupported platform, CMake will exit" )
|
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)
|
2014-05-30 20:14:22 +08:00
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lws2_32")
|
|
|
|
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lws2_32")
|
2013-12-02 14:57:47 +08:00
|
|
|
|
2014-08-06 22:43:19 +08:00
|
|
|
if(CLANG)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions ")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions ")
|
|
|
|
endif()
|
|
|
|
endif()
|
2013-11-30 14:09:12 +08:00
|
|
|
|
2013-11-02 14:40:07 +08:00
|
|
|
# architecture
|
|
|
|
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
2014-09-10 03:18:31 +08:00
|
|
|
set(ARCH_DIR "64-bit")
|
|
|
|
elseif ( CMAKE_SIZEOF_VOID_P EQUAL 4 )
|
|
|
|
set(ARCH_DIR "32-bit")
|
|
|
|
else()
|
|
|
|
message( FATAL_ERROR "Unsupported architecture, CMake will exit" )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Specific Include Directories
|
|
|
|
if(LINUX)
|
|
|
|
set(PLATFORM_INCLUDE_DIR
|
|
|
|
/usr/include
|
|
|
|
/usr/include/GLFW
|
|
|
|
/usr/local/include/GLFW
|
|
|
|
)
|
2013-11-02 14:40:07 +08:00
|
|
|
else()
|
2014-09-10 03:18:31 +08:00
|
|
|
set(PLATFORM_INCLUDE_DIR
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/external/glfw3/include/${PLATFORM_FOLDER}
|
|
|
|
)
|
2013-11-02 14:40:07 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
include_directories(
|
2014-09-10 03:18:31 +08:00
|
|
|
${PLATFORM_INCLUDE_DIR}
|
2013-11-30 14:09:12 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cocos
|
2014-08-24 18:52:51 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
2014-05-17 05:36:00 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cocos/platform/${PLATFORM_FOLDER}
|
2013-11-30 14:09:12 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/extensions
|
2014-08-25 10:12:36 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/external
|
2013-11-02 14:40:07 +08:00
|
|
|
)
|
|
|
|
|
2014-09-10 03:18:31 +08:00
|
|
|
# Specific Link Directories
|
|
|
|
if(LINUX)
|
|
|
|
set(PLATFORM_LINK_DIR
|
|
|
|
/usr/local/lib
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/fmod/prebuilt/${ARCH_DIR}
|
|
|
|
)
|
|
|
|
set(PLATFORM_FOLDER_ARCH
|
|
|
|
${PLATFORM_FOLDER}/${ARCH_DIR}
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
set(PLATFORM_FOLDER_ARCH
|
|
|
|
${PLATFORM_FOLDER}
|
|
|
|
)
|
|
|
|
set(PLATFORM_LINK_DIR
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/external/glfw3/prebuilt/${PLATFORM_FOLDER_ARCH}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2014-08-24 18:52:51 +08:00
|
|
|
link_directories(
|
2014-09-10 03:18:31 +08:00
|
|
|
${PLATFORM_LINK_DIR}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/prebuilt/${PLATFORM_FOLDER_ARCH}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/prebuilt/${PLATFORM_FOLDER_ARCH}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/external/webp/prebuilt/${PLATFORM_FOLDER_ARCH}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/external/png/prebuilt/${PLATFORM_FOLDER_ARCH}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/prebuilt/${PLATFORM_FOLDER_ARCH}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/external/websockets/prebuilt/${PLATFORM_FOLDER_ARCH}
|
2014-09-10 10:58:20 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/external/chipmunk/prebuilt/${PLATFORM_FOLDER_ARCH}
|
2014-08-24 18:52:51 +08:00
|
|
|
)
|
2013-11-02 18:07:34 +08:00
|
|
|
|
2014-08-24 18:52:51 +08:00
|
|
|
# libcocos2d.a
|
2014-05-02 04:01:51 +08:00
|
|
|
add_subdirectory(cocos)
|
2013-11-02 18:07:34 +08:00
|
|
|
|
2014-03-10 17:10:08 +08:00
|
|
|
## Scripting
|
2014-03-10 17:39:54 +08:00
|
|
|
add_subdirectory(cocos/scripting/lua-bindings)
|
2014-06-04 11:50:04 +08:00
|
|
|
|
2014-08-06 22:43:19 +08:00
|
|
|
# build tests
|
2014-06-30 15:46:42 +08:00
|
|
|
add_subdirectory(tests/cpp-empty-test)
|
2014-03-11 17:52:28 +08:00
|
|
|
add_subdirectory(tests/cpp-tests)
|
|
|
|
|
|
|
|
add_subdirectory(tests/lua-tests/project)
|
2014-04-25 15:10:37 +08:00
|
|
|
add_subdirectory(tests/lua-empty-test/project)
|