mirror of https://github.com/axmolengine/axmol.git
Merge pull request #9177 from vovkasm/cmake-unify-usage-of-prebuilt-libraries
Cmake unify usage of prebuilt libraries
This commit is contained in:
commit
2e64e24d71
217
CMakeLists.txt
217
CMakeLists.txt
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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()
|
|
@ -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()
|
||||
|
|
@ -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)
|
||||
|
|
@ -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
|
||||
)
|
||||
|
|
@ -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)
|
|
@ -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
|
||||
|
|
|
@ -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 )
|
|
@ -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)
|
||||
|
|
@ -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)
|
|
@ -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)
|
|
@ -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 )
|
|
@ -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)
|
|
@ -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)
|
|
@ -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)
|
|
@ -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)
|
|
@ -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
|
||||
|
|
|
@ -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()
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
if(WINDOWS AND NOT BUILD_STATIC)
|
||||
if(WINDOWS AND BUILD_SHARED_LIBS)
|
||||
ADD_DEFINITIONS (-D_USE3DDLL)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -8,6 +8,9 @@ if(WINDOWS)
|
|||
audio/win32/SimpleAudioEngine.cpp
|
||||
audio/win32/MciPlayer.cpp
|
||||
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 )
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -40,7 +40,7 @@ THE SOFTWARE.
|
|||
|
||||
#ifdef KEEP_COMPATABILITY
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "../tinyxml2/tinyxml2.h"
|
||||
#include "tinyxml2.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -32,7 +32,7 @@ THE SOFTWARE.
|
|||
#include "2d/CCSpriteFrame.h"
|
||||
|
||||
#include "cocostudio/CSParseBinary.pb.h"
|
||||
#include "tinyxml2/tinyxml2.h"
|
||||
#include "tinyxml2.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "cocostudio/CocoStudio.h"
|
||||
|
||||
#include "cocostudio/CSParseBinary.pb.h"
|
||||
#include "tinyxml2/tinyxml2.h"
|
||||
#include "tinyxml2.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
if(WINDOWS AND NOT BUILD_STATIC)
|
||||
if(WINDOWS AND BUILD_SHARED_LIBS)
|
||||
ADD_DEFINITIONS (-D_USRSTUDIODLL)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
@ -653,7 +657,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);
|
||||
|
|
|
@ -35,8 +35,6 @@ THE SOFTWARE.
|
|||
#include "deprecated/CCDictionary.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "platform/CCSAXParser.h"
|
||||
#include "unzip.h"
|
||||
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
|
|
@ -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,30 @@ 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)
|
||||
add_definitions(-D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE)
|
||||
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 +124,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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
if(WINDOWS AND NOT BUILD_STATIC)
|
||||
if(WINDOWS AND BUILD_SHARED_LIBS)
|
||||
ADD_DEFINITIONS (-D_USEGUIDLL)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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(); } },
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue