This commit is contained in:
honghui 2014-11-24 10:43:34 +08:00
commit 3477e0fa19
74 changed files with 1894 additions and 465 deletions

View File

@ -1053,6 +1053,9 @@ Developers:
vovkasm
Fix warnings for Xcode6.1
nilium
Unignore libs dir in plugin and fix Travis script to descend into included directories
Retired Core Developers:
WenSheng Yang

View File

@ -34,9 +34,20 @@ include(CocosBuildHelpers)
message(${BUILDING_STRING})
set(USE_WEBP_DEFAULT ON)
if(WINRT OR WP8)
set(USE_WEBP_DEFAULT OFF)
endif()
set(USE_PREBUILT_LIBS_DEFAULT ON)
if(MINGW)
set(USE_PREBUILT_LIBS_DEFAULT OFF)
endif()
option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
option(USE_BOX2D "Use box2d for physics library" OFF)
option(BUILD_STATIC "Build static libraries" ON)
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)
@ -45,6 +56,11 @@ option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON)
option(BUILD_CPP_TESTS "Build TestCpp samples" ON)
option(BUILD_LUA_LIBS "Build lua libraries" ON)
option(BUILD_LUA_TESTS "Build TestLua samples" ON)
option(USE_PREBUILT_LIBS "Use prebuilt libraries in external directory" ${USE_PREBUILT_LIBS_DEFAULT})
if(USE_PREBUILT_LIBS AND MINGW)
message(FATAL_ERROR "Prebuilt windows libs can't be used with mingw, please use packages.")
endif()
if(DEBUG_MODE)
set(CMAKE_BUILD_TYPE DEBUG)
@ -70,22 +86,18 @@ else()
endif()
endif(MSVC)
if(BUILD_STATIC)
set (BUILD_TYPE STATIC)
else()
set (BUILD_TYPE SHARED)
endif()
set(COCOS_EXTERNAL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external)
# Some macro definitions
if(WINDOWS)
if(BUILD_STATIC)
ADD_DEFINITIONS (-DCC_STATIC)
else()
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)
ADD_DEFINITIONS (-DCOCOS2DXWIN32_EXPORTS -D_WINDOWS -DWIN32 -D_WIN32)
set(PLATFORM_FOLDER win32)
elseif(MACOSX OR APPLE)
ADD_DEFINITIONS (-DCC_TARGET_OS_MAC)
@ -102,10 +114,8 @@ else()
endif()
if(MINGW)
add_definitions(-DGLEW_STATIC)
#add_definitions(-DGLEW_STATIC)
add_definitions(-D__SSIZE_T)
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lws2_32")
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lws2_32")
if(CLANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions ")
@ -131,91 +141,138 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/external
)
# 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}
)
elseif(NOT MINGW)
set(PLATFORM_FOLDER_ARCH ${PLATFORM_FOLDER})
if(USE_PREBUILT_LIBS)
include(CocosUsePrebuiltLibs)
endif()
# NB
# we need to return these to libraries to their official state rather than
# having our custom cocos2d namespace so that we may use system versions if
# the platform provides them. It is very important that this
# is done before we make prebuilt versions of these two libs
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../external/unzip
${CMAKE_CURRENT_SOURCE_DIR}/../external/xxhash
)
# GLFW3 used on Mac, Windows and Linux desktop platforms
if(LINUX OR MACOSX OR WINDOWS)
list(APPEND CMAKE_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/glfw3/include/${PLATFORM_FOLDER})
list(APPEND CMAKE_LIBRARY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/glfw3/prebuilt/${PLATFORM_FOLDER_ARCH})
cocos_find_package(OpenGL OPENGL REQUIRED)
find_package(GLFW3 REQUIRED)
message( STATUS "GLFW3 dirs: ${GLFW3_INCLUDE_DIRS}")
if(LINUX OR WINDOWS)
cocos_find_package(GLEW GLEW REQUIRED)
endif()
cocos_find_package(GLFW3 GLFW3 REQUIRED)
include_directories(${GLFW3_INCLUDE_DIRS})
if(LINUX)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)
set(THREADS_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
cocos_find_package(FMODEX FMODEX REQUIRED)
cocos_find_package(Fontconfig FONTCONFIG REQUIRED)
endif()
if(WINDOWS)
cocos_find_package(Vorbis VORBIS REQUIRED)
cocos_find_package(MPG123 MPG123 REQUIRED)
cocos_find_package(OpenAL OPENAL REQUIRED)
# because FindOpenAL.cmake set include dir for '#include <al.h>' for portability (not for '#include <AL/al.h>'
set(OPENAL_DEFINITIONS "-DOPENAL_PLAIN_INCLUDES")
endif()
endif(LINUX OR MACOSX OR WINDOWS)
# Freetype required on all platforms
cocos_find_package(Freetype FREETYPE REQUIRED)
if(NOT MINGW)
# WebP required if used
if(USE_WEBP)
cocos_find_package(WebP WEBP REQUIRED)
endif(USE_WEBP)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/external/tinyxml2
${CMAKE_CURRENT_SOURCE_DIR}/external/chipmunk/include/chipmunk
${CMAKE_CURRENT_SOURCE_DIR}/external/box2d/include
${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/freetype2/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/websockets/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/curl/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf-lite/src
${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/include/${PLATFORM_FOLDER}/freetype2
)
#todo: fix location of freetype includes for linux android on cocos prebuilt repo
#i.e we should not need to include an extra dir of /freetype2
link_directories(
${PLATFORM_LINK_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/external/tinyxml2/prebuilt/${PLATFORM_FOLDER_ARCH}
${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}
${CMAKE_CURRENT_SOURCE_DIR}/external/chipmunk/prebuilt/${PLATFORM_FOLDER_ARCH}
${CMAKE_CURRENT_SOURCE_DIR}/external/box2d/prebuilt/${PLATFORM_FOLDER_ARCH}
${CMAKE_CURRENT_SOURCE_DIR}/external/curl/prebuilt/${PLATFORM_FOLDER_ARCH}
)
# Chipmunk
if(USE_CHIPMUNK)
cocos_find_package(Chipmunk CHIPMUNK REQUIRED)
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)
# 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()
cocos_find_package(TinyXML2 TinyXML2 REQUIRED)
endif()
message(STATUS "TinyXML2 include dirs: ${TinyXML2_INCLUDE_DIRS}")
# libjpeg
cocos_find_package(JPEG JPEG REQUIRED)
cocos_find_package(ZLIB ZLIB REQUIRED)
# 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)
message(STATUS "MINIZIP include dirs: ${MINIZIP_INCLUDE_DIRS}")
else()
cocos_find_package(MINIZIP 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()
cocos_find_package(PNG PNG REQUIRED)
cocos_find_package(TIFF TIFF REQUIRED)
cocos_find_package(WEBSOCKETS WEBSOCKETS REQUIRED)
cocos_find_package(CURL CURL REQUIRED)
# 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()
## cocos_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}")
# build for 3rd party libraries
if(LINUX OR APPLE)
add_subdirectory(external/Box2D)
add_subdirectory(external/unzip)
add_subdirectory(external/xxhash)
add_subdirectory(external/tinyxml2)
add_subdirectory(external/protobuf-lite)
endif()
# libcocos2d.a

View File

@ -205,7 +205,7 @@ Contact us
[5]: http://www.box2d.org "Box2D"
[6]: http://www.chipmunk-physics.net "Chipmunk2D"
[7]: http://esotericsoftware.com/ "http://esotericsoftware.com/"
[8]: http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Contribution
[8]: https://github.com/cocos2d/cocos2d-x/blob/v3/docs/CONTRIBUTE.md
[9]: http://forum.cocos2d-x.org "http://forum.cocos2d-x.org"
[10]: http://www.twitter.com/cocos2dx "http://www.twitter.com/cocos2dx"
[11]: http://t.sina.com.cn/cocos2dx "http://t.sina.com.cn/cocos2dx"

View File

@ -21,6 +21,7 @@ DEPENDS+=' libfontconfig1-dev'
DEPENDS+=' libsqlite3-dev'
DEPENDS+=' libglew*-dev'
DEPENDS+=' libssl-dev'
DEPENDS+=' gnutls-dev'
MISSING=
echo "Checking for missing packages ..."

View File

@ -36,6 +36,91 @@ function(cocos_mark_resources)
endforeach()
endfunction()
# cocos_find_package(pkg args...)
# works same as find_package, but do additional care to properly find
# prebuilt libs for cocos
macro(cocos_find_package pkg_name pkg_prefix)
if(NOT USE_PREBUILT_LIBS OR NOT ${pkg_prefix}_FOUND)
find_package(${pkg_name} ${ARGN})
endif()
if(NOT ${pkg_prefix}_INCLUDE_DIRS AND ${pkg_prefix}_INCLUDE_DIR)
set(${pkg_prefix}_INCLUDE_DIRS ${${pkg_prefix}_INCLUDE_DIR})
endif()
if(NOT ${pkg_prefix}_LIBRARIES AND ${pkg_prefix}_LIBRARY)
set(${pkg_prefix}_LIBRARIES ${${pkg_prefix}_LIBRARY})
endif()
message(STATUS "${pkg_name} include dirs: ${${pkg_prefix}_INCLUDE_DIRS}")
endmacro()
# cocos_use_pkg(pkg) function.
# This function applies standard package variables (after find_package(pkg) call) to current scope
# Recognized variables: <pkg>_INCLUDE_DIRS, <pkg>_LIBRARIES, <pkg>_LIBRARY_DIRS
# Also if BUILD_SHARED_LIBS variable off, it is try to use <pkg>_STATIC_* vars before
function(cocos_use_pkg target pkg)
set(prefix ${pkg})
if(NOT BUILD_SHARED_LIBS)
set(prefix_static ${pkg}_STATIC)
else()
set(prefix_static)
endif()
set(_include_dirs)
if(prefix_static AND ${prefix_static}_INCLUDE_DIRS)
set(_include_dirs ${${prefix_static}_INCLUDE_DIRS})
endif()
if(NOT _include_dirs)
set(_include_dirs ${${prefix}_INCLUDE_DIRS})
endif()
if(NOT _include_dirs)
# backward compat with old package-find scripts
set(_include_dirs ${${prefix}_INCLUDE_DIR})
endif()
if(_include_dirs)
include_directories(${_include_dirs})
message(STATUS "${pkg} add to include_dirs: ${_include_dirs}")
endif()
set(_library_dirs)
if(prefix_static AND ${prefix_static}_LIBRARY_DIRS)
set(_library_dirs ${${prefix_static}_LIBRARY_DIRS})
endif()
if(NOT _library_dirs)
set(_library_dirs ${${prefix}_LIBRARY_DIRS})
endif()
if(_library_dirs)
link_directories(${_library_dirs})
message(STATUS "${pkg} add to link_dirs: ${_library_dirs}")
endif()
set(_libs)
if(prefix_static AND ${prefix_static}_LIBRARIES)
set(_libs ${${prefix_static}_LIBRARIES})
endif()
if(NOT _libs)
set(_libs ${${prefix}_LIBRARIES})
endif()
if(NOT _libs)
set(_libs ${${prefix}_LIBRARY})
endif()
if(_libs)
target_link_libraries(${target} ${_libs})
message(STATUS "${pkg} libs added to '${target}': ${_libs}")
endif()
set(_defs)
if(prefix_static AND ${prefix_static}_CFLAGS_OTHER)
set(_defs ${${prefix_static}_CFLAGS_OTHER})
endif()
if(NOT _defs)
set(_defs ${${prefix}_DEFINITIONS})
endif()
if(_defs)
add_definitions(${_defs})
message(STATUS "${pkg} add definitions: ${_defs}")
endif()
endfunction()
#cmake has some strange defaults, this should help us a lot
#Please use them everywhere

View File

@ -0,0 +1,169 @@
# CocosUsePrebuiltLibs - sets external libs variables to link with
# START CONFIG
set(_chipmunk_inc chipmunk.h)
set(_chipmunk_inc_paths chipmunk)
set(_chipmunk_libs chipmunk libchipmunk)
set(_curl_inc curl/curl.h)
set(_curl_libs crypto ssl libeay32 ssleay32 curl libcurl_imp libcurl)
set(_freetype2_prefix FREETYPE)
set(_freetype2_inc ft2build.h freetype/freetype.h)
set(_freetype2_inc_paths freetype2)
set(_freetype2_libs freetype freetype250)
set(_jpeg_inc jpeglib.h)
set(_jpeg_libs jpeg libjpeg)
set(_png_inc png.h)
set(_png_libs png libpng)
set(_tiff_inc tiff.h)
set(_tiff_libs tiff libtiff)
set(_webp_inc decode.h)
set(_webp_libs webp libwebp)
set(_websockets_inc libwebsockets.h)
set(_websockets_libs websockets libwebsockets)
set(_glfw3_inc glfw3.h)
set(_glfw3_libs glfw3 libglfw3)
set(_sqlite3_inc sqlite3.h)
set(_sqlite3_libs sqlite3)
set(_gles_prefix GLEW)
set(_gles_inc glew.h)
set(_gles_inc_paths OGLES)
set(_gles_libs glew32)
set(_icon_prefix ICONV)
set(_icon_inc iconv.h)
set(_icon_libs libiconv)
set(_MP3Decoder_prefix MPG123)
set(_MP3Decoder_inc mpg123.h)
set(_MP3Decoder_libs libmpg123)
set(_OggDecoder_prefix VORBIS)
set(_OggDecoder_inc ogg/ogg.h)
set(_OggDecoder_libs libogg libvorbis libvorbisfile)
set(_OpenalSoft_prefix OPENAL)
set(_OpenalSoft_inc al.h)
set(_OpenalSoft_inc_paths AL)
set(_OpenalSoft_libs OpenAL32)
set(_zlib_inc zlib.h)
set(_zlib_libs libzlib)
set(_fmod_prefix FMODEX)
set(_fmod_inc fmod.h)
set(_fmod_libs fmodex fmodex64 fmodexL fmodexL64)
set(all_prebuilt_libs
chipmunk
curl
freetype2
jpeg
png
tiff
webp
websockets
)
if(MACOSX)
list(APPEND all_prebuilt_libs glfw3)
endif()
# We use MSVC instead of WINDOWS because it can be mingw that can't use our prebuilt libs
if(MSVC)
list(APPEND all_prebuilt_libs glfw3 sqlite3 gles icon MP3Decoder OggDecoder OpenalSoft zlib)
endif()
if(LINUX)
list(APPEND all_prebuilt_libs fmod)
endif()
# END CONFIG
foreach(_lib ${all_prebuilt_libs})
if(_${_lib}_prefix)
set(_prefix ${_${_lib}_prefix})
else()
# auto-prefix is uppercased name
string(TOUPPER ${_lib} _prefix)
endif()
set(roots
${COCOS_EXTERNAL_DIR}/${_lib}
${COCOS_EXTERNAL_DIR}/${PLATFORM_FOLDER}-specific/${_lib}
)
foreach(_root ${roots})
if(EXISTS ${_root})
set(include_dir_candidates
${_root}/include
${_root}/include/${ARCH_DIR}
${_root}/include/${PLATFORM_FOLDER}
${_root}/include/${PLATFORM_FOLDER}/${ARCH_DIR}
)
set(include_dirs)
foreach(_dir ${include_dir_candidates})
if(EXISTS ${_dir})
# find all include paths
if(_${_lib}_inc_paths)
set(_suffixes ${_${_lib}_inc_paths})
else()
set(_suffixes include)
endif()
foreach(_inc_name ${_${_lib}_inc})
unset(_inc_tmp CACHE)
find_path(_inc_tmp ${_inc_name} PATH_SUFFIXES ${_suffixes} PATHS ${_dir} NO_DEFAULT_PATH)
if(_inc_tmp)
list(APPEND include_dirs ${_inc_tmp})
endif()
endforeach()
endif(EXISTS ${_dir})
endforeach()
if(include_dirs)
set(${_prefix}_INCLUDE_DIRS ${include_dirs} CACHE PATH "Path to includes for ${_prefix}" FORCE)
endif()
#message(STATUS "${_lib} ${_prefix}_INCLUDE_DIRS: ${${_prefix}_INCLUDE_DIRS}")
set(lib_dir_candidates
${_root}/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${_root}/prebuilt/${PLATFORM_FOLDER}
${_root}/prebuilt/${PLATFORM_FOLDER}/release-lib
${_root}/prebuilt/${ARCH_DIR}
${_root}/libraries/${PLATFORM_FOLDER}
${_root}/prebuilt
)
set(libs)
foreach(_dir ${lib_dir_candidates})
if(EXISTS ${_dir})
# find all libs
foreach(_lib_name ${_${_lib}_libs})
unset(_lib_tmp CACHE)
find_library(_lib_tmp ${_lib_name} PATHS ${_dir} NO_DEFAULT_PATH)
if(_lib_tmp)
list(APPEND libs ${_lib_tmp})
endif()
endforeach()
endif(EXISTS ${_dir})
endforeach()
if(libs)
set(${_prefix}_LIBRARIES ${libs} CACHE STRING "Libraries to link for ${_prefix}" FORCE)
endif()
#message(STATUS "${_lib} ${_prefix}_LIBRARIES: ${${_prefix}_LIBRARIES}")
if(${_prefix}_LIBRARIES AND ${_prefix}_INCLUDE_DIRS)
set(${_prefix}_FOUND YES)
endif()
endif(EXISTS ${_root})
endforeach()
endforeach()

View File

@ -0,0 +1,86 @@
#.rst:
# FindCURL
# --------
#
# Find curl
#
# Find the native CURL headers and libraries.
#
# ::
#
# CURL_INCLUDE_DIRS - where to find curl/curl.h, etc.
# CURL_LIBRARIES - List of libraries when using curl.
# CURL_FOUND - True if curl found.
# CURL_VERSION_STRING - the version of curl found (since CMake 2.8.8)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
set(CURL_LIBRARY_NAMES
curl
# Windows MSVC prebuilts:
curllib
libcurl_imp
curllib_static
# Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip):
libcurl
)
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_search_module(CURL QUIET libcurl)
endif()
if(NOT CURL_FOUND)
# Look for the header file.
find_path(CURL_INCLUDE_DIR NAMES curl/curl.h)
mark_as_advanced(CURL_INCLUDE_DIR)
# Look for the library (sorted from most current/relevant entry to least).
find_library(CURL_LIBRARY NAMES
curl
# Windows MSVC prebuilts:
curllib
libcurl_imp
curllib_static
# Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip):
libcurl
)
mark_as_advanced(CURL_LIBRARY)
if(CURL_INCLUDE_DIR)
foreach(_curl_version_header curlver.h curl.h)
if(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}")
file(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"")
string(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}")
unset(curl_version_str)
break()
endif()
endforeach()
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL
REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR
VERSION_VAR CURL_VERSION_STRING)
if(CURL_FOUND)
set(CURL_LIBRARIES ${CURL_LIBRARY})
set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
endif()
endif()

View File

@ -0,0 +1,51 @@
#.rst:
# FindFMODEX
# ------------
#
# Locate FMOD Ex library
#
# This module defines
#
# ::
#
# FMODEX_LIBRARIES, the library to link against
# FMODEX_FOUND, if false, do not try to link to fmodex
# FMODEX_INCLUDE_DIRS, where to find headers.
#
find_path(FMODEX_INCLUDE_DIR fmod.h
HINTS ENV FMODEX_DIR
PATH_SUFFIXES include/fmodex include
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(FMODEX_LIBRARY NAMES fmodex fmodex64
HINTS ENV FMODEX_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
set(FMODEX_INCLUDE_DIRS "${FMODEX_INCLUDE_DIR}")
set(FMODEX_LIBRARIES "${FMODEX_LIBRARY}")
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(FMODEX DEFAULT_MSG FMODEX_LIBRARIES FMODEX_INCLUDE_DIRS)
mark_as_advanced(FMODEX_INCLUDE_DIR FMODEX_LIBRARY FMODEX_INCLUDE_DIRS FMODEX_LIBRARIES)

View File

@ -0,0 +1,17 @@
# FindFontconfig
# --------------
#
# Locate Fontconfig library
#
if(NOT FONTCONFIG_FOUND)
find_package(PkgConfig)
pkg_search_module(FONTCONFIG fontconfig)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Fontconfig
REQUIRED_VARS FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIRS
VERSION_VAR FONTCONFIG_VERSION
)

View File

@ -0,0 +1,168 @@
#.rst:
# FindFreetype
# ------------
#
# Locate FreeType library
#
# This module defines
#
# ::
#
# FREETYPE_LIBRARIES, the library to link against
# FREETYPE_FOUND, if false, do not try to link to FREETYPE
# FREETYPE_INCLUDE_DIRS, where to find headers.
# FREETYPE_VERSION_STRING, the version of freetype found (since CMake 2.8.8)
# This is the concatenation of the paths:
# FREETYPE_INCLUDE_DIR_ft2build
# FREETYPE_INCLUDE_DIR_freetype2
#
#
#
# $FREETYPE_DIR is an environment variable that would correspond to the
# ./configure --prefix=$FREETYPE_DIR used in building FREETYPE.
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# Created by Eric Wing.
# Modifications by Alexander Neundorf.
# This file has been renamed to "FindFreetype.cmake" instead of the correct
# "FindFreeType.cmake" in order to be compatible with the one from KDE4, Alex.
# Try find freetype for our arch in external folder
#todo: fix location of freetype includes for linux android on cocos prebuilt repo
#i.e we should not need to include an extra dir of /freetype2
# Try pkg-config first (because it provided deps info)
if(NOT FREETYPE_FOUND)
find_package(PkgConfig)
pkg_search_module(FREETYPE freetype2)
endif()
if(NOT FREETYPE_FOUND)
# Ugh, FreeType seems to use some #include trickery which
# makes this harder than it should be. It looks like they
# put ft2build.h in a common/easier-to-find location which
# then contains a #include to a more specific header in a
# more specific location (#include <freetype/config/ftheader.h>).
# Then from there, they need to set a bunch of #define's
# so you can do something like:
# #include FT_FREETYPE_H
# Unfortunately, using CMake's mechanisms like include_directories()
# wants explicit full paths and this trickery doesn't work too well.
# I'm going to attempt to cut out the middleman and hope
# everything still works.
find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
HINTS
ENV FREETYPE_DIR
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/usr/X11R6
/usr/local/X11R6
/usr/local/X11
/usr/freeware
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
PATH_SUFFIXES include/freetype2 include
)
find_path(FREETYPE_INCLUDE_DIR_freetype2
NAMES
freetype/config/ftheader.h
config/ftheader.h
HINTS
ENV FREETYPE_DIR
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/usr/X11R6
/usr/local/X11R6
/usr/local/X11
/usr/freeware
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
PATH_SUFFIXES include/freetype2 include
)
find_library(FREETYPE_LIBRARY
NAMES freetype libfreetype freetype219
HINTS
ENV FREETYPE_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/usr/X11R6
/usr/local/X11R6
/usr/local/X11
/usr/freeware
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
)
# set the user variables
if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
set(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
list(REMOVE_DUPLICATES FREETYPE_INCLUDE_DIRS)
endif()
set(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")
if(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
elseif(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
endif()
if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
file(STRINGS "${FREETYPE_H}" freetype_version_str
REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
unset(FREETYPE_VERSION_STRING)
foreach(VPART MAJOR MINOR PATCH)
foreach(VLINE ${freetype_version_str})
if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}")
string(REGEX REPLACE "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$" "\\1"
FREETYPE_VERSION_PART "${VLINE}")
if(FREETYPE_VERSION_STRING)
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
else()
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
endif()
unset(FREETYPE_VERSION_PART)
endif()
endforeach()
endforeach()
endif()
set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY})
# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype
REQUIRED_VARS FREETYPE_LIBRARIES FREETYPE_INCLUDE_DIRS
VERSION_VAR FREETYPE_VERSION_STRING)
endif(NOT FREETYPE_FOUND)
mark_as_advanced(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build)

View File

@ -27,6 +27,25 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# Try find glfw for our arch in external folder
if(USE_PREBUILT_LIBS)
find_path(GLFW3_INCLUDE_DIR glfw3.h
PATHS ${COCOS_EXTERNAL_DIR}/glfw3/include/${PLATFORM_FOLDER}
NO_DEFAULT_PATH
)
find_library(GLFW3_LIBRARY NAMES glfw3 libglfw3 lgfw
PATHS
${COCOS_EXTERNAL_DIR}/glfw3/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${COCOS_EXTERNAL_DIR}/glfw3/prebuilt/${PLATFORM_FOLDER}
NO_DEFAULT_PATH
)
# cleanup if not found (prevent from mix prebuilt include paths and system installed libraries)
if(NOT GLFW3_INCLUDE_DIR OR NOT GLFW3_LIBRARY)
unset(GLFW3_INCLUDE_DIR CACHE)
unset(GLFW3_LIBRARY CACHE)
endif()
endif(USE_PREBUILT_LIBS)
FIND_PATH(GLFW3_INCLUDE_DIR glfw3.h
HINTS
ENV GLFW3_DIR

View File

@ -0,0 +1,69 @@
#.rst:
# FindJPEG
# --------
#
# Find JPEG
#
# Find the native JPEG includes and library This module defines
#
# ::
#
# JPEG_INCLUDE_DIRS, where to find jpeglib.h, etc.
# JPEG_LIBRARIES, the libraries needed to use JPEG.
# JPEG_FOUND, If false, do not try to use JPEG.
#
# also defined, but not for general use are
#
# ::
#
# JPEG_LIBRARY, where to find the JPEG library.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
if(USE_PREBUILT_LIBS)
find_path(JPEG_INCLUDE_DIR jpeglib.h
PATH_SUFFIXES include/${PLATFORM_FOLDER} include
PATHS ${COCOS_EXTERNAL_DIR}/jpeg
NO_DEFAULT_PATH
)
find_library(JPEG_LIBRARY NAMES jpeg
PATH_SUFFIXES
prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
prebuilt/${PLATFORM_FOLDER}
PATHS ${COCOS_EXTERNAL_DIR}/jpeg
NO_DEFAULT_PATH
)
# cleanup if not found (prevent from mix prebuilt include paths and system installed libraries)
if(NOT JPEG_INCLUDE_DIR OR NOT JPEG_LIBRARY)
unset(JPEG_INCLUDE_DIR CACHE)
unset(JPEG_LIBRARY CACHE)
endif()
endif()
find_path(JPEG_INCLUDE_DIR jpeglib.h)
set(JPEG_NAMES ${JPEG_NAMES} jpeg)
find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES} )
# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARY JPEG_INCLUDE_DIR)
if(JPEG_FOUND)
set(JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR})
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
endif()
mark_as_advanced(JPEG_LIBRARY JPEG_INCLUDE_DIRS )

View File

@ -0,0 +1,60 @@
#.rst:
# FindMINIZIP
# ------------
#
# Locate minizip library (from zlib package)
#
# This module defines
#
# ::
#
# MINIZIP_LIBRARIES, the library to link against
# MINIZIP_FOUND, if false, do not try to link to fmodex
# MINIZIP_INCLUDE_DIRS, where to find headers.
#
# Try pkg-config first
if(NOT MINIZIP_LIBRARY AND NOT MINIZIP_INCLUDE_DIR)
find_package(PkgConfig)
pkg_search_module(MINIZIP minizip)
if(MINIZIP_FOUND)
return()
endif()
endif()
find_path(MINIZIP_INCLUDE_DIR minizip/unzip.h
HINTS ENV MINIZIP_DIR
PATH_SUFFIXES include
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(MINIZIP_LIBRARY NAMES minizip libminizip
HINTS ENV MINIZIP_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
set(MINIZIP_INCLUDE_DIRS "${MINIZIP_INCLUDE_DIR}")
set(MINIZIP_LIBRARIES "${MINIZIP_LIBRARY}")
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(MINIZIP DEFAULT_MSG MINIZIP_LIBRARIES MINIZIP_INCLUDE_DIRS)
mark_as_advanced(MINIZIP_INCLUDE_DIR MINIZIP_LIBRARY)

View File

@ -0,0 +1,17 @@
# - Find mpg123
# Find the native mpg123 includes and libraries
#
# MPG123_INCLUDE_DIRS - where to find mpg123.h, etc.
# MPG123_LIBRARIES - List of libraries when using mpg123.
# MPG123_FOUND - True if mpg123 found.
find_path(MPG123_INCLUDE_DIR mpg123.h)
find_library(MPG123_LIBRARY NAMES mpg123 libmpg123)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MPG123 DEFAULT_MSG MPG123_INCLUDE_DIR MPG123_LIBRARY)
set(MPG123_INCLUDE_DIRS ${MPG123_INCLUDE_DIR})
set(MPG123_LIBRARIES ${MPG123_LIBRARY})
mark_as_advanced(MPG123_INCLUDE_DIR MPG123_LIBRARY)

View File

@ -0,0 +1,20 @@
# - Find ogg
# Find the native ogg includes and libraries
#
# OGG_INCLUDE_DIRS - where to find ogg.h, etc.
# OGG_LIBRARIES - List of libraries when using ogg.
# OGG_FOUND - True if ogg found.
find_path(OGG_INCLUDE_DIR ogg/ogg.h)
# MSVC built ogg may be named ogg_static.
# The provided project files name the library with the lib prefix.
find_library(OGG_LIBRARY NAMES ogg ogg_static libogg libogg_static)
# Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND
# to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OGG DEFAULT_MSG OGG_INCLUDE_DIR OGG_LIBRARY)
set(OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR})
set(OGG_LIBRARIES ${OGG_LIBRARY})
mark_as_advanced(OGG_INCLUDE_DIR OGG_LIBRARY)

178
cmake/Modules/FindPNG.cmake Normal file
View File

@ -0,0 +1,178 @@
#.rst:
# FindPNG
# -------
#
# Find the native PNG includes and library
#
#
#
# This module searches libpng, the library for working with PNG images.
#
# It defines the following variables
#
# ::
#
# PNG_INCLUDE_DIRS, where to find png.h, etc.
# PNG_LIBRARIES, the libraries to link against to use PNG.
# PNG_DEFINITIONS - You should add_definitons(${PNG_DEFINITIONS}) before compiling code that includes png library files.
# PNG_FOUND, If false, do not try to use PNG.
# PNG_VERSION_STRING - the version of the PNG library found (since CMake 2.8.8)
#
# Also defined, but not for general use are
#
# ::
#
# PNG_LIBRARY, where to find the PNG library.
#
# For backward compatiblity the variable PNG_INCLUDE_DIR is also set.
# It has the same value as PNG_INCLUDE_DIRS.
#
# Since PNG depends on the ZLib compression library, none of the above
# will be defined unless ZLib can be found.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
if(PNG_FIND_QUIETLY)
set(_FIND_ZLIB_ARG QUIET)
endif()
find_package(ZLIB ${_FIND_ZLIB_ARG})
if(USE_PREBUILT_LIBS)
find_path(PNG_PNG_INCLUDE_DIR png.h
PATH_SUFFIXES include/${PLATFORM_FOLDER} include
PATHS ${COCOS_EXTERNAL_DIR}/png NO_DEFAULT_PATH
)
find_library(PNG_LIBRARY NAMES png libpng
PATH_SUFFIXES
prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
prebuilt/${PLATFORM_FOLDER}
PATHS ${COCOS_EXTERNAL_DIR}/png NO_DEFAULT_PATH
)
# cleanup if not found (prevent from mix prebuilt include paths and system installed libraries)
if(NOT PNG_PNG_INCLUDE_DIR OR NOT PNG_LIBRARY)
unset(PNG_PNG_INCLUDE_DIR CACHE)
unset(PNG_LIBRARY CACHE)
endif()
endif()
if(ZLIB_FOUND)
find_path(PNG_PNG_INCLUDE_DIR png.h
HINTS ENV PNG_DIR
PATH_SUFFIXES include/libpng include
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
list(APPEND PNG_NAMES png libpng)
unset(PNG_NAMES_DEBUG)
set(_PNG_VERSION_SUFFIXES 17 16 15 14 12)
if (PNG_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\..*)?$")
string(REGEX REPLACE
"^([0-9]+)\\.([0-9]+).*" "\\1\\2"
_PNG_VERSION_SUFFIX_MIN "${PNG_FIND_VERSION}")
if (PNG_FIND_VERSION_EXACT)
set(_PNG_VERSION_SUFFIXES ${_PNG_VERSION_SUFFIX_MIN})
else ()
string(REGEX REPLACE
"${_PNG_VERSION_SUFFIX_MIN}.*" "${_PNG_VERSION_SUFFIX_MIN}"
_PNG_VERSION_SUFFIXES "${_PNG_VERSION_SUFFIXES}")
endif ()
unset(_PNG_VERSION_SUFFIX_MIN)
endif ()
foreach(v IN LISTS _PNG_VERSION_SUFFIXES)
list(APPEND PNG_NAMES png${v} libpng${v})
list(APPEND PNG_NAMES_DEBUG png${v}d libpng${v}d)
endforeach()
unset(_PNG_VERSION_SUFFIXES)
# For compatiblity with versions prior to this multi-config search, honor
# any PNG_LIBRARY that is already specified and skip the search.
if(NOT PNG_LIBRARY)
find_library(PNG_LIBRARY_RELEASE
NAMES ${PNG_NAMES}
HINTS ENV PNG_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
)
find_library(PNG_LIBRARY_DEBUG
NAMES ${PNG_NAMES_DEBUG}
HINTS ENV PNG_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
)
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(PNG)
mark_as_advanced(PNG_LIBRARY_RELEASE PNG_LIBRARY_DEBUG)
endif()
unset(PNG_NAMES)
unset(PNG_NAMES_DEBUG)
# Set by select_library_configurations(), but we want the one from
# find_package_handle_standard_args() below.
unset(PNG_FOUND)
if (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
# png.h includes zlib.h. Sigh.
set(PNG_INCLUDE_DIRS ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIRS} ) # for backward compatiblity
set(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
if (CYGWIN)
if(BUILD_SHARED_LIBS)
# No need to define PNG_USE_DLL here, because it's default for Cygwin.
else()
set (PNG_DEFINITIONS -DPNG_STATIC)
endif()
endif ()
endif ()
if (PNG_PNG_INCLUDE_DIR AND EXISTS "${PNG_PNG_INCLUDE_DIR}/png.h")
file(STRINGS "${PNG_PNG_INCLUDE_DIR}/png.h" png_version_str REGEX "^#define[ \t]+PNG_LIBPNG_VER_STRING[ \t]+\".+\"")
string(REGEX REPLACE "^#define[ \t]+PNG_LIBPNG_VER_STRING[ \t]+\"([^\"]+)\".*" "\\1" PNG_VERSION_STRING "${png_version_str}")
unset(png_version_str)
endif ()
endif()
# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(PNG
REQUIRED_VARS PNG_LIBRARY PNG_PNG_INCLUDE_DIR
VERSION_VAR PNG_VERSION_STRING)
mark_as_advanced(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )

View File

@ -0,0 +1,106 @@
#.rst:
# FindTIFF
# --------
#
# Find TIFF library
#
# Find the native TIFF includes and library This module defines
#
# ::
#
# TIFF_INCLUDE_DIR, where to find tiff.h, etc.
# TIFF_LIBRARIES, libraries to link against to use TIFF.
# TIFF_FOUND, If false, do not try to use TIFF.
#
# also defined, but not for general use are
#
# ::
#
# TIFF_LIBRARY, where to find the TIFF library.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
set(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3)
if(USE_PREBUILT_LIBS)
find_path(TIFF_INCLUDE_DIR tiff.h
PATH_SUFFIXES include/${PLATFORM_FOLDER} include
PATHS ${COCOS_EXTERNAL_DIR}/tiff NO_DEFAULT_PATH
)
find_library(TIFF_LIBRARY NAMES ${TIFF_NAMES}
PATH_SUFFIXES
prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
prebuilt/${PLATFORM_FOLDER}
PATHS ${COCOS_EXTERNAL_DIR}/tiff NO_DEFAULT_PATH
)
# cleanup if not found (prevent from mix prebuilt include paths and system installed libraries)
if(NOT TIFF_INCLUDE_DIR OR NOT TIFF_LIBRARY)
unset(TIFF_INCLUDE_DIR CACHE)
unset(TIFF_LIBRARY CACHE)
endif()
endif()
find_path(TIFF_INCLUDE_DIR tiff.h
HINTS ENV TIFF_DIR
PATH_SUFFIXES include/libtiff include
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(TIFF_LIBRARY
NAMES ${TIFF_NAMES}
HINTS ENV TIFF_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
)
if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h")
file(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str
REGEX "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version .*")
string(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*"
"\\1" TIFF_VERSION_STRING "${tiff_version_str}")
unset(tiff_version_str)
endif()
set(TIFF_INCLUDE_DIRS ${TIFF_INCLUDE_DIR})
# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF
REQUIRED_VARS TIFF_LIBRARY TIFF_INCLUDE_DIRS
VERSION_VAR TIFF_VERSION_STRING
)
if(TIFF_FOUND)
set( TIFF_LIBRARIES ${TIFF_LIBRARY} )
endif()
mark_as_advanced(TIFF_INCLUDE_DIRS TIFF_LIBRARY)

View File

@ -0,0 +1,74 @@
#.rst:
# FindTinyXML2
# ------------
#
# Locate tinyxml2 library
#
# This module defines
#
# ::
#
# TINYXML2_LIBRARIES, the library to link against
# TINYXML2_FOUND, if false, do not try to link to tinyxml2
# TINYXML2_INCLUDE_DIRS, where to find headers.
#
# Try find tinyxml for our arch in external folder
if(USE_PREBUILT_LIBS)
find_path(TinyXML2_INCLUDE_DIR tinyxml2.h
PATH_SUFFIXES
include/tinyxml2
include
PATHS ${COCOS_EXTERNAL_DIR}/tinyxml2
NO_DEFAULT_PATH
)
find_library(TinyXML2_LIBRARY NAMES tinyxml2 libtinyxml2
PATH_SUFFIXES
prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
prebuilt/${PLATFORM_FOLDER}
PATHS ${COCOS_EXTERNAL_DIR}/tinyxml2
NO_DEFAULT_PATH
)
# cleanup if not found (prevent from mix prebuilt include paths and system installed libraries)
if(NOT TinyXML2_INCLUDE_DIR OR NOT TinyXML2_LIBRARY)
unset(TinyXML2_INCLUDE_DIR CACHE)
unset(TinyXML2_LIBRARY CACHE)
endif()
endif(USE_PREBUILT_LIBS)
find_path(TinyXML2_INCLUDE_DIR tinyxml2.h
HINTS ENV TinyXML2_DIR
PATH_SUFFIXES include/tinyxml2 include
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(TinyXML2_LIBRARY
NAMES tinyxml2 libtinyxml2
HINTS ENV TinyXML2_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
)
set(TinyXML2_INCLUDE_DIRS "${TinyXML2_INCLUDE_DIR}")
set(TinyXML2_LIBRARIES "${TinyXML2_LIBRARY}")
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(TinyXML2 DEFAULT_MSG TinyXML2_LIBRARIES TinyXML2_INCLUDE_DIRS)
mark_as_advanced(TinyXML2_INCLUDE_DIRS TinyXML2_LIBRARIES TinyXML2_LIBRARY)

View File

@ -0,0 +1,29 @@
# - Find vorbis
# Find the native vorbis includes and libraries
#
# VORBIS_INCLUDE_DIRS - where to find vorbis.h, etc.
# VORBIS_LIBRARIES - List of libraries when using vorbis(file).
# VORBIS_FOUND - True if vorbis found.
find_package(Ogg)
if(OGG_FOUND)
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
# MSVC built vorbis may be named vorbis_static
# The provided project files name the library with the lib prefix.
find_library(VORBIS_LIBRARY NAMES vorbis vorbis_static libvorbis libvorbis_static)
find_library(VORBISFILE_LIBRARY NAMES vorbisfile vorbisfile_static libvorbisfile libvorbisfile_static)
# Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND
# to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VORBIS DEFAULT_MSG VORBIS_INCLUDE_DIR VORBIS_LIBRARY VORBISFILE_LIBRARY)
endif(OGG_FOUND)
if(VORBIS_FOUND)
set(VORBIS_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR})
set(VORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
else(VORBIS_FOUND)
set(VORBIS_INCLUDE_DIRS)
set(VORBIS_LIBRARIES)
endif(VORBIS_FOUND)
mark_as_advanced(VORBIS_INCLUDE_DIR VORBIS_LIBRARY VORBISFILE_LIBRARY)

View File

@ -0,0 +1,68 @@
#.rst:
# FindWEBSOCKETS
# --------
#
# Find websockets library
#
# ::
#
# WEBSOCKETS_INCLUDE_DIRS, where to find libwebsockets.h.
# WEBSOCKETS_LIBRARIES, the libraries needed to use WEBSOCKETS.
# WEBSOCKETS_FOUND, If false, do not try to use WEBSOCKETS.
#
if(USE_PREBUILT_LIBS)
find_path(WEBSOCKETS_INCLUDE_DIR libwebsockets.h
PATH_SUFFIXES include/${PLATFORM_FOLDER} include
PATHS ${COCOS_EXTERNAL_DIR}/websockets
NO_DEFAULT_PATH
)
find_library(WEBSOCKETS_LIBRARY NAMES websockets libwebsockets
PATH_SUFFIXES
prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
prebuilt/${PLATFORM_FOLDER}
PATHS ${COCOS_EXTERNAL_DIR}/websockets
NO_DEFAULT_PATH
)
# cleanup if not found (prevent from mix prebuilt include paths and system installed libraries)
if(NOT WEBSOCKETS_INCLUDE_DIR OR NOT WEBSOCKETS_LIBRARY)
unset(WEBSOCKETS_INCLUDE_DIR CACHE)
unset(WEBSOCKETS_LIBRARY CACHE)
endif()
endif()
find_path(WEBSOCKETS_INCLUDE_DIR libwebsockets.h
HINTS ENV WEBSOCKETS_DIR
PATH_SUFFIXES include/websockets include/libwebsockets include
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(WEBSOCKETS_LIBRARY NAMES websockets libwebsockets
HINTS ENV WEBSOCKETS_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
)
set(WEBSOCKETS_INCLUDE_DIRS ${WEBSOCKETS_INCLUDE_DIR})
set(WEBSOCKETS_LIBRARIES ${WEBSOCKETS_LIBRARY})
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(WEBSOCKETS DEFAULT_MSG WEBSOCKETS_LIBRARIES WEBSOCKETS_INCLUDE_DIRS)
mark_as_advanced(WEBSOCKETS_LIBRARIES WEBSOCKETS_INCLUDE_DIRS)

View File

@ -27,6 +27,27 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# Try find WebP for our arch in external folder
if(USE_PREBUILT_LIBS)
find_path(WEBP_INCLUDE_DIR decode.h
PATH_SUFFIXES include/${PLATFORM_FOLDER} include
PATHS ${COCOS_EXTERNAL_DIR}/webp
NO_DEFAULT_PATH
)
find_library(WEBP_LIBRARY NAMES webp libwebp
PATH_SUFFIXES
prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
prebuilt/${PLATFORM_FOLDER}
PATHS ${COCOS_EXTERNAL_DIR}/webp
NO_DEFAULT_PATH
)
# cleanup if not found (prevent from mix prebuilt include paths and system installed libraries)
if(NOT WEBP_INCLUDE_DIR OR NOT WEBP_LIBRARY)
unset(WEBP_INCLUDE_DIR CACHE)
unset(WEBP_LIBRARY CACHE)
endif()
endif(USE_PREBUILT_LIBS)
FIND_PATH(WEBP_INCLUDE_DIR decode.h
HINTS
ENV WEBP_DIR
@ -43,7 +64,7 @@ FIND_PATH(WEBP_INCLUDE_DIR decode.h
)
FIND_LIBRARY(WEBP_LIBRARY
NAMES WEBP libWEBP
NAMES webp libwebp
HINTS
ENV WEBP_DIR
PATH_SUFFIXES lib

View File

@ -0,0 +1,81 @@
#.rst:
# SelectLibraryConfigurations
# ---------------------------
#
#
#
# select_library_configurations( basename )
#
# This macro takes a library base name as an argument, and will choose
# good values for basename_LIBRARY, basename_LIBRARIES,
# basename_LIBRARY_DEBUG, and basename_LIBRARY_RELEASE depending on what
# has been found and set. If only basename_LIBRARY_RELEASE is defined,
# basename_LIBRARY will be set to the release value, and
# basename_LIBRARY_DEBUG will be set to basename_LIBRARY_DEBUG-NOTFOUND.
# If only basename_LIBRARY_DEBUG is defined, then basename_LIBRARY will
# take the debug value, and basename_LIBRARY_RELEASE will be set to
# basename_LIBRARY_RELEASE-NOTFOUND.
#
# If the generator supports configuration types, then basename_LIBRARY
# and basename_LIBRARIES will be set with debug and optimized flags
# specifying the library to be used for the given configuration. If no
# build type has been set or the generator in use does not support
# configuration types, then basename_LIBRARY and basename_LIBRARIES will
# take only the release value, or the debug value if the release one is
# not set.
#=============================================================================
# Copyright 2009 Will Dicharry <wdicharry@stellarscience.com>
# Copyright 2005-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# This macro was adapted from the FindQt4 CMake module and is maintained by Will
# Dicharry <wdicharry@stellarscience.com>.
macro( select_library_configurations basename )
if(NOT ${basename}_LIBRARY_RELEASE)
set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.")
endif()
if(NOT ${basename}_LIBRARY_DEBUG)
set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.")
endif()
if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND
NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND
( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) )
# if the generator supports configuration types or CMAKE_BUILD_TYPE
# is set, then set optimized and debug options.
set( ${basename}_LIBRARY "" )
foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE )
list( APPEND ${basename}_LIBRARY optimized "${_libname}" )
endforeach()
foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG )
list( APPEND ${basename}_LIBRARY debug "${_libname}" )
endforeach()
elseif( ${basename}_LIBRARY_RELEASE )
set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
elseif( ${basename}_LIBRARY_DEBUG )
set( ${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG} )
else()
set( ${basename}_LIBRARY "${basename}_LIBRARY-NOTFOUND")
endif()
set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" )
if( ${basename}_LIBRARY )
set( ${basename}_FOUND TRUE )
endif()
mark_as_advanced( ${basename}_LIBRARY_RELEASE
${basename}_LIBRARY_DEBUG
)
endmacro()

View File

@ -1,5 +1,5 @@
if(WINDOWS AND NOT BUILD_STATIC)
if(WINDOWS AND BUILD_SHARED_LIBS)
ADD_DEFINITIONS (-D_USE3DDLL)
endif()

View File

@ -31,10 +31,6 @@ if(WINDOWS)
ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
endif()
if(WINDOWS AND NOT BUILD_STATIC)
ADD_DEFINITIONS (-D_USRDLL)
endif()
include(2d/CMakeLists.txt)
include(3d/CMakeLists.txt)
include(platform/CMakeLists.txt)
@ -46,6 +42,7 @@ include(deprecated/CMakeLists.txt)
include(ui/CMakeLists.txt)
include(network/CMakeLists.txt)
include(audio/CMakeLists.txt)
include_directories(audio/include)
include(storage/CMakeLists.txt)
if(BUILD_EDITOR_COCOSBUILDER)
@ -81,77 +78,27 @@ set(COCOS_SRC cocos2d.cpp
${COCOS_EXTENSIONS_SRC}
)
if(MACOSX OR APPLE)
include(FindFreetype REQUIRED)
if(NOT FREETYPE_FOUND)
if(IOS)
FIND_LIBRARY(FREETYPE_LIBRARIES NAMES libfreetype PATHS "../external/freetype2/prebuilt/ios" DOC "Freetype includes")
find_path(FREETYPE_INCLUDE_DIRS ft2build.h "../external/freetype2/include/ios" "../external/freetype2/include/ios/freetype" DOC "Freetype includes")
elseif()
FIND_LIBRARY(FREETYPE_LIBRARIES NAMES libfreetype PATHS "../external/freetype2/prebuilt/mac" DOC "Freetype includes")
find_path(FREETYPE_INCLUDE_DIRS ft2build.h "../external/freetype2/include/mac" "../external/freetype2/include/mac/freetype" DOC "Freetype includes")
endif(IOS)
endif(NOT FREETYPE_FOUND)
find_package(Freetype REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIRS})
endif()
if(MINGW)
find_package(Freetype REQUIRED)
find_package(WebP REQUIRED)
find_package(Protobuf REQUIRED)
#find_package(MiniZip REQUIRED)
#${MINIZIP_INCLUDE_DIR}
find_package(ZLIB REQUIRED)
find_package(Chipmunk REQUIRED)
message( STATUS "ZLIB dirs: ${ZLIB_INCLUDE_DIRS}")
message( STATUS "WEBP dirs: ${WEBP_INCLUDE_DIRS}")
message( STATUS "FREETYPE dirs: ${FREETYPE_INCLUDE_DIRS}")
message( STATUS "Chipmunk dirs: ${CHIPMUNK_INCLUDE_DIRS}")
message( STATUS "Protobuf dirs: ${PROTOBUF_INCLUDE_DIRS}")
include_directories(${FREETYPE_INCLUDE_DIRS} ${WEBP_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${CHIPMUNK_INCLUDE_DIRS} ${PROTOBUF_INCLUDE_DIRS})
else()
#todo: provide prebuild versions of minizip for android ios mac and msvc
#done: prebuilt version for mingw-w64 (linux distros should have them also)
# check for opensuse the buildbot system arch and ubuntu
include_directories(
../external/unzip)
endif()
#todo: provide prebuild versions of the xx libs for all platforms
include_directories(
../external/xxhash
../external/xxtea)
add_library(cocos2d ${BUILD_TYPE} ${COCOS_SRC})
add_library(cocos2d ${COCOS_SRC})
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(FMOD_LIB "fmodex64")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(FMOD_LIB "fmodex")
endif()
if(MINGW)
set(PLATFORM_SPECIFIC_LIBS z jpeg png webp tiff curl websockets glew32 opengl32 iconv freetype bz2)
elseif(WINDOWS)
set(PLATFORM_SPECIFIC_LIBS libjpeg libpng libwebp libtiff libcurl_imp libwebsockets freetype250 glew32 opengl32 libiconv libzlib)
set(PLATFORM_SPECIFIC_LIBS)
if(WINDOWS)
foreach(_pkg OPENGL GLEW GLFW3 VORBIS MPG123 OPENAL)
cocos_use_pkg(cocos2d ${_pkg})
endforeach()
list(APPEND PLATFORM_SPECIFIC_LIBS ws2_32 winmm)
elseif(LINUX)
set(PLATFORM_SPECIFIC_LIBS jpeg webp tiff freetype curl websockets ssl crypto
fontconfig png pthread glfw GLEW GL X11 rt z ${FMOD_LIB})
foreach(_pkg OPENGL GLEW GLFW3 FMODEX FONTCONFIG THREADS)
cocos_use_pkg(cocos2d ${_pkg})
endforeach()
elseif(MACOSX OR APPLE)
cocos_use_pkg(cocos2d GLFW3)
INCLUDE_DIRECTORIES ( /System/Library/Frameworks )
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
@ -164,8 +111,6 @@ elseif(MACOSX OR APPLE)
FIND_LIBRARY(FOUNDATION_LIBRARY Foundation)
set(PLATFORM_SPECIFIC_LIBS
z jpeg png webp tiff curl
websockets freetype
${COCOA_LIBRARY}
${OPENGL_LIBRARY}
${OPENAL_LIBRARY}
@ -177,17 +122,31 @@ elseif(MACOSX OR APPLE)
)
elseif(ANDROID)
set(PLATFORM_SPECIFIC_LIBS GLESv2 log z android)
set(PLATFORM_SPECIFIC_LIBS GLESv2 log android)
else()
message( FATAL_ERROR "Unsupported platform, CMake will exit" )
endif()
# Add GLFW3 for desktop platforms
if(LINUX OR MACOSX OR WINDOWS)
list(APPEND PLATFORM_SPECIFIC_LIBS ${GLFW3_LIBRARIES})
foreach(pkg ZLIB MINIZIP JPEG PNG TIFF TinyXML2 FREETYPE WEBSOCKETS CURL PROTOBUF_LITE)
cocos_use_pkg(cocos2d ${pkg})
endforeach()
target_link_libraries(cocos2d xxhash ${PLATFORM_SPECIFIC_LIBS})
if(USE_WEBP)
add_definitions(-DCC_USE_WEBP=1)
cocos_use_pkg(cocos2d WEBP)
else()
add_definitions(-DCC_USE_WEBP=0)
endif()
target_link_libraries(cocos2d chipmunk box2d protobuf tinyxml2 unzip xxhash ${PLATFORM_SPECIFIC_LIBS})
if(USE_CHIPMUNK)
cocos_use_pkg(cocos2d CHIPMUNK)
endif()
if(USE_BOX2D)
cocos_use_pkg(cocos2d Box2D)
endif()
set_target_properties(cocos2d
PROPERTIES

View File

@ -7,7 +7,10 @@ if(WINDOWS)
set(COCOS_AUDIO_PLATFORM_SRC
audio/win32/SimpleAudioEngine.cpp
audio/win32/MciPlayer.cpp
audio/win32/MciPlayer.h
audio/win32/MciPlayer.h
audio/win32/AudioEngine-win32.cpp
audio/win32/AudioCache.cpp
audio/win32/AudioPlayer.cpp
)
elseif(LINUX)
@ -18,8 +21,6 @@ elseif(LINUX)
audio/linux/AudioPlayer.h
)
include_directories( ../external/linux-specific/fmod/include/${ARCH_DIR} )
elseif(MACOSX)
# split it in _C and non C
# because C files needs to be compiled with C compiler and not C++
@ -45,16 +46,3 @@ elseif(MACOSX)
endif()
list(APPEND COCOS_AUDIO_SRC ${COCOS_AUDIO_PLATFORM_SRC})
if(LINUX)
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(FMOD_LIB "fmodex64")
else()
set(FMOD_LIB "fmodex")
endif()
set(AUDIO_LIB ${FMOD_LIB})
elseif(WINDOWS)
set(AUDIO_LIB Winmm)
endif()
include_directories( audio/include )

View File

@ -4,7 +4,11 @@
#include <vector>
#include <string>
#include <stdio.h>
#ifdef OPENAL_PLAIN_INCLUDES
#include <al.h>
#else
#include <AL/al.h>
#endif
#include "cocos2d.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN

View File

@ -30,9 +30,15 @@ THE SOFTWARE.
#include <stdio.h>
#include <unistd.h>
#ifdef OPENAL_PLAIN_INCLUDES
#include <al.h>
#include <alc.h>
#include <alut.h>
#else
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alut.h>
#endif
#include "OpenALDecoder.h"
#ifdef ENABLE_MPG123

View File

@ -31,8 +31,12 @@
#include <string>
#include <mutex>
#include <vector>
#ifdef OPENAL_PLAIN_INCLUDES
#include <al.h>
#else
#include <AL/al.h>
#endif
#include "CCPlatformMacros.h"
#include "AL/al.h"
#define QUEUEBUFFER_NUM 3
#define QUEUEBUFFER_TIME_STEP 0.1f

View File

@ -31,7 +31,11 @@
#include <string>
#include <condition_variable>
#include <thread>
#include "AL/al.h"
#ifdef OPENAL_PLAIN_INCLUDES
#include <al.h>
#else
#include <AL/al.h>
#endif
#include "CCPlatformMacros.h"
NS_CC_BEGIN

View File

@ -40,7 +40,7 @@ THE SOFTWARE.
#ifdef KEEP_COMPATABILITY
#include "platform/CCFileUtils.h"
#include "../tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
#endif
using namespace std;

View File

@ -24,7 +24,12 @@
****************************************************************************/
// FIXME: hack, must be included before ziputils
#ifdef MINIZIP_FROM_SYSTEM
#include <minizip/unzip.h>
#else // from our embedded sources
#include "unzip.h"
#endif
#include "base/ZipUtils.h"
#include <zlib.h>
@ -37,7 +42,7 @@
#include <map>
// FIXME: Other platforms should use upstream minizip like mingw-w64
#ifdef __MINGW32__
#ifdef MINIZIP_FROM_SYSTEM
#define unzGoToFirstFile64(A,B,C,D) unzGoToFirstFile2(A,B,C,D, NULL, 0, NULL, 0)
#define unzGoToNextFile64(A,B,C,D) unzGoToNextFile2(A,B,C,D, NULL, 0, NULL, 0)
#endif

View File

@ -32,7 +32,7 @@ THE SOFTWARE.
#include "2d/CCSpriteFrame.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
#include <fstream>

View File

@ -30,7 +30,7 @@
#include "cocostudio/CocoStudio.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
#include <fstream>

View File

@ -42,7 +42,7 @@ THE SOFTWARE.
#include "cocostudio/CocoLoader.h"
#include "ui/CocosGUI.h"
#include "CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
using namespace cocos2d;
using namespace cocos2d::ui;

View File

@ -1,5 +1,5 @@
if(WINDOWS AND NOT BUILD_STATIC)
if(WINDOWS AND BUILD_SHARED_LIBS)
ADD_DEFINITIONS (-D_USRSTUDIODLL)
endif()

View File

@ -4,7 +4,7 @@
#include "ui/UIButton.h"
#include "cocostudio/CocoLoader.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
USING_NS_CC;
using namespace ui;

View File

@ -4,7 +4,7 @@
#include "ui/UICheckBox.h"
#include "cocostudio/CocoLoader.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
USING_NS_CC;
using namespace ui;

View File

@ -4,7 +4,7 @@
#include "ui/UIImageView.h"
#include "cocostudio/CocoLoader.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
USING_NS_CC;
using namespace ui;

View File

@ -7,7 +7,7 @@
#include "ui/UIPageView.h"
#include "ui/UIListView.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
USING_NS_CC;
using namespace ui;

View File

@ -4,7 +4,7 @@
#include "ui/UIListView.h"
#include "cocostudio/CocoLoader.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
USING_NS_CC;
using namespace ui;

View File

@ -4,7 +4,7 @@
#include "ui/UILoadingBar.h"
#include "cocostudio/CocoLoader.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
USING_NS_CC;
using namespace ui;

View File

@ -5,7 +5,7 @@
#include "ui/UILayout.h"
#include "cocostudio/CocoLoader.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
USING_NS_CC;
using namespace ui;

View File

@ -4,7 +4,7 @@
#include "ui/UIScrollView.h"
#include "cocostudio/CocoLoader.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
USING_NS_CC;
using namespace ui;

View File

@ -4,7 +4,7 @@
#include "ui/UISlider.h"
#include "cocostudio/CocoLoader.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
USING_NS_CC;
using namespace ui;

View File

@ -4,7 +4,7 @@
#include "ui/UITextAtlas.h"
#include "cocostudio/CocoLoader.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
USING_NS_CC;
using namespace ui;

View File

@ -4,7 +4,7 @@
#include "ui/UITextBMFont.h"
#include "cocostudio/CocoLoader.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
USING_NS_CC;
using namespace ui;

View File

@ -4,7 +4,7 @@
#include "ui/UITextField.h"
#include "cocostudio/CocoLoader.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
USING_NS_CC;
using namespace ui;

View File

@ -4,7 +4,7 @@
#include "ui/UIText.h"
#include "cocostudio/CocoLoader.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
USING_NS_CC;
using namespace ui;

View File

@ -4,7 +4,7 @@
#include "cocostudio/CocoLoader.h"
#include "ui/UIButton.h"
#include "cocostudio/CSParseBinary.pb.h"
#include "tinyxml2/tinyxml2.h"
#include "tinyxml2.h"
#include "../ActionTimeline/CCActionTimeline.h"
USING_NS_CC;

View File

@ -46,173 +46,209 @@ public:
inline void MathUtilNeon64::addMatrix(const float* m, float scalar, float* dst)
{
dst[0] = m[0] + scalar;
dst[1] = m[1] + scalar;
dst[2] = m[2] + scalar;
dst[3] = m[3] + scalar;
dst[4] = m[4] + scalar;
dst[5] = m[5] + scalar;
dst[6] = m[6] + scalar;
dst[7] = m[7] + scalar;
dst[8] = m[8] + scalar;
dst[9] = m[9] + scalar;
dst[10] = m[10] + scalar;
dst[11] = m[11] + scalar;
dst[12] = m[12] + scalar;
dst[13] = m[13] + scalar;
dst[14] = m[14] + scalar;
dst[15] = m[15] + scalar;
asm volatile(
"ld4 {v0.4s, v1.4s, v2.4s, v3.4s}, [%1] \n\t" // M[m0-m7] M[m8-m15]
"ld1r {v4.4s}, [%2] \n\t" //ssss
"fadd v8.4s, v0.4s, v4.4s \n\t" // DST->M[m0-m3] = M[m0-m3] + s
"fadd v9.4s, v1.4s, v4.4s \n\t" // DST->M[m4-m7] = M[m4-m7] + s
"fadd v10.4s, v2.4s, v4.4s \n\t" // DST->M[m8-m11] = M[m8-m11] + s
"fadd v11.4s, v3.4s, v4.4s \n\t" // DST->M[m12-m15] = M[m12-m15] + s
"st4 {v8.4s, v9.4s, v10.4s, v11.4s}, [%0] \n\t" // Result in V9
:
: "r"(dst), "r"(m), "r"(&scalar)
: "v0", "v1", "v2", "v3", "v4", "v8", "v9", "v10", "v11", "memory"
);
}
inline void MathUtilNeon64::addMatrix(const float* m1, const float* m2, float* dst)
{
dst[0] = m1[0] + m2[0];
dst[1] = m1[1] + m2[1];
dst[2] = m1[2] + m2[2];
dst[3] = m1[3] + m2[3];
dst[4] = m1[4] + m2[4];
dst[5] = m1[5] + m2[5];
dst[6] = m1[6] + m2[6];
dst[7] = m1[7] + m2[7];
dst[8] = m1[8] + m2[8];
dst[9] = m1[9] + m2[9];
dst[10] = m1[10] + m2[10];
dst[11] = m1[11] + m2[11];
dst[12] = m1[12] + m2[12];
dst[13] = m1[13] + m2[13];
dst[14] = m1[14] + m2[14];
dst[15] = m1[15] + m2[15];
asm volatile(
"ld4 {v0.4s, v1.4s, v2.4s, v3.4s}, [%1] \n\t" // M1[m0-m7] M1[m8-m15]
"ld4 {v8.4s, v9.4s, v10.4s, v11.4s}, [%2] \n\t" // M2[m0-m7] M2[m8-m15]
"fadd v12.4s, v0.4s, v8.4s \n\t" // DST->M[m0-m3] = M1[m0-m3] + M2[m0-m3]
"fadd v13.4s, v1.4s, v9.4s \n\t" // DST->M[m4-m7] = M1[m4-m7] + M2[m4-m7]
"fadd v14.4s, v2.4s, v10.4s \n\t" // DST->M[m8-m11] = M1[m8-m11] + M2[m8-m11]
"fadd v15.4s, v3.4s, v11.4s \n\t" // DST->M[m12-m15] = M1[m12-m15] + M2[m12-m15]
"st4 {v12.4s, v13.4s, v14.4s, v15.4s}, [%0] \n\t" // DST->M[m0-m7] DST->M[m8-m15]
:
: "r"(dst), "r"(m1), "r"(m2)
: "v0", "v1", "v2", "v3", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "memory"
);
}
inline void MathUtilNeon64::subtractMatrix(const float* m1, const float* m2, float* dst)
{
dst[0] = m1[0] - m2[0];
dst[1] = m1[1] - m2[1];
dst[2] = m1[2] - m2[2];
dst[3] = m1[3] - m2[3];
dst[4] = m1[4] - m2[4];
dst[5] = m1[5] - m2[5];
dst[6] = m1[6] - m2[6];
dst[7] = m1[7] - m2[7];
dst[8] = m1[8] - m2[8];
dst[9] = m1[9] - m2[9];
dst[10] = m1[10] - m2[10];
dst[11] = m1[11] - m2[11];
dst[12] = m1[12] - m2[12];
dst[13] = m1[13] - m2[13];
dst[14] = m1[14] - m2[14];
dst[15] = m1[15] - m2[15];
asm volatile(
"ld4 {v0.4s, v1.4s, v2.4s, v3.4s}, [%1] \n\t" // M1[m0-m7] M1[m8-m15]
"ld4 {v8.4s, v9.4s, v10.4s, v11.4s}, [%2] \n\t" // M2[m0-m7] M2[m8-m15]
"fsub v12.4s, v0.4s, v8.4s \n\t" // DST->M[m0-m3] = M1[m0-m3] - M2[m0-m3]
"fsub v13.4s, v1.4s, v9.4s \n\t" // DST->M[m4-m7] = M1[m4-m7] - M2[m4-m7]
"fsub v14.4s, v2.4s, v10.4s \n\t" // DST->M[m8-m11] = M1[m8-m11] - M2[m8-m11]
"fsub v15.4s, v3.4s, v11.4s \n\t" // DST->M[m12-m15] = M1[m12-m15] - M2[m12-m15]
"st4 {v12.4s, v13.4s, v14.4s, v15.4s}, [%0] \n\t" // DST->M[m0-m7] DST->M[m8-m15]
:
: "r"(dst), "r"(m1), "r"(m2)
: "v0", "v1", "v2", "v3", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "memory"
);
}
inline void MathUtilNeon64::multiplyMatrix(const float* m, float scalar, float* dst)
{
dst[0] = m[0] * scalar;
dst[1] = m[1] * scalar;
dst[2] = m[2] * scalar;
dst[3] = m[3] * scalar;
dst[4] = m[4] * scalar;
dst[5] = m[5] * scalar;
dst[6] = m[6] * scalar;
dst[7] = m[7] * scalar;
dst[8] = m[8] * scalar;
dst[9] = m[9] * scalar;
dst[10] = m[10] * scalar;
dst[11] = m[11] * scalar;
dst[12] = m[12] * scalar;
dst[13] = m[13] * scalar;
dst[14] = m[14] * scalar;
dst[15] = m[15] * scalar;
asm volatile(
"ld1 {v0.s}[0], [%2] \n\t" //s
"ld4 {v4.4s, v5.4s, v6.4s, v7.4s}, [%1] \n\t" //M[m0-m7] M[m8-m15]
"fmul v8.4s, v4.4s, v0.s[0] \n\t" // DST->M[m0-m3] = M[m0-m3] * s
"fmul v9.4s, v5.4s, v0.s[0] \n\t" // DST->M[m4-m7] = M[m4-m7] * s
"fmul v10.4s, v6.4s, v0.s[0] \n\t" // DST->M[m8-m11] = M[m8-m11] * s
"fmul v11.4s, v7.4s, v0.s[0] \n\t" // DST->M[m12-m15] = M[m12-m15] * s
"st4 {v8.4s, v9.4s, v10.4s, v11.4s}, [%0] \n\t" // DST->M[m0-m7] DST->M[m8-m15]
:
: "r"(dst), "r"(m), "r"(&scalar)
: "v0", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "memory"
);
}
inline void MathUtilNeon64::multiplyMatrix(const float* m1, const float* m2, float* dst)
{
// Support the case where m1 or m2 is the same array as dst.
float product[16];
product[0] = m1[0] * m2[0] + m1[4] * m2[1] + m1[8] * m2[2] + m1[12] * m2[3];
product[1] = m1[1] * m2[0] + m1[5] * m2[1] + m1[9] * m2[2] + m1[13] * m2[3];
product[2] = m1[2] * m2[0] + m1[6] * m2[1] + m1[10] * m2[2] + m1[14] * m2[3];
product[3] = m1[3] * m2[0] + m1[7] * m2[1] + m1[11] * m2[2] + m1[15] * m2[3];
product[4] = m1[0] * m2[4] + m1[4] * m2[5] + m1[8] * m2[6] + m1[12] * m2[7];
product[5] = m1[1] * m2[4] + m1[5] * m2[5] + m1[9] * m2[6] + m1[13] * m2[7];
product[6] = m1[2] * m2[4] + m1[6] * m2[5] + m1[10] * m2[6] + m1[14] * m2[7];
product[7] = m1[3] * m2[4] + m1[7] * m2[5] + m1[11] * m2[6] + m1[15] * m2[7];
product[8] = m1[0] * m2[8] + m1[4] * m2[9] + m1[8] * m2[10] + m1[12] * m2[11];
product[9] = m1[1] * m2[8] + m1[5] * m2[9] + m1[9] * m2[10] + m1[13] * m2[11];
product[10] = m1[2] * m2[8] + m1[6] * m2[9] + m1[10] * m2[10] + m1[14] * m2[11];
product[11] = m1[3] * m2[8] + m1[7] * m2[9] + m1[11] * m2[10] + m1[15] * m2[11];
product[12] = m1[0] * m2[12] + m1[4] * m2[13] + m1[8] * m2[14] + m1[12] * m2[15];
product[13] = m1[1] * m2[12] + m1[5] * m2[13] + m1[9] * m2[14] + m1[13] * m2[15];
product[14] = m1[2] * m2[12] + m1[6] * m2[13] + m1[10] * m2[14] + m1[14] * m2[15];
product[15] = m1[3] * m2[12] + m1[7] * m2[13] + m1[11] * m2[14] + m1[15] * m2[15];
memcpy(dst, product, MATRIX_SIZE);
asm volatile(
"ld1 {v8.4s, v9.4s, v10.4s, v11.4s}, [%1] \n\t" // M1[m0-m7] M1[m8-m15] M2[m0-m7] M2[m8-m15]
"ld4 {v0.4s, v1.4s, v2.4s, v3.4s}, [%2] \n\t" // M2[m0-m15]
"fmul v12.4s, v8.4s, v0.s[0] \n\t" // DST->M[m0-m3] = M1[m0-m3] * M2[m0]
"fmul v13.4s, v8.4s, v0.s[1] \n\t" // DST->M[m4-m7] = M1[m4-m7] * M2[m4]
"fmul v14.4s, v8.4s, v0.s[2] \n\t" // DST->M[m8-m11] = M1[m8-m11] * M2[m8]
"fmul v15.4s, v8.4s, v0.s[3] \n\t" // DST->M[m12-m15] = M1[m12-m15] * M2[m12]
"fmla v12.4s, v9.4s, v1.s[0] \n\t" // DST->M[m0-m3] += M1[m0-m3] * M2[m1]
"fmla v13.4s, v9.4s, v1.s[1] \n\t" // DST->M[m4-m7] += M1[m4-m7] * M2[m5]
"fmla v14.4s, v9.4s, v1.s[2] \n\t" // DST->M[m8-m11] += M1[m8-m11] * M2[m9]
"fmla v15.4s, v9.4s, v1.s[3] \n\t" // DST->M[m12-m15] += M1[m12-m15] * M2[m13]
"fmla v12.4s, v10.4s, v2.s[0] \n\t" // DST->M[m0-m3] += M1[m0-m3] * M2[m2]
"fmla v13.4s, v10.4s, v2.s[1] \n\t" // DST->M[m4-m7] += M1[m4-m7] * M2[m6]
"fmla v14.4s, v10.4s, v2.s[2] \n\t" // DST->M[m8-m11] += M1[m8-m11] * M2[m10]
"fmla v15.4s, v10.4s, v2.s[3] \n\t" // DST->M[m12-m15] += M1[m12-m15] * M2[m14]
"fmla v12.4s, v11.4s, v3.s[0] \n\t" // DST->M[m0-m3] += M1[m0-m3] * M2[m3]
"fmla v13.4s, v11.4s, v3.s[1] \n\t" // DST->M[m4-m7] += M1[m4-m7] * M2[m7]
"fmla v14.4s, v11.4s, v3.s[2] \n\t" // DST->M[m8-m11] += M1[m8-m11] * M2[m11]
"fmla v15.4s, v11.4s, v3.s[3] \n\t" // DST->M[m12-m15] += M1[m12-m15] * M2[m15]
"st1 {v12.4s, v13.4s, v14.4s, v15.4s}, [%0] \n\t" // DST->M[m0-m7]// DST->M[m8-m15]
: // output
: "r"(dst), "r"(m1), "r"(m2) // input - note *value* of pointer doesn't change.
: "memory", "v0", "v1", "v2", "v3", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15"
);
}
inline void MathUtilNeon64::negateMatrix(const float* m, float* dst)
{
dst[0] = -m[0];
dst[1] = -m[1];
dst[2] = -m[2];
dst[3] = -m[3];
dst[4] = -m[4];
dst[5] = -m[5];
dst[6] = -m[6];
dst[7] = -m[7];
dst[8] = -m[8];
dst[9] = -m[9];
dst[10] = -m[10];
dst[11] = -m[11];
dst[12] = -m[12];
dst[13] = -m[13];
dst[14] = -m[14];
dst[15] = -m[15];
asm volatile(
"ld4 {v0.4s, v1.4s, v2.4s, v3.4s}, [%1] \n\t" // load m0-m7 load m8-m15
"fneg v4.4s, v0.4s \n\t" // negate m0-m3
"fneg v5.4s, v1.4s \n\t" // negate m4-m7
"fneg v6.4s, v2.4s \n\t" // negate m8-m15
"fneg v7.4s, v3.4s \n\t" // negate m8-m15
"st4 {v4.4s, v5.4s, v6.4s, v7.4s}, [%0] \n\t" // store m0-m7 store m8-m15
:
: "r"(dst), "r"(m)
: "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "memory"
);
}
inline void MathUtilNeon64::transposeMatrix(const float* m, float* dst)
{
float t[16] = {
m[0], m[4], m[8], m[12],
m[1], m[5], m[9], m[13],
m[2], m[6], m[10], m[14],
m[3], m[7], m[11], m[15]
};
memcpy(dst, t, MATRIX_SIZE);
asm volatile(
"ld4 {v0.4s, v1.4s, v2.4s, v3.4s}, [%1] \n\t" // DST->M[m0, m4, m8, m12] = M[m0-m3]
//DST->M[m1, m5, m9, m12] = M[m4-m7]
"st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%0] \n\t"
:
: "r"(dst), "r"(m)
: "v0", "v1", "v2", "v3", "memory"
);
}
inline void MathUtilNeon64::transformVec4(const float* m, float x, float y, float z, float w, float* dst)
{
dst[0] = x * m[0] + y * m[4] + z * m[8] + w * m[12];
dst[1] = x * m[1] + y * m[5] + z * m[9] + w * m[13];
dst[2] = x * m[2] + y * m[6] + z * m[10] + w * m[14];
asm volatile(
"ld1 {v0.s}[0], [%1] \n\t" // V[x]
"ld1 {v0.s}[1], [%2] \n\t" // V[y]
"ld1 {v0.s}[2], [%3] \n\t" // V[z]
"ld1 {v0.s}[3], [%4] \n\t" // V[w]
"ld1 {v9.4s, v10.4s, v11.4s, v12.4s}, [%5] \n\t" // M[m0-m7] M[m8-m15]
"fmul v13.4s, v9.4s, v0.s[0] \n\t" // DST->V = M[m0-m3] * V[x]
"fmla v13.4s, v10.4s, v0.s[1] \n\t" // DST->V += M[m4-m7] * V[y]
"fmla v13.4s, v11.4s, v0.s[2] \n\t" // DST->V += M[m8-m11] * V[z]
"fmla v13.4s, v12.4s, v0.s[3] \n\t" // DST->V += M[m12-m15] * V[w]
//"st1 {v13.4s}, [%0] \n\t" // DST->V[x, y] // DST->V[z]
"st1 {v13.2s}, [%0], 8 \n\t"
"st1 {v13.s}[2], [%0] \n\t"
:
: "r"(dst), "r"(&x), "r"(&y), "r"(&z), "r"(&w), "r"(m)
: "v0", "v9", "v10","v11", "v12", "v13", "memory"
);
}
inline void MathUtilNeon64::transformVec4(const float* m, const float* v, float* dst)
{
// Handle case where v == dst.
float x = v[0] * m[0] + v[1] * m[4] + v[2] * m[8] + v[3] * m[12];
float y = v[0] * m[1] + v[1] * m[5] + v[2] * m[9] + v[3] * m[13];
float z = v[0] * m[2] + v[1] * m[6] + v[2] * m[10] + v[3] * m[14];
float w = v[0] * m[3] + v[1] * m[7] + v[2] * m[11] + v[3] * m[15];
dst[0] = x;
dst[1] = y;
dst[2] = z;
dst[3] = w;
asm volatile
(
"ld1 {v0.4s}, [%1] \n\t" // V[x, y, z, w]
"ld1 {v9.4s, v10.4s, v11.4s, v12.4s}, [%2] \n\t" // M[m0-m7] M[m8-m15]
"fmul v13.4s, v9.4s, v0.s[0] \n\t" // DST->V = M[m0-m3] * V[x]
"fmla v13.4s, v10.4s, v0.s[1] \n\t" // DST->V = M[m4-m7] * V[y]
"fmla v13.4s, v11.4s, v0.s[2] \n\t" // DST->V = M[m8-m11] * V[z]
"fmla v13.4s, v12.4s, v0.s[3] \n\t" // DST->V = M[m12-m15] * V[w]
"st1 {v13.4s}, [%0] \n\t" // DST->V
:
: "r"(dst), "r"(v), "r"(m)
: "v0", "v9", "v10","v11", "v12", "v13", "memory"
);
}
inline void MathUtilNeon64::crossVec3(const float* v1, const float* v2, float* dst)
{
float x = (v1[1] * v2[2]) - (v1[2] * v2[1]);
float y = (v1[2] * v2[0]) - (v1[0] * v2[2]);
float z = (v1[0] * v2[1]) - (v1[1] * v2[0]);
dst[0] = x;
dst[1] = y;
dst[2] = z;
asm volatile(
"ld1 {v0.2s}, [%2] \n\t" //
"ld1 {v0.s}[3], [%1] \n\t" //
"mov v0.s[2], v0.s[1] \n\t" // q0 = (v1y, v1z, v1z, v1x)
"ld1 {v1.s}[1], [%3] \n\t" //
"ld1 {v1.s}[2], [%4], 4 \n\t" //
"ld1 {v1.s}[3], [%4] \n\t" //
"mov v1.s[0], v1.s[3] \n\t" // q1 = (v2z, v2x, v2y, v2z)
"fmul v2.4s, v0.4s, v1.4s \n\t" // x = v1y * v2z, y = v1z * v2x
"fsub s8, s8, s10 \n\t"
"fsub s9, s9, s11 \n\t" // x -= v1z * v2y, y-= v1x - v2z
"fmul s10, s3, s6 \n\t" // z = v1x * v2y
"fmul s11, s0, s5 \n\t" // z-= v1y * vx
"fsub s10, s10, s11 \n\t"
"st1 {v2.2s}, [%0], 8 \n\t" // V[x, y]
"st1 {v2.s}[2], [%0] \n\t" // V[z]
:
: "r"(dst), "r"(v1), "r"((v1+1)), "r"(v2), "r"((v2+1))
: "v0", "v1", "v2", "memory"
);
}
NS_CC_MATH_END

View File

@ -32,12 +32,12 @@
#include <errno.h>
#include <curl/curl.h>
#include "base/CCVector.h"
#include "base/CCDirector.h"
#include "base/CCScheduler.h"
#include "curl/curl.h"
#include "platform/CCFileUtils.h"
NS_CC_BEGIN

View File

@ -34,7 +34,11 @@ THE SOFTWARE.
#include "base/ccUtils.h"
#include "tinyxml2.h"
#ifdef MINIZIP_FROM_SYSTEM
#include <minizip/unzip.h>
#else // from our embedded sources
#include "unzip.h"
#endif
#include <sys/stat.h>
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
@ -443,7 +447,6 @@ static tinyxml2::XMLElement* generateElementForObject(const Value& value, tinyxm
return node;
}
// object is Array
if (value.getType() == Value::Type::VECTOR)
return generateElementForArray(value.asValueVector(), doc);
@ -463,14 +466,14 @@ static tinyxml2::XMLElement* generateElementForDict(const ValueMap& dict, tinyxm
{
tinyxml2::XMLElement* rootNode = doc->NewElement("dict");
for (auto iter = dict.cbegin(); iter != dict.cend(); ++iter)
for (const auto &iter : dict)
{
tinyxml2::XMLElement* tmpNode = doc->NewElement("key");
rootNode->LinkEndChild(tmpNode);
tinyxml2::XMLText* content = doc->NewText(iter->first.c_str());
tinyxml2::XMLText* content = doc->NewText(iter.first.c_str());
tmpNode->LinkEndChild(content);
tinyxml2::XMLElement *element = generateElementForObject(iter->second, doc);
tinyxml2::XMLElement *element = generateElementForObject(iter.second, doc);
if (element)
rootNode->LinkEndChild(element);
}
@ -492,7 +495,6 @@ static tinyxml2::XMLElement* generateElementForArray(const ValueVector& array, t
return rootNode;
}
#else
NS_CC_BEGIN
@ -504,10 +506,8 @@ bool FileUtils::writeToFile(ValueMap& dict, const std::string &fullPath) {return
#endif /* (CC_TARGET_PLATFORM != CC_PLATFORM_IOS) && (CC_TARGET_PLATFORM != CC_PLATFORM_MAC) */
FileUtils* FileUtils::s_sharedFileUtils = nullptr;
void FileUtils::destroyInstance()
{
CC_SAFE_DELETE(s_sharedFileUtils);
@ -521,7 +521,6 @@ FileUtils::~FileUtils()
{
}
bool FileUtils::init()
{
_searchPathArray.push_back(_defaultResRootPath);
@ -546,6 +545,7 @@ static Data getData(const std::string& filename, bool forString)
size_t size = 0;
size_t readsize;
const char* mode = nullptr;
if (forString)
mode = "rt";
else
@ -629,7 +629,7 @@ unsigned char* FileUtils::getFileData(const std::string& filename, const char* m
fclose(fp);
} while (0);
if (! buffer)
if (!buffer)
{
std::string msg = "Get data from file(";
msg.append(filename).append(") failed!");
@ -653,7 +653,7 @@ unsigned char* FileUtils::getFileDataFromZip(const std::string& zipFilePath, con
CC_BREAK_IF(!file);
// FIXME: Other platforms should use upstream minizip like mingw-w64
#ifdef __MINGW32__
#ifdef MINIZIP_FROM_SYSTEM
int ret = unzLocateFile(file, filename.c_str(), NULL);
#else
int ret = unzLocateFile(file, filename.c_str(), 1);
@ -724,7 +724,6 @@ std::string FileUtils::getPathForFilename(const std::string& filename, const std
return path;
}
std::string FileUtils::fullPathForFilename(const std::string &filename)
{
if (filename.empty())
@ -739,7 +738,7 @@ std::string FileUtils::fullPathForFilename(const std::string &filename)
// Already Cached ?
auto cacheIter = _fullPathCache.find(filename);
if( cacheIter != _fullPathCache.end() )
if(cacheIter != _fullPathCache.end())
{
return cacheIter->second;
}
@ -749,11 +748,11 @@ std::string FileUtils::fullPathForFilename(const std::string &filename)
std::string fullpath;
for (auto searchIt = _searchPathArray.cbegin(); searchIt != _searchPathArray.cend(); ++searchIt)
for (const auto& searchIt : _searchPathArray)
{
for (auto resolutionIt = _searchResolutionsOrderArray.cbegin(); resolutionIt != _searchResolutionsOrderArray.cend(); ++resolutionIt)
for (const auto& resolutionIt : _searchResolutionsOrderArray)
{
fullpath = this->getPathForFilename(newFilename, *resolutionIt, *searchIt);
fullpath = this->getPathForFilename(newFilename, resolutionIt, searchIt);
if (fullpath.length() > 0)
{
@ -761,6 +760,7 @@ std::string FileUtils::fullPathForFilename(const std::string &filename)
_fullPathCache.insert(std::make_pair(filename, fullpath));
return fullpath;
}
}
}
@ -783,9 +783,9 @@ void FileUtils::setSearchResolutionsOrder(const std::vector<std::string>& search
bool existDefault = false;
_fullPathCache.clear();
_searchResolutionsOrderArray.clear();
for(auto iter = searchResolutionsOrder.cbegin(); iter != searchResolutionsOrder.cend(); ++iter)
for(const auto& iter : searchResolutionsOrder)
{
std::string resolutionDirectory = *iter;
std::string resolutionDirectory = iter;
if (!existDefault && resolutionDirectory == "")
{
existDefault = true;
@ -798,6 +798,7 @@ void FileUtils::setSearchResolutionsOrder(const std::vector<std::string>& search
_searchResolutionsOrderArray.push_back(resolutionDirectory);
}
if (!existDefault)
{
_searchResolutionsOrderArray.push_back("");
@ -809,6 +810,7 @@ void FileUtils::addSearchResolutionsOrder(const std::string &order,const bool fr
std::string resOrder = order;
if (!resOrder.empty() && resOrder[resOrder.length()-1] != '/')
resOrder.append("/");
if (front) {
_searchResolutionsOrderArray.insert(_searchResolutionsOrderArray.begin(), resOrder);
} else {
@ -816,7 +818,7 @@ void FileUtils::addSearchResolutionsOrder(const std::string &order,const bool fr
}
}
const std::vector<std::string>& FileUtils::getSearchResolutionsOrder()
const std::vector<std::string>& FileUtils::getSearchResolutionsOrder() const
{
return _searchResolutionsOrderArray;
}
@ -832,16 +834,16 @@ void FileUtils::setSearchPaths(const std::vector<std::string>& searchPaths)
_fullPathCache.clear();
_searchPathArray.clear();
for (auto iter = searchPaths.cbegin(); iter != searchPaths.cend(); ++iter)
for (const auto& iter : searchPaths)
{
std::string prefix;
std::string path;
if (!isAbsolutePath(*iter))
if (!isAbsolutePath(iter))
{ // Not an absolute path
prefix = _defaultResRootPath;
}
path = prefix + (*iter);
path = prefix + (iter);
if (path.length() > 0 && path[path.length()-1] != '/')
{
path += "/";
@ -1005,12 +1007,12 @@ bool FileUtils::isDirectoryExist(const std::string& dirPath)
}
std::string fullpath;
for (auto searchIt = _searchPathArray.cbegin(); searchIt != _searchPathArray.cend(); ++searchIt)
for (const auto& searchIt : _searchPathArray)
{
for (auto resolutionIt = _searchResolutionsOrderArray.cbegin(); resolutionIt != _searchResolutionsOrderArray.cend(); ++resolutionIt)
for (const auto& resolutionIt : _searchResolutionsOrderArray)
{
// searchPath + file_path + resourceDirectory
fullpath = *searchIt + dirPath + *resolutionIt;
fullpath = searchIt + dirPath + resolutionIt;
if (isDirectoryExistInternal(fullpath))
{
const_cast<FileUtils*>(this)->_fullPathCache.insert(std::make_pair(dirPath, fullpath));

View File

@ -238,7 +238,7 @@ public:
* @since v2.1
* @lua NA
*/
virtual const std::vector<std::string>& getSearchResolutionsOrder();
virtual const std::vector<std::string>& getSearchResolutionsOrder() const;
/**
* Sets the array of search paths.

View File

@ -35,8 +35,6 @@ THE SOFTWARE.
#include "deprecated/CCDictionary.h"
#include "platform/CCFileUtils.h"
#include "platform/CCSAXParser.h"
#include "unzip.h"
NS_CC_BEGIN

View File

@ -100,6 +100,7 @@ void Device::setAccelerometerEnabled(bool isEnabled)
auto orientation = GLViewImpl::sharedOpenGLView()->getDeviceOrientation();
#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
switch (orientation)
{
case DisplayOrientations::Portrait:
@ -127,7 +128,36 @@ void Device::setAccelerometerEnabled(bool isEnabled)
acc.y = reading->AccelerationY;
break;
}
#else // Windows Store App
// from http://msdn.microsoft.com/en-us/library/windows/apps/dn440593
switch (orientation)
{
case DisplayOrientations::Portrait:
acc.x = reading->AccelerationY;
acc.y = -reading->AccelerationX;
break;
case DisplayOrientations::Landscape:
acc.x = reading->AccelerationX;
acc.y = reading->AccelerationY;
break;
case DisplayOrientations::PortraitFlipped:
acc.x = -reading->AccelerationY;
acc.y = reading->AccelerationX;
break;
case DisplayOrientations::LandscapeFlipped:
acc.x = -reading->AccelerationY;
acc.y = reading->AccelerationX;
break;
default:
acc.x = reading->AccelerationY;
acc.y = -reading->AccelerationX;
break;
}
#endif
std::shared_ptr<cocos2d::InputEvent> event(new AccelerometerEvent(acc));
cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(event);
});

View File

@ -1,4 +1,8 @@
set(cocos_root ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
set(cocos_root ${Cocos2d-X_SOURCE_DIR})
if(WINDOWS)
add_definitions(-DLUASOCKET_INET_ATON -DLUASOCKET_INET_PTON)
endif()
include_directories(
${cocos_root}/external/lua/tolua
@ -17,13 +21,12 @@ include_directories(
${cocos_root}/cocos/editor-support
${cocos_root}/cocos/platform
${cocos_root}/cocos/audio/include
${CMAKE_CURRENT_SOURCE_DIR}/manual
${CMAKE_CURRENT_SOURCE_DIR}/manual/extension
${CMAKE_CURRENT_SOURCE_DIR}/manual/cocostudio
${CMAKE_CURRENT_SOURCE_DIR}/manual/ui
${CMAKE_CURRENT_SOURCE_DIR}/ui
${CMAKE_CURRENT_SOURCE_DIR}/manual/cocos2d
${CMAKE_CURRENT_SOURCE_DIR}/auto
manual
manual/extension
manual/cocostudio
manual/ui
manual/cocos2d
auto
)
file(GLOB lua_cocos2d_source_files
@ -32,25 +35,32 @@ file(GLOB lua_cocos2d_source_files
"${cocos_root}/external/xxtea/xxtea.cpp"
)
# luasockets are needed in Linux too,
# but Linux have them disabled for some reason
if(MACOSX)
set(lua_cocos2d_source_files
${lua_cocos2d_source_files}
${cocos_root}/external/lua/luasocket/auxiliar.c
${cocos_root}/external/lua/luasocket/buffer.c
${cocos_root}/external/lua/luasocket/except.c
${cocos_root}/external/lua/luasocket/inet.c
${cocos_root}/external/lua/luasocket/io.c
list(APPEND lua_cocos2d_source_files
${cocos_root}/external/lua/luasocket/luasocket.c
${cocos_root}/external/lua/luasocket/luasocket_scripts.c
${cocos_root}/external/lua/luasocket/mime.c
${cocos_root}/external/lua/luasocket/options.c
${cocos_root}/external/lua/luasocket/select.c
${cocos_root}/external/lua/luasocket/serial.c
${cocos_root}/external/lua/luasocket/tcp.c
${cocos_root}/external/lua/luasocket/timeout.c
${cocos_root}/external/lua/luasocket/buffer.c
${cocos_root}/external/lua/luasocket/io.c
${cocos_root}/external/lua/luasocket/auxiliar.c
${cocos_root}/external/lua/luasocket/options.c
${cocos_root}/external/lua/luasocket/inet.c
${cocos_root}/external/lua/luasocket/except.c
${cocos_root}/external/lua/luasocket/select.c
${cocos_root}/external/lua/luasocket/tcp.c
${cocos_root}/external/lua/luasocket/udp.c
${cocos_root}/external/lua/luasocket/mime.c
${cocos_root}/external/lua/luasocket/luasocket_scripts.c
)
if(WINDOWS)
list(APPEND lua_cocos2d_source_files
${cocos_root}/external/lua/luasocket/wsocket.c
)
elseif(UNIX)
if(LINUX)
add_definitions(-D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE)
endif()
list(APPEND lua_cocos2d_source_files
${cocos_root}/external/lua/luasocket/serial.c
${cocos_root}/external/lua/luasocket/unix.c
${cocos_root}/external/lua/luasocket/usocket.c
)
@ -116,7 +126,7 @@ endif()
set(lua_bindings_files ${lua_cocos2d_source_files} ${lua_bindings_manual_files} ${lua_bindings_auto_files})
add_library(luacocos2d STATIC ${lua_bindings_files})
add_library(luacocos2d ${lua_bindings_files})
target_link_libraries(luacocos2d cocos2d)
set_target_properties(luacocos2d
PROPERTIES

View File

@ -1,5 +1,5 @@
if(WINDOWS AND NOT BUILD_STATIC)
if(WINDOWS AND BUILD_SHARED_LIBS)
ADD_DEFINITIONS (-D_USEGUIDLL)
endif()

View File

@ -690,14 +690,16 @@ void EditBoxImplWin::openKeyboard()
{
_delegate->editBoxEditingDidBegin(_editBox);
}
EditBox* pEditBox = this->getEditBox();
if (nullptr != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
#if CC_ENABLE_SCRIPT_BINDING
auto editBox = this->getEditBox();
if (editBox && editBox->getScriptEditBoxHandler())
{
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
CommonScriptData data(editBox->getScriptEditBoxHandler(), "began",editBox);
ScriptEvent event(kCommonEvent,(void*)&data);
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
}
#endif
std::string placeHolder = _labelPlaceHolder->getString();
if (placeHolder.length() == 0)

View File

@ -330,7 +330,7 @@ void UIEditBoxImplWinrt::openKeyboard()
{
_delegate->editBoxEditingDidBegin(_editBox);
}
#if CC_ENABLE_SCRIPT_BINDING
EditBox* pEditBox = this->getEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
@ -338,7 +338,7 @@ void UIEditBoxImplWinrt::openKeyboard()
ScriptEvent event(kCommonEvent,(void*)&data);
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
}
#endif
std::string placeHolder = m_pLabelPlaceHolder->getString();
if (placeHolder.length() == 0)
placeHolder = "Enter value";

View File

@ -66,7 +66,7 @@ void UIEditBoxImplWp8::openKeyboard()
{
_delegate->editBoxEditingDidBegin(_editBox);
}
#if CC_ENABLE_SCRIPT_BINDING
EditBox* pEditBox = this->getEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
@ -74,7 +74,7 @@ void UIEditBoxImplWp8::openKeyboard()
ScriptEvent event(kCommonEvent,(void*)&data);
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
}
#endif
std::string placeHolder = m_pLabelPlaceHolder->getString();
if (placeHolder.length() == 0)
placeHolder = "Enter value";

View File

@ -1,20 +1,7 @@
if(WINDOWS AND NOT BUILD_STATIC)
if(WINDOWS AND BUILD_SHARED_LIBS)
ADD_DEFINITIONS (-D_USREXDLL)
endif()
if(WINDOWS)
# set(PLATFORM_EXTENSIONS_SRC
# ../extensions/proj.win32/Win32InputBox.cpp
# )
elseif(MACOSX)
else()
# set(PLATFORM_EXTENSIONS_SRC
# ../../extensions/GUI/CCEditBox/CCEditBoxImplNone.cpp)
endif()
include_directories(
../../extensions
)

View File

@ -41,7 +41,11 @@
#include "base/CCUserDefault.h"
#include "platform/CCFileUtils.h"
#ifdef MINIZIP_FROM_SYSTEM
#include <minizip/unzip.h>
#else // from our embedded sources
#include "unzip.h"
#endif
using namespace cocos2d;
using namespace std;

View File

@ -30,7 +30,11 @@
#include <curl/easy.h>
#include <stdio.h>
#ifdef MINIZIP_FROM_SYSTEM
#include <minizip/unzip.h>
#else // from our embedded sources
#include "unzip.h"
#endif
using namespace cocos2d;
using namespace std;

View File

@ -1,5 +1,5 @@
{
"version":"v3-deps-21",
"version":"v3-deps-22",
"zip_file_size":"87419231",
"repo_name":"cocos2d-x-3rd-party-libs-bin",
"repo_parent":"https://github.com/cocos2d/",

View File

@ -52,11 +52,26 @@
"cmake/BuildHelpers.CMakeLists.txt",
"cmake/Modules/CMakeParseArguments.cmake",
"cmake/Modules/CocosBuildHelpers.cmake",
"cmake/Modules/CocosUsePrebuiltLibs.cmake",
"cmake/Modules/FindCURL.cmake",
"cmake/Modules/FindChipmunk.cmake",
"cmake/Modules/FindFMODEX.cmake",
"cmake/Modules/FindFontconfig.cmake",
"cmake/Modules/FindFreetype.cmake",
"cmake/Modules/FindGLFW3.cmake",
"cmake/Modules/FindJPEG.cmake",
"cmake/Modules/FindMINIZIP.cmake",
"cmake/Modules/FindMPG123.cmake",
"cmake/Modules/FindOgg.cmake",
"cmake/Modules/FindPNG.cmake",
"cmake/Modules/FindPackageHandleStandardArgs.cmake",
"cmake/Modules/FindPackageMessage.cmake",
"cmake/Modules/FindTIFF.cmake",
"cmake/Modules/FindTinyXML2.cmake",
"cmake/Modules/FindVorbis.cmake",
"cmake/Modules/FindWEBSOCKETS.cmake",
"cmake/Modules/FindWebP.cmake",
"cmake/Modules/SelectLibraryConfigurations.cmake",
"cmake/android.toolchain.cmake",
"cmake/ios.toolchain.cmake",
"cocos/2d/CCAction.cpp",

View File

@ -1,15 +1,11 @@
set(APP_NAME cpp-empty-test)
if(ANDROID)
set(PLATFORM_SRC
proj.android/jni/hellocpp/main.cpp
)
set(PLATFORM_SRC proj.android/jni/hellocpp/main.cpp)
set(RES_PREFIX "/Resources")
elseif(WINDOWS)
set(PLATFORM_SRC
proj.win32/main.cpp
)
set(PLATFORM_SRC proj.win32/main.cpp)
set(RES_PREFIX "")
elseif(IOS)
set(PLATFORM_SRC
proj.ios/main.m
@ -18,19 +14,15 @@ elseif(IOS)
)
elseif(MACOSX OR APPLE)
set(PLATFORM_SRC
proj.mac/main.cpp
)
set(PLATFORM_SRC proj.mac/main.cpp)
file(GLOB_RECURSE RES_FILES Resources/*)
cocos_mark_resources(FILES ${RES_FILES} BASEDIR Resources)
list(APPEND PLATFORM_SRC ${RES_FILES})
elseif(LINUX)
set(PLATFORM_SRC
proj.linux/main.cpp
)
set(PLATFORM_SRC proj.linux/main.cpp)
set(RES_PREFIX "/Resources")
else()
message( FATAL_ERROR "Unsupported platform, CMake will exit" )
@ -83,8 +75,7 @@ else()
set_target_properties(${APP_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
add_custom_command(TARGET ${APP_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory $<TARGET_FILE_DIR:${APP_NAME}>/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources $<TARGET_FILE_DIR:${APP_NAME}>/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources $<TARGET_FILE_DIR:${APP_NAME}>${RES_PREFIX}
)
endif()

View File

@ -1,22 +1,18 @@
set(APP_NAME cpp-tests)
if(WIN32)
set(PLATFORM_SRC
proj.win32/main.cpp
)
set(PLATFORM_SRC proj.win32/main.cpp)
set(RES_PREFIX "")
elseif(MACOSX)
set(PLATFORM_SRC
proj.mac/main.cpp
)
set(PLATFORM_SRC proj.mac/main.cpp)
file(GLOB_RECURSE RES_FILES Resources/*)
cocos_mark_resources(FILES ${RES_FILES} BASEDIR Resources)
list(APPEND PLATFORM_SRC ${RES_FILES})
elseif(LINUX)
set(PLATFORM_SRC
proj.linux/main.cpp
)
set(PLATFORM_SRC proj.linux/main.cpp)
set(RES_PREFIX "/Resources")
else()
message( FATAL_ERROR "Unsupported platform, CMake will exit" )
endif()
@ -27,11 +23,6 @@ set(TESTS_SRC
Classes/ActionsProgressTest/ActionsProgressTest.cpp
Classes/ActionsTest/ActionsTest.cpp
Classes/BillBoardTest/BillBoardTest.cpp
Classes/Box2DTest/Box2dTest.cpp
Classes/Box2DTestBed/Box2dView.cpp
Classes/Box2DTestBed/GLES-Render.cpp
Classes/Box2DTestBed/Test.cpp
Classes/Box2DTestBed/TestEntries.cpp
Classes/BugsTest/Bug-1159.cpp
Classes/BugsTest/Bug-1174.cpp
Classes/BugsTest/Bug-350.cpp
@ -203,6 +194,20 @@ set(TESTS_SRC
${PLATFORM_SRC}
)
if(USE_CHIPMUNK)
include_directories(${CHIPMUNK_INCLUDE_DIRS})
endif()
if(USE_BOX2D)
list(APPEND TESTS_SRC
Classes/Box2DTest/Box2dTest.cpp
Classes/Box2DTestBed/Box2dView.cpp
Classes/Box2DTestBed/GLES-Render.cpp
Classes/Box2DTestBed/Test.cpp
Classes/Box2DTestBed/TestEntries.cpp
)
endif()
if(LINUX)
set(EXTENDED_TESTS_SRC
)
@ -229,7 +234,6 @@ endif()
include_directories(
Classes
${CMAKE_SOURCE_DIR}/external/chipmunk/include/chipmunk
${CMAKE_SOURCE_DIR}/cocos/editor-support
)
@ -255,8 +259,7 @@ else()
set_target_properties(${APP_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
pre_build(${APP_NAME}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}${RES_PREFIX}
)
endif()

View File

@ -42,8 +42,10 @@ Controller g_aTestNames[] = {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
{ "Audio - NewAudioEngine", []() { return new AudioEngineTestScene(); } },
#endif
#if CC_ENABLE_BOX2D_INTEGRATION
{ "Box2d - Basic", []() { return new Box2DTestScene(); } },
{ "Box2d - TestBed", []() { return new Box2dTestBedScene(); } },
#endif
{ "Bugs", []() { return new BugsTestScene(); } },
{ "Chipmunk", []() { return new ChipmunkAccelTouchTestScene(); } },
{ "Click and Move", [](){return new ClickAndMoveTestScene(); } },

View File

@ -30,8 +30,10 @@
#include "SpriteTest/SpriteTest.h"
#include "SchedulerTest/SchedulerTest.h"
#include "RenderTextureTest/RenderTextureTest.h"
#if CC_ENABLE_BOX2D_INTEGRATION
#include "Box2DTest/Box2dTest.h"
#include "Box2DTestBed/Box2dView.h"
#endif
#include "EffectsAdvancedTest/EffectsAdvancedTest.h"
#include "InputTest/MouseTest.h"
#include "PerformanceTest/PerformanceTest.h"

View File

@ -1,19 +1,15 @@
set(APP_NAME lua-empty-test)
set(SAMPLE_SRC
Classes/AppDelegate.cpp
)
set(SAMPLE_SRC Classes/AppDelegate.cpp)
if(LINUX)
set(SAMPLE_SRC
${SAMPLE_SRC}
proj.linux/main.cpp
)
set(SAMPLE_SRC ${SAMPLE_SRC} proj.linux/main.cpp)
set(RES_PREFIX "/Resources")
elseif(WINDOWS)
list(APPEND SAMPLE_SRC proj.win32/main.cpp)
set(RES_PREFIX "")
elseif(MACOSX OR APPLE)
set(SAMPLE_SRC
${SAMPLE_SRC}
proj.mac/main.cpp
)
set(SAMPLE_SRC ${SAMPLE_SRC} proj.mac/main.cpp)
file(GLOB_RECURSE APP_RESOURCES ../res/*)
cocos_mark_resources(FILES ${APP_RESOURCES} BASEDIR ../res RESOURCEBASE Resources/res)
@ -50,10 +46,9 @@ else()
set_target_properties(${APP_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
pre_build(${APP_NAME}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../res ${APP_BIN_DIR}/Resources/res
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../src ${APP_BIN_DIR}/Resources/src
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script/ ${APP_BIN_DIR}/Resources/src/cocos
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../res ${APP_BIN_DIR}${RES_PREFIX}/res
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../src ${APP_BIN_DIR}${RES_PREFIX}/src
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script/ ${APP_BIN_DIR}${RES_PREFIX}/src/cocos
)
endif()

View File

@ -7,15 +7,13 @@ set(SAMPLE_SRC
)
if(LINUX)
set(SAMPLE_SRC
${SAMPLE_SRC}
proj.linux/main.cpp
)
set(SAMPLE_SRC ${SAMPLE_SRC} proj.linux/main.cpp)
set(RES_PREFIX "/Resources")
elseif(WINDOWS)
list(APPEND SAMPLE_SRC proj.win32/main.cpp)
set(RES_PREFIX "")
elseif(MACOSX)
set(SAMPLE_SRC
${SAMPLE_SRC}
proj.ios_mac/mac/main.cpp
)
set(SAMPLE_SRC ${SAMPLE_SRC} proj.ios_mac/mac/main.cpp)
file(GLOB_RECURSE APP_RESOURCES ../res/*)
cocos_mark_resources(FILES ${APP_RESOURCES} BASEDIR ../res RESOURCEBASE Resources/res)
@ -55,11 +53,10 @@ else()
set_target_properties(${APP_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
pre_build(${APP_NAME}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../res ${APP_BIN_DIR}/Resources/res
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../src ${APP_BIN_DIR}/Resources/src
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../res ${APP_BIN_DIR}${RES_PREFIX}/res
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../src ${APP_BIN_DIR}${RES_PREFIX}/Resources/src
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script/ ${APP_BIN_DIR}/Resources/src/cocos
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/tests/cpp-tests/Resources ${APP_BIN_DIR}/Resources/res
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/tests/cpp-tests/Resources ${APP_BIN_DIR}${RES_PREFIX}/res
)
endif()

@ -1 +1 @@
Subproject commit f1a8f35036b9cc85061d91447bce8e35439b43a1
Subproject commit aa829513296354961e814078e646108e9cb92a2d

View File

@ -115,6 +115,7 @@ tags
!/cocos/2d/platform/android/java/res/
# Permit plugins to ship third-party libraries.
!/plugin/plugins/*/proj.android/libs/*.jar
!/plugin/plugins/*/proj.android/libs
v*-deps-*.zip
v*-lua-runtime-*.zip

View File

@ -97,6 +97,7 @@ class CocosFileList:
self.fileList_lua.append("%s/" %relativePath)
else:
self.fileList_com.append("%s/" %relativePath)
self.__parseFileList(path)
continue
if (
self.__bExclude("/%s" %relativePath) or