axmol/CMakeLists.txt

320 lines
11 KiB
CMake
Raw Normal View History

#/****************************************************************************
# Copyright (c) 2013 cocos2d-x.org
2014-08-06 22:43:19 +08:00
# Copyright (c) 2014 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)
2014-09-11 07:26:32 +08:00
project (Cocos2d-X)
2013-11-02 14:40:07 +08:00
# The version number
2014-11-15 05:07:34 +08:00
set(COCOS2D_X_VERSION 3.3.0-rc1)
2013-11-02 14:40:07 +08:00
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
include(CocosBuildHelpers)
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
set(USE_WEBP_DEFAULT ON)
if(WINRT OR WP8)
set(USE_WEBP_DEFAULT OFF)
endif()
2014-10-15 21:45:25 +08:00
option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
option(USE_BOX2D "Use box2d for physics library" OFF)
option(USE_WEBP "Use WebP codec" ${USE_WEBP_DEFAULT})
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(DEBUG_MODE "Debug or release?" ON)
option(BUILD_EXTENSIONS "Build extension library" ON)
option(BUILD_EDITOR_SPINE "Build editor support for spine" ON)
2014-10-15 21:45:25 +08:00
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON)
2014-10-15 21:48:47 +08:00
option(BUILD_CPP_TESTS "Build TestCpp samples" ON)
option(BUILD_LUA_LIBS "Build lua libraries" ON)
2014-10-15 21:45:25 +08:00
option(BUILD_LUA_TESTS "Build TestLua samples" ON)
option(USE_PREBUILT_LIBS "Use prebuilt libraries in external directory" 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-30 14:09:12 +08:00
set(CMAKE_C_FLAGS_DEBUG "-DCOCOS2D_DEBUG=1")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
2014-09-12 08:36:49 +08:00
# Compiler options
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")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -std=c++11 -Wno-deprecated-declarations -Wno-reorder")
2014-09-12 08:36:49 +08:00
if(CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
2014-08-06 22:43:19 +08:00
endif(MSVC)
2013-11-30 14:09:12 +08:00
set(COCOS_EXTERNAL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external)
2014-09-12 08:36:49 +08:00
# Some macro definitions
2014-08-06 22:43:19 +08:00
if(WINDOWS)
if(BUILD_SHARED_LIBS)
ADD_DEFINITIONS (-D_USRDLL -D_EXPORT_DLL_ -D_USEGUIDLL -D_USREXDLL -D_USRSTUDIODLL)
else()
ADD_DEFINITIONS (-DCC_STATIC)
endif()
ADD_DEFINITIONS (-DCOCOS2DXWIN32_EXPORTS -D_WINDOWS -DWIN32)
2014-08-06 22:43:19 +08:00
set(PLATFORM_FOLDER win32)
elseif(MACOSX OR APPLE)
Squashed commit of the following: commit b9181ae92541d11119bedd766773ddb01f0bb486 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 09:34:40 2014 -0700 Compiles luasocket on Mac commit 91fc79aa2101867fedfbcd7d846e9508009894e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 09:12:30 2014 -0700 disables luasockets commit 31f2ee462708ab7b604b9399eaabd275e2da9e02 Merge: 19099fd 0abe4cb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 08:10:48 2014 -0700 Merge remote-tracking branch 'cocos2d/v3' into cmakefile_mac_osx Conflicts: cocos/3d/cocos3d.h commit 19099fd021b4ecf1f2eebd73ea14e84572d1ee33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 23:21:03 2014 -0700 compiles on Linux commit eec7b92817ac9208123468bb882612aad89f94bf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 23:16:46 2014 -0700 all projecs compiles with CMake commit 40fcc8325b409a580fdbf26d2ee27aa2d1db0109 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 21:47:27 2014 -0700 CCUserDefualt.mm better includes commit 30709ec8243562858498cb118240bb45bf9b33b0 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 21:26:36 2014 -0700 cpp-tests compiles and works on Mac using CMake commit 67f0fc8df887d08d3d7a27c5fdadd335d6841676 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 20:12:09 2014 -0700 Adds missing files to CMakeLists.txt commit 36f939ea7f157ca851aee138300c13d9888c0078 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 19:52:34 2014 -0700 Adds more box2d missing files commit 00f81e3b5ec97150974cc6022e86c394ff488ccb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 19:39:54 2014 -0700 Adds missing box2d files commit 9673227b4d7d0e6d9eced49bdd69b98cb519968a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 18:44:15 2014 -0700 Initial CMake support for Mac
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)
Squashed commit of the following: commit b9181ae92541d11119bedd766773ddb01f0bb486 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 09:34:40 2014 -0700 Compiles luasocket on Mac commit 91fc79aa2101867fedfbcd7d846e9508009894e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 09:12:30 2014 -0700 disables luasockets commit 31f2ee462708ab7b604b9399eaabd275e2da9e02 Merge: 19099fd 0abe4cb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 08:10:48 2014 -0700 Merge remote-tracking branch 'cocos2d/v3' into cmakefile_mac_osx Conflicts: cocos/3d/cocos3d.h commit 19099fd021b4ecf1f2eebd73ea14e84572d1ee33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 23:21:03 2014 -0700 compiles on Linux commit eec7b92817ac9208123468bb882612aad89f94bf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 23:16:46 2014 -0700 all projecs compiles with CMake commit 40fcc8325b409a580fdbf26d2ee27aa2d1db0109 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 21:47:27 2014 -0700 CCUserDefualt.mm better includes commit 30709ec8243562858498cb118240bb45bf9b33b0 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 21:26:36 2014 -0700 cpp-tests compiles and works on Mac using CMake commit 67f0fc8df887d08d3d7a27c5fdadd335d6841676 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 20:12:09 2014 -0700 Adds missing files to CMakeLists.txt commit 36f939ea7f157ca851aee138300c13d9888c0078 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 19:52:34 2014 -0700 Adds more box2d missing files commit 00f81e3b5ec97150974cc6022e86c394ff488ccb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 19:39:54 2014 -0700 Adds missing box2d files commit 9673227b4d7d0e6d9eced49bdd69b98cb519968a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 18:44:15 2014 -0700 Initial CMake support for 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)
elseif(ANDROID)
ADD_DEFINITIONS (-DUSE_FILE32API)
set(PLATFORM_FOLDER android)
Squashed commit of the following: commit b9181ae92541d11119bedd766773ddb01f0bb486 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 09:34:40 2014 -0700 Compiles luasocket on Mac commit 91fc79aa2101867fedfbcd7d846e9508009894e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 09:12:30 2014 -0700 disables luasockets commit 31f2ee462708ab7b604b9399eaabd275e2da9e02 Merge: 19099fd 0abe4cb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 08:10:48 2014 -0700 Merge remote-tracking branch 'cocos2d/v3' into cmakefile_mac_osx Conflicts: cocos/3d/cocos3d.h commit 19099fd021b4ecf1f2eebd73ea14e84572d1ee33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 23:21:03 2014 -0700 compiles on Linux commit eec7b92817ac9208123468bb882612aad89f94bf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 23:16:46 2014 -0700 all projecs compiles with CMake commit 40fcc8325b409a580fdbf26d2ee27aa2d1db0109 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 21:47:27 2014 -0700 CCUserDefualt.mm better includes commit 30709ec8243562858498cb118240bb45bf9b33b0 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 21:26:36 2014 -0700 cpp-tests compiles and works on Mac using CMake commit 67f0fc8df887d08d3d7a27c5fdadd335d6841676 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 20:12:09 2014 -0700 Adds missing files to CMakeLists.txt commit 36f939ea7f157ca851aee138300c13d9888c0078 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 19:52:34 2014 -0700 Adds more box2d missing files commit 00f81e3b5ec97150974cc6022e86c394ff488ccb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 19:39:54 2014 -0700 Adds missing box2d files commit 9673227b4d7d0e6d9eced49bdd69b98cb519968a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 18:44:15 2014 -0700 Initial CMake support for Mac
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)
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 )
Squashed commit of the following: commit b9181ae92541d11119bedd766773ddb01f0bb486 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 09:34:40 2014 -0700 Compiles luasocket on Mac commit 91fc79aa2101867fedfbcd7d846e9508009894e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 09:12:30 2014 -0700 disables luasockets commit 31f2ee462708ab7b604b9399eaabd275e2da9e02 Merge: 19099fd 0abe4cb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 08:10:48 2014 -0700 Merge remote-tracking branch 'cocos2d/v3' into cmakefile_mac_osx Conflicts: cocos/3d/cocos3d.h commit 19099fd021b4ecf1f2eebd73ea14e84572d1ee33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 23:21:03 2014 -0700 compiles on Linux commit eec7b92817ac9208123468bb882612aad89f94bf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 23:16:46 2014 -0700 all projecs compiles with CMake commit 40fcc8325b409a580fdbf26d2ee27aa2d1db0109 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 21:47:27 2014 -0700 CCUserDefualt.mm better includes commit 30709ec8243562858498cb118240bb45bf9b33b0 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 21:26:36 2014 -0700 cpp-tests compiles and works on Mac using CMake commit 67f0fc8df887d08d3d7a27c5fdadd335d6841676 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 20:12:09 2014 -0700 Adds missing files to CMakeLists.txt commit 36f939ea7f157ca851aee138300c13d9888c0078 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 19:52:34 2014 -0700 Adds more box2d missing files commit 00f81e3b5ec97150974cc6022e86c394ff488ccb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 19:39:54 2014 -0700 Adds missing box2d files commit 9673227b4d7d0e6d9eced49bdd69b98cb519968a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 18:44:15 2014 -0700 Initial CMake support for Mac
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()
2013-11-02 14:40:07 +08:00
include_directories(
2013-11-30 14:09:12 +08:00
${CMAKE_CURRENT_SOURCE_DIR}/cocos
${CMAKE_CURRENT_SOURCE_DIR}
2014-10-09 12:01:22 +08:00
${CMAKE_CURRENT_SOURCE_DIR}/deprecated
${CMAKE_CURRENT_SOURCE_DIR}/cocos/platform
2013-11-30 14:09:12 +08:00
${CMAKE_CURRENT_SOURCE_DIR}/extensions
${CMAKE_CURRENT_SOURCE_DIR}/external
2013-11-02 14:40:07 +08:00
)
if(LINUX)
find_package(FMODEX REQUIRED)
message(STATUS "FMOD Ex include dirs: ${FMODEX_INCLUDE_DIRS}")
endif()
# GLFW3 used on Mac, Windows and Linux desktop platforms
if(LINUX OR MACOSX OR WINDOWS)
find_package(OpenGL REQUIRED)
set(OPENGL_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) # fix inconsistency
message(STATUS "OpenGL include dirs: ${OPENGL_INCLUDE_DIRS}")
if(LINUX OR WINDOWS)
find_package(GLEW REQUIRED)
message(STATUS "GLEW libs: ${GLEW_LIBRARIES}")
endif()
find_package(GLFW3 REQUIRED)
message(STATUS "GLFW3 include dirs: ${GLFW3_INCLUDE_DIRS}")
include_directories(${GLFW3_INCLUDE_DIRS})
if(WINDOWS)
if(USE_PREBUILT_LIBS)
set(VORBIS_PREBUILT_ROOT ${COCOS_EXTERNAL_DIR}/${PLATFORM_FOLDER}-specific/OggDecoder)
list(APPEND CMAKE_INCLUDE_PATH ${VORBIS_PREBUILT_ROOT}/include)
list(APPEND CMAKE_LIBRARY_PATH ${VORBIS_PREBUILT_ROOT}/prebuilt)
endif()
find_package(Vorbis REQUIRED)
message(STATUS "Vorbis include dirs: ${VORBIS_INCLUDE_DIRS}")
if(USE_PREBUILT_LIBS)
list(APPEND CMAKE_INCLUDE_PATH ${COCOS_EXTERNAL_DIR}/${PLATFORM_FOLDER}-specific/MP3Decoder/include)
list(APPEND CMAKE_LIBRARY_PATH ${COCOS_EXTERNAL_DIR}/${PLATFORM_FOLDER}-specific/MP3Decoder/prebuilt)
endif()
find_package(MPG123 REQUIRED)
message(STATUS "MPG123 include dirs: ${MPG123_INCLUDE_DIRS}")
if(USE_PREBUILT_LIBS)
set(OPENAL_PREBUILT_ROOT ${COCOS_EXTERNAL_DIR}/${PLATFORM_FOLDER}-specific/OpenalSoft)
list(APPEND CMAKE_INCLUDE_PATH ${OPENAL_PREBUILT_ROOT})
list(APPEND CMAKE_LIBRARY_PATH ${OPENAL_PREBUILT_ROOT}/prebuilt)
endif()
find_package(OpenAL REQUIRED)
set(OPENAL_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR})
set(OPENAL_LIBRARIES ${OPENAL_LIBRARY})
# because FindOpenAL.cmake set include dir for '#include <al.h>' for portability (not for '#include <AL/al.h>'
set(OPENAL_DEFINITIONS "-DOPENAL_PLAIN_INCLUDES")
message(STATUS "OpenAL include dirs: ${OPENAL_INCLUDE_DIRS}")
endif()
endif(LINUX OR MACOSX OR WINDOWS)
# Freetype required on all platforms
find_package(Freetype REQUIRED)
message(STATUS "FreeType include dirs: ${FREETYPE_INCLUDE_DIRS}")
# WebP required if used
if(USE_WEBP)
find_package(WebP REQUIRED)
message(STATUS "WebP include dirs: ${WEBP_INCLUDE_DIRS}")
endif(USE_WEBP)
# Chipmunk
if(USE_CHIPMUNK)
find_package(Chipmunk REQUIRED)
message(STATUS "Chipmunk include dirs: ${CHIPMUNK_INCLUDE_DIRS}")
add_definitions(-DCC_ENABLE_CHIPMUNK_INTEGRATION=1)
if(IOS OR MACOSX)
# without this chipmunk will try to use apple defined geometry types, that conflicts with cocos
add_definitions(-DCP_USE_CGPOINTS=0)
endif()
else(USE_CHIPMUNK)
add_definitions(-DCC_USE_PHYSICS=0)
endif(USE_CHIPMUNK)
2014-11-15 08:11:46 +08:00
# Box2d (not prebuilded, exists as source)
if(USE_BOX2D)
if(USE_PREBUILT_LIBS)
add_subdirectory(external/Box2D)
set(Box2D_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external/box2d/include)
set(Box2D_LIBRARIES box2d)
else()
find_package(Box2D REQUIRED CONFIG)
# actually Box2D in next line is not a library, it is target exported from Box2DConfig.cmake
set(Box2D_LIBRARIES Box2D)
endif()
message(STATUS "Box2D include dirs: ${Box2D_INCLUDE_DIRS}")
add_definitions(-DCC_ENABLE_BOX2D_INTEGRATION=1)
else()
add_definitions(-DCC_ENABLE_BOX2D_INTEGRATION=0)
endif(USE_BOX2D)
# Tinyxml2 (not prebuilded, exists as source)
if(USE_PREBUILT_LIBS)
add_subdirectory(external/tinyxml2)
set(TinyXML2_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external/tinyxml2)
set(TinyXML2_LIBRARIES tinyxml2)
else()
find_package(TinyXML2)
endif()
message(STATUS "TinyXML2 include dirs: ${TinyXML2_INCLUDE_DIRS}")
2014-11-16 02:16:39 +08:00
# libjpeg
find_package(JPEG REQUIRED)
message(STATUS "JPEG include dirs: ${JPEG_INCLUDE_DIRS}")
2014-11-16 05:21:11 +08:00
find_package(ZLIB REQUIRED)
message(STATUS "ZLIB include dirs: ${ZLIB_INCLUDE_DIRS}")
# minizip (we try to migrate to minizip from https://github.com/nmoinvaz/minizip)
# only msys2 currently provides package for this variant, all other
# dists have packages from zlib, thats very old for us.
# moreover our embedded version modified to quick provide
# functionality needed by cocos.
if(USE_PREBUILT_LIBS OR NOT MINGW)
add_subdirectory(external/unzip)
set(MINIZIP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external/unzip)
set(MINIZIP_LIBRARIES unzip)
else()
find_package(MINIZIP REQUIRED)
# double check that we have needed functions
include(CheckLibraryExists)
check_library_exists(${MINIZIP_LIBRARIES} "unzGoToFirstFile2" "" MINIZIP_HAS_GOTOFIRSTFILE2)
if(NOT MINIZIP_HAS_GOTOFIRSTFILE2)
message(FATAL_ERROR "Minizip library on you system very old. Please use recent version from https://github.com/nmoinvaz/minizip or enable USE_PREBUILT_LIBS")
endif()
add_definitions(-DMINIZIP_FROM_SYSTEM)
endif()
message(STATUS "MINIZIP include dirs: ${MINIZIP_INCLUDE_DIRS}")
2014-11-16 05:21:11 +08:00
find_package(PNG REQUIRED)
message(STATUS "PNG include dirs: ${PNG_INCLUDE_DIRS}")
2014-11-16 17:47:59 +08:00
find_package(TIFF REQUIRED)
message(STATUS "TIFF include dirs: ${TIFF_INCLUDE_DIRS}")
2014-11-16 18:22:54 +08:00
find_package(WEBSOCKETS REQUIRED)
message(STATUS "WEBSOCKETS include dirs: ${WEBSOCKETS_INCLUDE_DIRS}")
find_package(CURL REQUIRED)
message(STATUS "CURL include dirs: ${CURL_INCLUDE_DIRS}")
# protobuf-lite (not prebuilded, exists as source)
# TODO: for now we can't use upstream protobuf because these files:
# cocos/editor-support/cocostudio/CSParseBinary.pb.h
# cocos/editor-support/cocostudio/CSParseBinary.pb.cc
# was generated by concrete version of protobuf compiler
# and source file not provided. So these files can be
# compiled only with our in-source version of protobuf-lite
## if(USE_PREBUILT_LIBS)
add_subdirectory(external/protobuf-lite)
set(PROTOBUF_LITE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf-lite/src)
set(PROTOBUF_LITE_LIBRARIES protobuf)
## else()
## find_package(Protobuf REQUIRED PROTOBUF_LITE_LIBRARIES)
## set(PROTOBUF_LITE_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS})
## endif()
message(STATUS "Protobuf lite libs: ${PROTOBUF_LITE_LIBRARIES}")
message(STATUS "Protobuf include dirs: ${PROTOBUF_LITE_INCLUDE_DIRS}")
2014-10-09 12:01:22 +08:00
# build for 3rd party libraries
2014-10-15 21:25:51 +08:00
if(LINUX OR APPLE)
2014-10-09 12:01:22 +08:00
add_subdirectory(external/xxhash)
endif()
# libcocos2d.a
add_subdirectory(cocos)
2013-11-02 18:07:34 +08:00
# build cpp tests
if(BUILD_CPP_TESTS)
add_subdirectory(tests/cpp-empty-test)
add_subdirectory(tests/cpp-tests)
endif(BUILD_CPP_TESTS)
## Scripting
if(BUILD_LUA_LIBS)
add_subdirectory(cocos/scripting/lua-bindings)
# build lua tests
if(BUILD_LUA_TESTS)
add_subdirectory(tests/lua-tests/project)
add_subdirectory(tests/lua-empty-test/project)
endif(BUILD_LUA_TESTS)
2014-03-11 17:52:28 +08:00
2014-09-27 16:26:35 +08:00
endif(BUILD_LUA_LIBS)