refactor cmake on use libs (#19054)

* link external build by modern cmake

* use "--whole-archive" for part android spec

* update travis

* update CI, add cmake tests on win32
This commit is contained in:
leda 2018-09-24 20:16:04 -07:00 committed by GitHub
parent a504c54a05
commit 98120fb9d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 545 additions and 1164 deletions

View File

@ -8,9 +8,10 @@ environment:
PYTHON_VERSION: "2.7.13"
PYTHON_ARCH: "32"
matrix:
- build_type: windows32_cocos_new_test
- build_type: windows32
- build_type: windows32_cmake_test
- build_type: windows32_sln_test
- build_type: android_cpp_tests
- build_type: android_lua_tests
# - build_type: android_cocos_new_test
# - build_type: android_cpp_empty_test
# - build_type: android_gen_libs

View File

@ -42,6 +42,11 @@ matrix:
env: BUILD_TARGET=android_lua_cmake
language: android
sudo: required
# android_js cmake
- os: linux
env: BUILD_TARGET=android_js_cmake
language: android
sudo: required
# mac
- os: osx
env: BUILD_TARGET=mac

View File

@ -26,7 +26,7 @@
# build engine library and all tests
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.6)
project(Cocos2d-x)

View File

@ -78,7 +78,7 @@ function(get_target_depends_ext_dlls cocos_target all_depend_dlls_out)
list(APPEND tmp_depend_libs ${tmp_target})
foreach(depend_lib ${tmp_depend_libs})
if(TARGET ${depend_lib})
get_target_property(tmp_dlls ${depend_lib} DEPEND_DLLS)
get_target_property(tmp_dlls ${depend_lib} CC_DEPEND_DLLS)
if(tmp_dlls)
list(APPEND all_depend_ext_dlls ${tmp_dlls})
endif()
@ -103,7 +103,10 @@ function(cocos_copy_target_dll cocos_target)
cmake_parse_arguments(opt "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
get_target_depends_ext_dlls(${cocos_target} all_depend_dlls)
# remove repeat items
list(REMOVE_DUPLICATES all_depend_dlls)
if(all_depend_dlls)
list(REMOVE_DUPLICATES all_depend_dlls)
endif()
# todo, add a option to enable/disable debug print
message(STATUS "prepare to copy external dlls for ${cocos_target}:${all_depend_dlls}")
foreach(cc_dll_file ${all_depend_dlls})
get_filename_component(cc_dll_name ${cc_dll_file} NAME)
@ -188,34 +191,8 @@ function(source_group_single_file single_file)
source_group("${ide_file_group}" FILES ${single_file})
endfunction()
# build a cocos application
# hrough compile the files `APP_SRC`, link the libs in `*LIBS`, use the packages in `*.PKGS`
# this method hide the link lib details, those is prebuilt libs or not
function(cocos_build_app app_name)
set(multiValueArgs
APP_SRC
DEPEND_COMMON_LIBS
DEPEND_ANDROID_LIBS
COMMON_USE_PKGS
LINUX_USE_PKGS
DEPEND_MACOSX_LIBS
DEPEND_WINDOWS_LIBS
)
cmake_parse_arguments(opt "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(ANDROID)
add_library(${app_name} SHARED ${opt_APP_SRC})
foreach(android_lib ${opt_DEPEND_ANDROID_LIBS})
if(USE_COCOS_PREBUILT)
target_link_libraries(${app_name} -Wl,-whole-archive "${${_${android_lib}_prefix}_LIBRARIES}" -Wl,-no-whole-archive)
else()
target_link_libraries(${app_name} -Wl,-whole-archive ${android_lib} -Wl,-no-whole-archive)
add_dependencies(${app_name} ${android_lib})
endif()
endforeach()
else()
add_executable(${app_name} ${opt_APP_SRC})
endif()
# setup a cocos application, include "APP_BIN_DIR", "APP_RES_DIR" config
function(setup_cocos_app_config app_name)
# set target PROPERTIES, depend different platforms
if(APPLE)
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin")
@ -233,47 +210,13 @@ function(cocos_build_app app_name)
endif()
set_target_properties(${app_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
if(MACOSX)
list(APPEND opt_DEPEND_COMMON_LIBS ${opt_DEPEND_MACOSX_LIBS})
elseif(WINDOWS)
list(APPEND opt_DEPEND_COMMON_LIBS ${opt_DEPEND_WINDOWS_LIBS})
endif()
# link commom libs, and common libs need external or system libs
if(USE_COCOS_PREBUILT)
include(CocosUseLibs)
foreach(common_lib ${opt_DEPEND_COMMON_LIBS})
message(STATUS "${app_name} prepare to link engine lib: ${common_lib}")
cocos_use_pkg(${app_name} ${_${common_lib}_prefix})
if(common_lib STREQUAL "cocos2d")
target_use_cocos2d_depend_libs(${app_name})
elseif(common_lib STREQUAL "jscocos2d")
target_use_jscocos2d_depend_libs(${app_name})
elseif(common_lib STREQUAL "luacocos2d")
target_use_luacocos2d_depend_libs(${app_name})
elseif(common_lib STREQUAL "simulator")
target_use_simulator_depend_libs(${app_name})
endif()
endforeach()
else()
foreach(common_lib ${opt_DEPEND_COMMON_LIBS})
target_link_libraries(${app_name} ${common_lib})
add_dependencies(${app_name} ${common_lib})
endforeach()
endif()
if(LINUX)
foreach(_pkg ${opt_LINUX_USE_PKGS})
cocos_use_pkg(${app_name} ${_pkg})
endforeach()
endif()
foreach(_pkg ${opt_COMMON_USE_PKGS})
cocos_use_pkg(${app_name} ${_pkg})
endforeach()
# auto mark code files for IDE when mark app
if(XCODE OR VS)
cocos_mark_code_files(${APP_NAME})
endif()
# generate prebuilt auto when build app if GEN_COCOS_PREBUILT=ON
# tocheck, do we really need prebuilt cocos2dx libs?
if(GEN_COCOS_PREBUILT)
add_dependencies(${APP_NAME} prebuilt)
endif()
@ -440,13 +383,13 @@ function(cocos_use_pkg target pkg)
# message(STATUS "${target} add dll: ${_dlls}")
get_property(pre_dlls
TARGET ${target}
PROPERTY DEPEND_DLLS)
PROPERTY CC_DEPEND_DLLS)
if(pre_dlls)
set(_dlls ${pre_dlls} ${_dlls})
endif()
set_property(TARGET ${target}
PROPERTY
DEPEND_DLLS ${_dlls}
CC_DEPEND_DLLS ${_dlls}
)
endif()
endif()

View File

@ -1,208 +0,0 @@
# header files third libiary needed, such as tinyxml2.h
include_directories(
${COCOS2DX_ROOT_PATH}
${COCOS2DX_ROOT_PATH}/cocos
${COCOS2DX_ROOT_PATH}/deprecated
${COCOS2DX_ROOT_PATH}/cocos/platform
${COCOS2DX_ROOT_PATH}/extensions
${COCOS2DX_ROOT_PATH}/external
${COCOS2DX_ROOT_PATH}/external/uv/include
)
# desktop platforms
if(LINUX OR MACOSX OR WINDOWS)
cocos_find_package(OpenGL OPENGL REQUIRED)
cocos_find_package(SQLite3 SQLITE3 REQUIRED)
if(LINUX OR WINDOWS)
cocos_find_package(GLEW GLEW REQUIRED)
include_directories(${GLEW_INCLUDE_DIRS})
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(FMOD FMOD REQUIRED)
cocos_find_package(Fontconfig FONTCONFIG REQUIRED)
cocos_find_package(GTK3 GTK3 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)
# Recast (not prebuilded, exists as source)
if(USE_RECAST)
if(USE_EXTERNAL_PREBUILT)
set(_recast_prefix RECAST)
set(RECAST_INCLUDE_DIRS ${COCOS2DX_ROOT_PATH}/external/recast)
if(USE_COCOS_PREBUILT)
cocos_find_prebuilt_lib_by_name(recast RECAST_LIBRARIES)
else()
add_subdirectory(${COCOS2DX_ROOT_PATH}/external/recast ${ENGINE_BINARY_PATH}/external/recast)
set(RECAST_LIBRARIES recast)
endif()
else()
cocos_find_package(recast RECAST REQUIRED)
set(RECAST_LIBRARIES recast)
endif()
message(STATUS "Recast include dirs: ${RECAST_INCLUDE_DIRS}")
add_definitions(-DCC_USE_NAVMESH=1)
else(USE_RECAST)
add_definitions(-DCC_USE_NAVMESH=0)
endif(USE_RECAST)
# Tinyxml2 (not prebuilded, exists as source)
if(USE_EXTERNAL_PREBUILT)
set(_tinyxml2_prefix TinyXML2)
set(TinyXML2_INCLUDE_DIRS ${COCOS2DX_ROOT_PATH}/external/tinyxml2)
if(USE_COCOS_PREBUILT)
cocos_find_prebuilt_lib_by_name(tinyxml2 TinyXML2_LIBRARIES)
else()
add_subdirectory(${COCOS2DX_ROOT_PATH}/external/tinyxml2 ${ENGINE_BINARY_PATH}/external/tinyxml2)
set(TinyXML2_LIBRARIES tinyxml2)
endif()
else()
cocos_find_package(TinyXML2 TinyXML2 REQUIRED)
endif()
message(STATUS "TinyXML2 include dirs: ${TinyXML2_INCLUDE_DIRS}")
if(NOT IOS)
cocos_find_package(ZLIB ZLIB REQUIRED)
endif()
if(IOS)
cocos_find_package(SQLite3 SQLITE3 REQUIRED)
endif(IOS)
if(ANDROID)
set(_pvmp3dec_prefix PVMP3DEC)
set(PVMP3DEC_INCLUDE_DIRS ${COCOS2DX_ROOT_PATH}/external/android-specific/pvmp3dec/include ${COCOS2DX_ROOT_PATH}/external/android-specific/pvmp3dec/src)
if(USE_COCOS_PREBUILT)
cocos_find_prebuilt_lib_by_name(pvmp3dec PVMP3DEC_LIBRARIES)
else()
add_subdirectory(${COCOS2DX_ROOT_PATH}/external/android-specific/pvmp3dec ${ENGINE_BINARY_PATH}/external/android-specific/pvmp3dec)
set(PVMP3DEC_LIBRARIES pvmp3dec)
endif()
message(STATUS "pvmp3dec include dirs: ${PVMP3DEC_INCLUDE_DIRS}")
set(_tremolo_prefix TREMOLO)
set(TREMOLO_INCLUDE_DIRS ${COCOS2DX_ROOT_PATH}/external/android-specific/tremolo)
if(USE_COCOS_PREBUILT)
cocos_find_prebuilt_lib_by_name(tremolo TREMOLO_LIBRARIES)
else()
add_subdirectory(${COCOS2DX_ROOT_PATH}/external/android-specific/tremolo ${ENGINE_BINARY_PATH}/external/android-specific/tremolo)
set(TREMOLO_LIBRARIES tremolo)
endif()
message(STATUS "Tremolo include dirs: ${TREMOLO_INCLUDE_DIRS}")
set(_cpufeatures_prefix CPUFEATURES)
if(USE_COCOS_PREBUILT)
cocos_find_prebuilt_lib_by_name(cpufeatures CPUFEATURES_LIBRARIES)
else()
include(AndroidNdkModules)
android_ndk_import_module_cpufeatures()
set_target_properties(cpufeatures
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
)
set(CPUFEATURES_LIBRARIES cpufeatures)
endif()
endif()
# 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_EXTERNAL_PREBUILT)
set(_unzip_prefix MINIZIP)
include_directories(${ZLIB_INCLUDE_DIRS})
set(MINIZIP_INCLUDE_DIRS ${COCOS2DX_ROOT_PATH}/external/unzip ${ZLIB_INCLUDE_DIRS})
if(USE_COCOS_PREBUILT)
cocos_find_prebuilt_lib_by_name(unzip MINIZIP_LIBRARIES)
else()
add_subdirectory(${COCOS2DX_ROOT_PATH}/external/unzip ${ENGINE_BINARY_PATH}/external/unzip)
# set(MINIZIP_LIBRARIES unzip ${ZLIB_LIBRARIES})
set(MINIZIP_LIBRARIES unzip)
endif()
message(STATUS "MINIZIP include dirs: ${MINIZIP_INCLUDE_DIRS}")
else()
cocos_find_package(MINIZIP MINIZIP REQUIRED)
# double check that we have needed functions
include(CheckLibraryExists)
add_definitions(-DMINIZIP_FROM_SYSTEM)
endif()
# Jpeg
if(USE_JPEG)
cocos_find_package(JPEG JPEG REQUIRED)
add_definitions(-DCC_USE_JPEG=1)
else(USE_JPEG)
add_definitions(-DCC_USE_JPEG=0)
endif(USE_JPEG)
# Tiff
if(USE_TIFF)
cocos_find_package(TIFF TIFF REQUIRED)
add_definitions(-DCC_USE_TIFF=1)
else(USE_TIFF)
add_definitions(-DCC_USE_TIFF=0)
endif(USE_TIFF)
# Png
if(USE_PNG)
cocos_find_package(PNG PNG REQUIRED)
add_definitions(-DCC_USE_PNG=1)
else(USE_PNG)
add_definitions(-DCC_USE_PNG=0)
endif(USE_PNG)
cocos_find_package(WEBSOCKETS WEBSOCKETS REQUIRED)
cocos_find_package(CURL CURL REQUIRED)
if(NOT USE_EXTERNAL_PREBUILT)
cocos_find_package(OpenSSL OPENSSL REQUIRED)
endif()
# flatbuffers
if(USE_EXTERNAL_PREBUILT)
set(_flatbuffers_prefix FLATBUFFERS)
set(FLATBUFFERS_INCLUDE_DIRS ${COCOS2DX_ROOT_PATH}/external)
if(USE_COCOS_PREBUILT)
cocos_find_prebuilt_lib_by_name(flatbuffers FLATBUFFERS_LIBRARIES)
else()
add_subdirectory(${COCOS2DX_ROOT_PATH}/external/flatbuffers ${ENGINE_BINARY_PATH}/external/flatbuffers)
set(FLATBUFFERS_LIBRARIES flatbuffers)
endif()
message(STATUS "Flatbuffers include dirs: ${FLATBUFFERS_INCLUDE_DIRS}")
else()
cocos_find_package(flatbuffers FLATBUFFERS REQUIRED)
endif()
# xxhash
if(USE_EXTERNAL_PREBUILT)
set(_xxhash_prefix XXHASH)
set(XXHASH_INCLUDE_DIRS ${COCOS2DX_ROOT_PATH}/external/xxhash)
if(USE_COCOS_PREBUILT)
cocos_find_prebuilt_lib_by_name(xxhash XXHASH_LIBRARIES)
else()
add_subdirectory(${COCOS2DX_ROOT_PATH}/external/xxhash ${ENGINE_BINARY_PATH}/external/xxhash)
set(XXHASH_LIBRARIES xxhash)
endif()
message(STATUS "xxhash include dirs: ${XXHASH_INCLUDE_DIRS}")
else()
cocos_find_package(xxhash xxhash REQUIRED)
endif()

View File

@ -6,6 +6,14 @@ if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
")
endif()
# print cmake debug info
set(CMAKE_DEBUG_TARGET_PROPERTIES
# INCLUDE_DIRECTORIES
# COMPILE_DEFINITIONS
# POSITION_INDEPENDENT_CODE
# CONTAINER_SIZE_REQUIRED
# LIB_VERSION
)
# It ensures that when Find*.cmake files included from cmake's Modules dir
# include another *.cmake file with relative path, that file will be included
# also from cmake's Modules dir, to not clash with per-project files.
@ -38,8 +46,4 @@ include(CocosSelectModule)
# set common compiler options
include(CocosCompileOptions)
# collect prebuilt libraries
include(CocosPickLibs)
# compile source libraries
include(CocosBuildModules)
include(CocosConfigDepend)

View File

@ -110,6 +110,7 @@
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
if(LINUX)
add_definitions(-D_GNU_SOURCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -lrt")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -lrt")
endif()
@ -177,11 +178,6 @@
else()
message(FATAL_ERROR "using Windows MSVC generate cocos2d-x project, MSVC_VERSION:${MSVC_VERSION} lower than needed")
endif()
define_property(TARGET
PROPERTY DEPEND_DLLS
BRIEF_DOCS "depend dlls of a target"
FULL_DOCS "use to save depend dlls of a target"
)
else()
message(FATAL_ERROR "please using Windows MSVC compile cocos2d-x project, support other compile tools not yet")
endif()
@ -219,3 +215,21 @@
message(FATAL_ERROR "can't find prebuilt libs location")
endif()
endif()
# custom target property for dll collect
define_property(TARGET
PROPERTY CC_DEPEND_DLLS
BRIEF_DOCS "depend dlls of a target"
FULL_DOCS "use to save depend dlls of a target"
)
# custom target property for lua/js link
define_property(TARGET
PROPERTY CC_JS_DEPEND
BRIEF_DOCS "cocos2d js depend libs"
FULL_DOCS "use to save depend libs of cocos2d js project"
)
define_property(TARGET
PROPERTY CC_LUA_DEPEND
BRIEF_DOCS "cocos2d lua depend libs"
FULL_DOCS "use to save depend libs of cocos2d lua project"
)

View File

@ -1,26 +1,26 @@
macro(cocos2d_depend_libs)
macro(cocos2dx_depend)
# confim the libs, prepare to link
set(PLATFORM_SPECIFIC_LIBS)
# confim the prebuilt libs, prepare to use
set(PREBUILT_SPECIFIC_LIBS)
if(WINDOWS)
foreach(_pkg OPENGL GLEW GLFW3 VORBIS MPG123 OPENAL SQLITE3)
list(APPEND PREBUILT_SPECIFIC_LIBS ${_pkg})
endforeach()
list(APPEND PLATFORM_SPECIFIC_LIBS ws2_32 userenv psapi winmm Version Iphlpapi)
if(MINGW)
list(APPEND PLATFORM_SPECIFIC_LIBS shlwapi version)
endif()
list(APPEND PLATFORM_SPECIFIC_LIBS ws2_32 userenv psapi winmm Version Iphlpapi opengl32)
elseif(LINUX)
# need review those libs: X11 Xi Xrandr Xxf86vm Xinerama Xcursor rt m
list(APPEND PLATFORM_SPECIFIC_LIBS dl X11 Xi Xrandr Xxf86vm Xinerama Xcursor rt m)
foreach(_pkg OPENGL GLEW GLFW3 FMOD FONTCONFIG THREADS GTK3 SQLITE3)
list(APPEND PREBUILT_SPECIFIC_LIBS ${_pkg})
endforeach()
# use older cmake style on below linux libs
cocos_find_package(Fontconfig FONTCONFIG REQUIRED)
cocos_find_package(GTK3 GTK3 REQUIRED)
cocos_find_package(ZLIB ZLIB REQUIRED)
cocos_find_package(PNG PNG REQUIRED)
cocos_find_package(GLEW GLEW REQUIRED)
cocos_find_package(OpenGL OPENGL REQUIRED)
cocos_find_package(CURL CURL REQUIRED)
cocos_find_package(SQLite3 SQLITE3 REQUIRED)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)
set(THREADS_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
elseif(ANDROID)
list(APPEND PLATFORM_SPECIFIC_LIBS GLESv2 EGL log android OpenSLES)
list(APPEND PREBUILT_SPECIFIC_LIBS TREMOLO PVMP3DEC CPUFEATURES)
elseif(APPLE)
include_directories(/System/Library/Frameworks)
@ -39,6 +39,11 @@ macro(cocos2d_depend_libs)
${GAMECONTROLLER_LIBRARY}
)
if(BUILD_JS_LIBS)
find_library(SQLITE3_LIBRARY SQLite3)
list(APPEND COCOS_APPLE_LIBS ${SQLITE3_LIBRARY})
endif()
if(MACOSX)
list(APPEND PREBUILT_SPECIFIC_LIBS GLFW3)
@ -46,12 +51,14 @@ macro(cocos2d_depend_libs)
find_library(OPENGL_LIBRARY OpenGL)
find_library(APPLICATIONSERVICES_LIBRARY ApplicationServices)
find_library(IOKIT_LIBRARY IOKit)
find_library(APPKIT_LIBRARY AppKit)
list(APPEND PLATFORM_SPECIFIC_LIBS
${COCOA_LIBRARY}
${OPENGL_LIBRARY}
${APPLICATIONSERVICES_LIBRARY}
${IOKIT_LIBRARY}
${COCOS_APPLE_LIBS}
${APPKIT_LIBRARY}
)
elseif(IOS)
# Locate system libraries on iOS
@ -78,150 +85,79 @@ macro(cocos2d_depend_libs)
)
endif()
endif()
endmacro()
foreach(_pkg ZLIB MINIZIP TinyXML2 FREETYPE WEBSOCKETS CURL FLATBUFFERS XXHASH UV)
list(APPEND PREBUILT_SPECIFIC_LIBS ${_pkg})
endforeach()
if(NOT EMSCRIPTEN)
list(APPEND PREBUILT_SPECIFIC_LIBS OPENSSL)
endif()
macro(cocos2dx_define)
if(USE_JPEG)
add_definitions(-DCC_USE_JPEG=1)
list(APPEND PREBUILT_SPECIFIC_LIBS JPEG)
else()
add_definitions(-DCC_USE_JPEG=0)
endif()
if(USE_WEBP)
cocos_find_package(WebP WEBP REQUIRED)
add_definitions(-DCC_USE_WEBP=1)
list(APPEND PREBUILT_SPECIFIC_LIBS WEBP)
else()
add_definitions(-DCC_USE_WEBP=0)
endif()
if(USE_TIFF)
add_definitions(-DCC_USE_TIFF=1)
list(APPEND PREBUILT_SPECIFIC_LIBS TIFF)
else()
add_definitions(-DCC_USE_TIFF=0)
endif()
if(USE_PNG)
add_definitions(-DCC_USE_PNG=1)
list(APPEND PREBUILT_SPECIFIC_LIBS PNG)
else()
add_definitions(-DCC_USE_PNG=0)
endif()
if(USE_CHIPMUNK)
cocos_find_package(Chipmunk CHIPMUNK REQUIRED)
add_definitions(-DCC_USE_PHYSICS=1)
add_definitions(-DCC_ENABLE_CHIPMUNK_INTEGRATION=1)
list(APPEND PREBUILT_SPECIFIC_LIBS CHIPMUNK)
else()
add_definitions(-DCC_USE_PHYSICS=0)
add_definitions(-DCC_ENABLE_CHIPMUNK_INTEGRATION=0)
endif()
if(USE_BOX2D)
cocos_find_package(box2d Box2D REQUIRED)
add_definitions(-DCC_ENABLE_BOX2D_INTEGRATION=1)
list(APPEND PREBUILT_SPECIFIC_LIBS Box2D)
else()
add_definitions(-DCC_ENABLE_BOX2D_INTEGRATION=0)
endif(USE_BOX2D)
if(USE_BULLET)
cocos_find_package(bullet BULLET REQUIRED)
add_definitions(-DCC_USE_3D_PHYSICS=1)
add_definitions(-DCC_ENABLE_BULLET_INTEGRATION=1)
list(APPEND PREBUILT_SPECIFIC_LIBS BULLET)
else(USE_BULLET)
add_definitions(-DCC_USE_3D_PHYSICS=0)
add_definitions(-DCC_ENABLE_BULLET_INTEGRATION=0)
endif(USE_BULLET)
if(USE_RECAST)
list(APPEND PREBUILT_SPECIFIC_LIBS RECAST)
endif()
# tocheck, libuv option
add_definitions(-DLWS_WITH_LIBUV)
endmacro()
add_definitions(-DLWS_WITH_LIBUV)
macro(target_use_cocos2d_depend_libs target)
cocos2d_depend_libs()
message(STATUS "${target} prepare to use cpp needed libs: ${PREBUILT_SPECIFIC_LIBS}")
foreach(prebuilt_lib ${PREBUILT_SPECIFIC_LIBS})
cocos_use_pkg(${target} ${prebuilt_lib})
endforeach()
macro(target_use_cocos2dx_depend target)
cocos2dx_depend()
cocos2dx_define()
message(STATUS "${target} prepare to use system depend: ${PLATFORM_SPECIFIC_LIBS}")
foreach(platform_lib ${PLATFORM_SPECIFIC_LIBS})
target_link_libraries(${target} ${platform_lib})
endforeach()
endmacro()
macro(jscocos2d_depend_libs)
set(PLATFORM_SPECIFIC_LIBS)
set(PREBUILT_SPECIFIC_LIBS)
list(APPEND PREBUILT_SPECIFIC_LIBS SPIDERMONKEY)
if(APPLE)
list(APPEND PREBUILT_SPECIFIC_LIBS SQLITE3)
if(LINUX)
cocos_use_pkg(${target} FONTCONFIG)
cocos_use_pkg(${target} GTK3)
cocos_use_pkg(${target} ZLIB)
cocos_use_pkg(${target} PNG)
cocos_use_pkg(${target} GLEW)
cocos_use_pkg(${target} OPENGL)
cocos_use_pkg(${target} CURL)
cocos_use_pkg(${target} THREADS)
cocos_use_pkg(${target} SQLITE3)
endif()
endmacro()
macro(target_use_jscocos2d_depend_libs target)
jscocos2d_depend_libs()
message(STATUS "${target} prepare to use js needed libs: ${PREBUILT_SPECIFIC_LIBS}")
foreach(prebuilt_lib ${PREBUILT_SPECIFIC_LIBS})
cocos_use_pkg(${target} ${prebuilt_lib})
endforeach()
foreach(platform_lib ${PLATFORM_SPECIFIC_LIBS})
target_link_libraries(${target} ${platform_lib})
endforeach()
endmacro()
macro(luacocos2d_depend_libs)
set(PLATFORM_SPECIFIC_LIBS)
set(PREBUILT_SPECIFIC_LIBS)
list(APPEND PREBUILT_SPECIFIC_LIBS LUAJIT)
endmacro()
macro(target_use_luacocos2d_depend_libs target)
luacocos2d_depend_libs()
message(STATUS "${target} prepare to use lua needed libs: ${PREBUILT_SPECIFIC_LIBS}")
foreach(prebuilt_lib ${PREBUILT_SPECIFIC_LIBS})
cocos_use_pkg(${target} ${prebuilt_lib})
endforeach()
foreach(platform_lib ${PLATFORM_SPECIFIC_LIBS})
target_link_libraries(${target} ${platform_lib})
endforeach()
endmacro()
macro(simulator_depend_libs)
set(PLATFORM_SPECIFIC_LIBS)
set(PREBUILT_SPECIFIC_LIBS)
if(MACOSX)
include_directories(/System/Library/Frameworks)
find_library(APPKIT_LIBRARY AppKit)
list(APPEND PLATFORM_SPECIFIC_LIBS ${APPKIT_LIBRARY})
elseif(WINDOWS)
list(APPEND PREBUILT_SPECIFIC_LIBS TinyXML2 CURL)
endif()
endmacro()
macro(target_use_simulator_depend_libs target)
simulator_depend_libs()
if(WINDOWS)
message(STATUS "${target} prepare to use simulator needed libs: ${PREBUILT_SPECIFIC_LIBS}")
endif()
foreach(prebuilt_lib ${PREBUILT_SPECIFIC_LIBS})
cocos_use_pkg(${target} ${prebuilt_lib})
endforeach()
foreach(platform_lib ${PLATFORM_SPECIFIC_LIBS})
target_link_libraries(${target} ${platform_lib})
endforeach()
endmacro()

View File

@ -1,319 +0,0 @@
# CocosPickLibs - sets external libs variables to link with
# START CONFIG
# record all the prebuilt libs which found for specific platform
set(COCOS_EXTERNAL_LIBS)
# Debug build use debug folder libs, Release build use release folder libs
string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE_FOLDER)
# RelWithDebInfo is one of Visual Studio 2017 default build type
if(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
# RelWithDebInfo build use release folder libs
set(BUILD_TYPE_FOLDER "release")
endif()
set(_chipmunk_inc chipmunk/chipmunk.h)
set(_chipmunk_inc_paths include)
if(WINDOWS)
if(MSVC)
set(_chipmunk_libs chipmunk libchipmunk libchipmunk-2015)
else()
set(_chipmunk_libs chipmunk libchipmunk)
endif()
else()
set(_chipmunk_libs chipmunk libchipmunk)
endif(WINDOWS)
set(_bullet_inc bullet/Bullet-C-Api.h BulletCollision/btBulletCollisionCommon.h)
set(_bullet_inc_paths bullet)
# sequence is important
set(_bullet_libs BulletDynamics libBulletDynamics BulletCollision libBulletCollision BulletMultiThreaded libBulletMultiThreaded LinearMath libLinearMath MiniCL libMiniCL)
if(MSVC)
set(_bullet_libs bullet libbullet)
endif()
set(_Box2D_inc Box2D/Box2D.h)
set(_Box2D_inc_paths include)
set(_Box2D_libs box2d libbox2d)
set(_Box2D_prefix Box2D)
set(_glfw3_inc glfw3.h glfw3native.h)
set(_glfw3_libs glfw3 libglfw3)
set(_curl_inc curl/curl.h)
# order: curl, ssl, crypto
set(_curl_libs curl libcurl_imp libcurl ssl libeay32 ssleay32 crypto)
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)
if(WINDOWS)
if(MSVC)
set(_jpeg_libs jpeg libjpeg libjpeg-2015)
else()
set(_jpeg_libs jpeg libjpeg)
endif()
else()
set(_jpeg_libs jpeg libjpeg)
endif(WINDOWS)
set(_png_inc png.h)
if(WINDOWS)
if(MSVC)
set(_png_libs png libpng libpng-2015)
else()
set(_png_libs png libpng)
endif()
else()
set(_png_libs png libpng)
endif(WINDOWS)
set(_tiff_inc tiff.h)
if(WINDOWS)
if(MSVC)
set(_tiff_libs tiff libtiff libtiff-2015)
else()
set(_tiff_libs tiff libtiff)
endif()
else()
set(_tiff_libs tiff libtiff)
endif(WINDOWS)
set(_webp_inc decode.h)
set(_webp_libs webp libwebp)
set(_websockets_inc libwebsockets.h)
set(_websockets_libs websockets libwebsockets)
set(_openssl_inc openssl/ssl.h)
set(_openssl_libs ssl crypto)
if(MSVC)
set(_openssl_libs ssl crypto libssl libcrypto)
endif()
set(_sqlite3_inc sqlite3.h)
set(_sqlite3_libs sqlite3)
set(_gles_prefix GLEW)
set(_gles_inc GL/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 z libzlib libz)
if(MSVC)
set(_zlib_libs libzlib)
# zlib's dll is so special, lib name and dll name is different
# single special
set(_zlib_dll zlib1)
endif()
set(_fmod_prefix FMOD)
set(_fmod_inc fmod.hpp)
set(_fmod_libs fmod fmod64 fmod fmod64)
set(_luajit_prefix LUAJIT)
set(_luajit_inc lua.hpp)
set(_luajit_libs luajit)
if(MSVC)
set(_luajit_libs lua51)
endif()
set(_spidermonkey_prefix SPIDERMONKEY)
set(_spidermonkey_inc jsapi.h)
set(_spidermonkey_libs js_static)
if(MSVC)
set(_spidermonkey_libs mozjs-33)
endif()
set(_uv_inc uv.h)
set(_uv_libs uv_a libuv uv)
set(all_prebuilt_libs
chipmunk
curl
freetype2
jpeg
png
tiff
webp
websockets
openssl
bullet
Box2D
luajit
spidermonkey
uv
)
if(MACOSX)
list(APPEND all_prebuilt_libs glfw3 zlib)
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 glfw3)
endif()
if(ANDROID)
list(APPEND all_prebuilt_libs zlib)
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)
set(_${_lib}_prefix ${_prefix})
endif()
set(roots
${COCOS_EXTERNAL_DIR}/${_lib}
${COCOS_EXTERNAL_DIR}/${PLATFORM_FOLDER}-specific/${_lib}
#lua/luajit
${COCOS_EXTERNAL_DIR}/lua/${_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 NO_CMAKE_FIND_ROOT_PATH)
if(_inc_tmp)
list(APPEND include_dirs ${_inc_tmp})
endif()
endforeach()
endif(EXISTS ${_dir})
endforeach()
if(include_dirs)
list(REMOVE_DUPLICATES include_dirs)
set(${_prefix}_INCLUDE_DIRS ${include_dirs} CACHE PATH "Path to includes for ${_prefix}" FORCE)
message(STATUS "${_lib} ${_prefix}_INCLUDE_DIRS: ${${_prefix}_INCLUDE_DIRS}")
# don't find lib, if not find include in once ${_root} search
set(lib_dir_candidates
${_root}/prebuilt/${PLATFORM_FOLDER}
${_root}/prebuilt/${PLATFORM_FOLDER}/${BUILD_TYPE_FOLDER}
${_root}/prebuilt/${PLATFORM_FOLDER}/${BUILD_TYPE_FOLDER}-lib
${_root}/libraries/${PLATFORM_FOLDER}
${_root}/prebuilt
)
if(ANDROID_ABI)
list(APPEND lib_dir_candidates ${_root}/prebuilt/${PLATFORM_FOLDER}/${ANDROID_ABI})
endif()
if(ARCH_DIR)
list(APPEND lib_dir_candidates ${_root}/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR})
list(APPEND lib_dir_candidates ${_root}/prebuilt/${ARCH_DIR})
endif()
set(libs)
set(dlls)
foreach(_dir ${lib_dir_candidates})
if(EXISTS ${_dir})
# find all libs
foreach(_lib_name ${_${_lib}_libs})
find_library(_lib_tmp ${_lib_name} PATHS ${_dir} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
if(_lib_tmp)
list(APPEND libs ${_lib_tmp})
#find dlls for _lib_tmp
if(MSVC)
cocos_find_dlls_for_lib(_dll_tmp LIB_ABS_PATH ${_lib_tmp})
endif()
list(APPEND dlls ${_dll_tmp})
unset(_dll_tmp CACHE)
endif()
unset(_lib_tmp CACHE)
endforeach()
endif(EXISTS ${_dir})
endforeach()
if(libs)
set(${_prefix}_LIBRARIES ${libs} CACHE STRING "Libraries to link for ${_prefix}" FORCE)
message(STATUS "${_lib} ${_prefix}_LIBRARIES: ${${_prefix}_LIBRARIES}")
endif()
if(MSVC)
if(dlls)
# remove repeat items
list(REMOVE_DUPLICATES dlls)
# set dlls into var ${_prefix}_DLLS
set(${_prefix}_DLLS ${dlls} CACHE STRING "dlls to link for ${_prefix}" FORCE)
message(STATUS "${_lib} ${_prefix}_DLLS: ${${_prefix}_DLLS}")
endif(dlls)
endif()
if(${_prefix}_LIBRARIES AND ${_prefix}_INCLUDE_DIRS)
set(${_prefix}_FOUND YES)
list(APPEND COCOS_EXTERNAL_LIBS ${${_prefix}_LIBRARIES})
endif()
endif()
endif(EXISTS ${_root})
endforeach()
endforeach()
# use engine prebuilt libs, try to pick all engine libs
if(USE_COCOS_PREBUILT)
# cocos2d/jscocos2d/luacocos2d
set(_cocos2d_prefix COCOS2D)
cocos_find_prebuilt_lib_by_name(cocos2d COCOS2D_LIBRARIES)
set(_jscocos2d_prefix JSCOCOS2D)
cocos_find_prebuilt_lib_by_name(jscocos2d JSCOCOS2D_LIBRARIES)
set(_luacocos2d_prefix LUACOCOS2D)
cocos_find_prebuilt_lib_by_name(luacocos2d LUACOCOS2D_LIBRARIES)
set(_simulator_prefix SIMULATOR)
cocos_find_prebuilt_lib_by_name(simulator SIMULATOR_LIBRARIES)
if(ANDROID)
set(_cocos2d_android_prefix ANDROID_COCOS2D)
cocos_find_prebuilt_lib_by_name(cocos2d_android ANDROID_COCOS2D_LIBRARIES)
endif()
endif(USE_COCOS_PREBUILT)

View File

@ -1,10 +1,3 @@
include_directories(
../external/ConvertUTF
../external/poly2tri
../external/poly2tri/common
../external/poly2tri/sweep
)
set(COCOS_2D_HEADER
2d/CCActionPageTurn3D.h
@ -144,7 +137,6 @@ set(COCOS_2D_SRC
2d/CCSpriteFrameCache.cpp
2d/CCSpriteFrame.cpp
2d/CCAutoPolygon.cpp
../external/clipper/clipper.cpp
2d/CCTextFieldTTF.cpp
2d/CCTileMapAtlas.cpp
2d/CCTMXLayer.cpp

View File

@ -113,17 +113,27 @@ set(COCOS_SRC cocos2d.cpp
${COCOS_STORAGE_SRC}
)
#todo: provide prebuild versions of the xx libs for all platforms
include_directories(../external/xxtea)
include_directories(../external/clipper)
list(APPEND COCOS_SRC ${COCOS_HEADER})
add_library(cocos2d ${COCOS_SRC})
# use necessary external libs and system libs
include(CocosUseLibs)
target_use_cocos2d_depend_libs(cocos2d)
# use external libs
add_subdirectory(${COCOS2DX_ROOT_PATH}/external ${ENGINE_BINARY_PATH}/external)
target_link_libraries(cocos2d external)
# use all platform related system libs
target_use_cocos2dx_depend(cocos2d)
target_include_directories(cocos2d
PUBLIC ${COCOS2DX_ROOT_PATH}
PUBLIC ${COCOS2DX_ROOT_PATH}/cocos
PUBLIC ${COCOS2DX_ROOT_PATH}/extensions
PUBLIC ${COCOS2DX_ROOT_PATH}/cocos/platform
INTERFACE ${COCOS2DX_ROOT_PATH}/cocos/base
INTERFACE ${COCOS2DX_ROOT_PATH}/cocos/editor-support
INTERFACE ${COCOS2DX_ROOT_PATH}/cocos/audio/include
INTERFACE ${COCOS2DX_ROOT_PATH}/cocos/platform/${PLATFORM_FOLDER}
)
set_target_properties(cocos2d
PROPERTIES
@ -133,32 +143,6 @@ set_target_properties(cocos2d
FOLDER "Internal"
)
# set custom target: prebuilt, to copy all libs to prebuilt libs folder
if(GEN_COCOS_PREBUILT)
add_custom_target(prebuilt ALL)
add_dependencies(prebuilt cocos2d)
set_target_properties(prebuilt
PROPERTIES
FOLDER "Internal"
)
add_custom_command(TARGET "prebuilt"
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_BINARY_DIR}/lib"
"${COCOS_PREBUILT_PATH}"
COMMENT "copy library directory:${CMAKE_BINARY_DIR}/lib to directory:${COCOS_PREBUILT_PATH}"
)
if(BUILD_LUA_LIBS)
add_dependencies(prebuilt luacocos2d)
endif()
if(BUILD_JS_LIBS)
add_dependencies(prebuilt jscocos2d)
endif()
if(BUILD_SIMU_LIB AND (MACOSX OR WINDOWS))
add_dependencies(prebuilt simulator)
endif()
endif()
## Lua bindings lib
if(BUILD_LUA_LIBS)
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/scripting/lua-bindings ${ENGINE_BINARY_PATH}/cocos/lua-bindings)
@ -167,10 +151,6 @@ endif()
if(BUILD_JS_LIBS)
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/scripting/js-bindings ${ENGINE_BINARY_PATH}/cocos/js-bindings)
endif()
# simulator
if(BUILD_SIMU_LIB AND (MACOSX OR WINDOWS))
add_subdirectory(${COCOS2DX_ROOT_PATH}/tools/simulator/libsimulator ${ENGINE_BINARY_PATH}/cocos/libsimulator)
endif()
if(XCODE OR VS)
cocos_mark_code_files("cocos2d")

View File

@ -1,27 +0,0 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
static void making_cmake_happy(void)
{
}

View File

@ -22,7 +22,16 @@
# THE SOFTWARE.
# ****************************************************************************/
if(WINDOWS)
if(ANDROID)
# refer to target: cocos/platform/android/CMakeLists.txt
set(COCOS_PLATFORM_SPECIFIC_SRC
platform/android/CCApplication-android.cpp
platform/android/CCCommon-android.cpp
platform/android/CCGLViewImpl-android.cpp
platform/android/CCFileUtils-android.cpp
platform/android/CCEnhanceAPI-android.cpp
)
elseif(WINDOWS)
set(COCOS_PLATFORM_SPECIFIC_HEADER
platform/win32/compat/stdint.h
platform/win32/CCApplication-win32.h
@ -126,68 +135,8 @@ elseif(LINUX)
platform/linux/CCDevice-linux.cpp
platform/desktop/CCGLViewImpl-desktop.cpp
)
elseif(ANDROID)
set(COCOS_PLATFORM_SPECIFIC_HEADER
platform/android/CCApplication-android.h
platform/android/CCStdC-android.h
platform/android/CCFileUtils-android.h
platform/android/CCEnhanceAPI-android.h
platform/android/CCPlatformDefine-android.h
platform/android/CCGLViewImpl-android.h
platform/android/jni/ProcessCpuTracker.h
platform/android/jni/JniHelper.h
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.h
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.h
platform/android/CCGL-android.h
)
# need move to COCOS2DX_ANDROID_SRC?
# need refactor
set(COCOS_PLATFORM_SPECIFIC_SRC
platform/android/CCApplication-android.cpp
platform/android/CCCommon-android.cpp
platform/android/CCGLViewImpl-android.cpp
platform/android/CCFileUtils-android.cpp
platform/android/CCEnhanceAPI-android.cpp
platform/android/jni/JniHelper.cpp
)
set(COCOS2DX_ANDROID_SRC
platform/android/CCDevice-android.cpp
platform/android/javaactivity-android.cpp
platform/android/jni/TouchesJni.cpp
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxAccelerometer.cpp
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.cpp
)
add_library(cocos2d_android STATIC ${COCOS2DX_ANDROID_SRC})
set_property(TARGET cocos2d_android PROPERTY POSITION_INDEPENDENT_CODE TRUE)
set_target_properties(cocos2d_android
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
VERSION "${COCOS2D_X_VERSION}"
)
endif()
#leave andatory external stuff here also
include_directories(
../external
../external/ConvertUTF
../external/edtaa3func
../external/poly2tri
../external/poly2tri/common
../external/poly2tri/sweep
)
set(COCOS_PLATFORM_HEADER
${COCOS_PLATFORM_SPECIFIC_HEADER}
platform/CCApplication.h
@ -213,13 +162,4 @@ set(COCOS_PLATFORM_SRC
platform/CCGLView.cpp
platform/CCFileUtils.cpp
platform/CCImage.cpp
../external/edtaa3func/edtaa3func.cpp
../external/ConvertUTF/ConvertUTFWrapper.cpp
../external/ConvertUTF/ConvertUTF.c
../external/md5/md5.c
../external/poly2tri/common/shapes.cc
../external/poly2tri/sweep/advancing_front.cc
../external/poly2tri/sweep/cdt.cc
../external/poly2tri/sweep/sweep_context.cc
../external/poly2tri/sweep/sweep.cc
)

View File

@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.6)
# need to whole-archive this lib
set(target_name cpp_android_spec)
project(${target_name})
set(${target_name}_src
CCDevice-android.cpp
javaactivity-android.cpp
jni/JniHelper.cpp
jni/TouchesJni.cpp
jni/Java_org_cocos2dx_lib_Cocos2dxAccelerometer.cpp
jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp
jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp
jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp
jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.cpp
)
add_library(${target_name} STATIC
${${target_name}_src}
)
target_include_directories(${target_name}
PRIVATE ..
PRIVATE ../..
)

View File

@ -25,14 +25,11 @@
set(cocos_root ${COCOS2DX_ROOT_PATH})
#platform
if(WIN32) # Win32
add_definitions(-D_USRJSSTATIC)
elseif(APPLE)# osx or ios
if(APPLE)# osx or ios
set(PLATFORM_HEADER manual/platform/ios/JavaScriptObjCBridge.h)
set(PLATFORM_SRC manual/platform/ios/JavaScriptObjCBridge.mm)
elseif(ANDROID)
set(PLATFORM_HEADER manual/platform/android/CCJavascriptJavaBridge.h)
set(PLATFORM_SRC manual/platform/android/CCJavascriptJavaBridge.cpp)
# refer to: cocos/scripting/js-bindings/proj.android
endif()
if(ANDROID OR IOS)
@ -151,11 +148,6 @@ set(JSBINDING_SRC
manual/navmesh/jsb_cocos2dx_navmesh_manual.cpp
)
include_directories(
${cocos_root}/cocos/platform/${PLATFORM_FOLDER}
${cocos_root}/external/spidermonkey/include/${PLATFORM_FOLDER}
)
list(APPEND JSBINDING_SRC ${JSBINDING_HEADER} ${PLATFORM_HEADER})
add_library(jscocos2d STATIC
@ -165,8 +157,23 @@ add_library(jscocos2d STATIC
target_link_libraries(jscocos2d cocos2d)
add_dependencies(jscocos2d cocos2d)
# use necessary external libs and system libs
target_use_jscocos2d_depend_libs(jscocos2d)
get_target_property(js_ext_depend external CC_JS_DEPEND)
target_link_libraries(jscocos2d ${js_ext_depend})
target_include_directories(jscocos2d
INTERFACE ${cocos_root}/cocos/scripting/js-bindings/auto
INTERFACE ${cocos_root}/cocos/scripting/js-bindings/manual
)
# ignore part warnings on binding codes. tocheck: not take effect?
if(WINDOWS)
target_compile_definitions(jscocos2d PRIVATE _USRJSSTATIC)
else()
target_compile_options(jscocos2d PRIVATE
-Wno-deprecated
)
endif()
set_target_properties(jscocos2d
PROPERTIES

View File

@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.6)
# need to whole-archive this lib
set(target_name js_android_spec)
project(${target_name})
set(${target_name}_src
../manual/platform/android/CCJavascriptJavaBridge.cpp
)
add_library(${target_name} STATIC
${${target_name}_src}
)
get_target_property(spiderm_header ext_spidermonkey INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(${target_name}
PRIVATE ../../..
PRIVATE ../manual
PRIVATE ../manual/platform/android
PRIVATE ${spiderm_header}
)

View File

@ -1,67 +1,5 @@
set(cocos_root ${COCOS2DX_ROOT_PATH})
include_directories(
${cocos_root}/external/lua
${cocos_root}/external/lua/tolua
${cocos_root}/external/xxtea
${cocos_root}/external
${cocos_root}/cocos
${cocos_root}/cocos/editor-support
)
if(ANDROID)
include_directories(
manual/platform/android
manual/platform/android/jni
)
endif()
file(GLOB lua_cocos2d_source_files
"${cocos_root}/external/lua/tolua/*.c"
"${cocos_root}/external/xxtea/xxtea.cpp"
)
list(APPEND lua_cocos2d_source_files
${cocos_root}/external/lua/luasocket/luasocket.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)
if(MINGW)
add_definitions(-DLUASOCKET_INET_ATON -DLUASOCKET_INET_PTON)
endif()
add_definitions(-D_USRLUASTATIC)
list(APPEND lua_cocos2d_source_files
${cocos_root}/external/lua/luasocket/wsocket.c
)
elseif(UNIX OR ANDROID)
# because we have -std=c99
add_definitions(-D_POSIX_C_SOURCE=200809L)
if(LINUX OR ANDROID)
add_definitions(-D_BSD_SOURCE -D_DEFAULT_SOURCE)
endif()
if(APPLE)
add_definitions(-D_DARWIN_C_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
)
endif()
set(lua_bindings_manual_headers
manual/CCComponentLua.h
manual/3d/lua_cocos2dx_3d_manual.h
@ -203,31 +141,21 @@ if(APPLE)
elseif(ANDROID)
set(lua_bindings_manual_headers
${lua_bindings_manual_headers}
manual/platform/android/CCLuaJavaBridge.h
manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.h
auto/lua_cocos2dx_experimental_webview_auto.hpp
manual/ui/lua_cocos2dx_experimental_webview_manual.hpp
)
set(lua_bindings_manual_files
${lua_bindings_manual_files}
manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp
manual/platform/android/CCLuaJavaBridge.cpp
auto/lua_cocos2dx_experimental_webview_auto.cpp
manual/ui/lua_cocos2dx_experimental_webview_manual.cpp
)
endif()
if(USE_BULLET)
include_directories(${BULLET_INCLUDE_DIRS})
endif()
set(lua_bindings_files
${lua_cocos2d_source_files}
${lua_bindings_manual_files}
${lua_bindings_auto_files}
)
set(lua_bindings_headers
${lua_cocos2d_source_headers}
${lua_bindings_manual_headers}
${lua_bindings_auto_headers}
)
@ -238,8 +166,20 @@ add_library(luacocos2d ${lua_bindings_files})
target_link_libraries(luacocos2d cocos2d)
add_dependencies(luacocos2d cocos2d)
# use necessary external libs and system libs
target_use_luacocos2d_depend_libs(luacocos2d)
get_target_property(lua_ext_depend external CC_LUA_DEPEND)
target_link_libraries(luacocos2d ${lua_ext_depend})
target_include_directories(luacocos2d
PRIVATE manual/platform/android
PRIVATE manual/platform/android/jni
INTERFACE ${cocos_root}/cocos/scripting/lua-bindings/auto
INTERFACE ${cocos_root}/cocos/scripting/lua-bindings/manual
)
if(WINDOWS)
target_compile_definitions(luacocos2d PRIVATE _USRLUASTATIC)
endif()
set_target_properties(luacocos2d
PROPERTIES

View File

@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.6)
# need to whole-archive this lib
set(target_name lua_android_spec)
project(${target_name})
set(${target_name}_src
../manual/platform/android/CCLuaJavaBridge.cpp
../manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp
)
add_library(${target_name} STATIC
${${target_name}_src}
)
get_target_property(lua_header ext_lua INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(tolua_header ext_tolua INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(${target_name}
PRIVATE ../../..
PRIVATE ../manual
PRIVATE ../manual/platform/android
PRIVATE ${lua_header}
PRIVATE ${tolua_header}
)

View File

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

View File

@ -1,6 +1,8 @@
{
"common": [
".appveyor.yml",
".vscode/c_cpp_properties.json",
".vscode/settings.json",
"AUTHORS",
"CHANGELOG",
"CMakeLists.txt",
@ -12,12 +14,10 @@
"build/cocos2d_tests.xcodeproj/project.pbxproj",
"build/install-deps-linux.sh",
"cmake/Modules/CocosBuildHelpers.cmake",
"cmake/Modules/CocosBuildModules.cmake",
"cmake/Modules/CocosBuildSet.cmake",
"cmake/Modules/CocosCompileOptions.cmake",
"cmake/Modules/CocosPickLibs.cmake",
"cmake/Modules/CocosConfigDepend.cmake",
"cmake/Modules/CocosSelectModule.cmake",
"cmake/Modules/CocosUseLibs.cmake",
"cmake/Modules/FindChipmunk.cmake",
"cmake/Modules/FindFMOD.cmake",
"cmake/Modules/FindFontconfig.cmake",
@ -515,7 +515,6 @@
"cocos/base/s3tc.h",
"cocos/base/uthash.h",
"cocos/base/utlist.h",
"cocos/cc_dummy.c",
"cocos/cocos2d.cpp",
"cocos/cocos2d.h",
"cocos/deprecated/CCArray.cpp",
@ -1007,6 +1006,7 @@
"cocos/platform/android/CCGLViewImpl-android.h",
"cocos/platform/android/CCPlatformDefine-android.h",
"cocos/platform/android/CCStdC-android.h",
"cocos/platform/android/CMakeLists.txt",
"cocos/platform/android/ControllerManualAdapter/.classpath",
"cocos/platform/android/ControllerManualAdapter/.project",
"cocos/platform/android/ControllerManualAdapter/.settings/org.eclipse.jdt.core.prefs",
@ -1816,6 +1816,7 @@
"extensions/physics-nodes/CCPhysicsDebugNode.h",
"extensions/physics-nodes/CCPhysicsSprite.cpp",
"extensions/physics-nodes/CCPhysicsSprite.h",
"external/Box2D/CMakeLists.txt",
"external/Box2D/include/Box2D/Box2D.h",
"external/Box2D/include/Box2D/Collision/Shapes/b2ChainShape.h",
"external/Box2D/include/Box2D/Collision/Shapes/b2CircleShape.h",
@ -1872,9 +1873,13 @@
"external/Box2D/prebuilt/mac/libbox2d.a",
"external/Box2D/prebuilt/win32/debug/libbox2d.lib",
"external/Box2D/prebuilt/win32/release/libbox2d.lib",
"external/CMakeLists.txt",
"external/ConvertUTF/CMakeLists.txt",
"external/ConvertUTF/ConvertUTF.c",
"external/ConvertUTF/ConvertUTF.h",
"external/ConvertUTF/ConvertUTFWrapper.cpp",
"external/README.md",
"external/android-specific/cpufeatures/CMakeLists.txt",
"external/android-specific/pvmp3dec/Android.mk",
"external/android-specific/pvmp3dec/CMakeLists.txt",
"external/android-specific/pvmp3dec/include/mp3_decoder_selection.h",
@ -1990,6 +1995,7 @@
"external/android-specific/tremolo/Tremolo/treminfo.c",
"external/android-specific/tremolo/Tremolo/vorbisfile.c",
"external/android-specific/tremolo/Tremolo/window_lookup.h",
"external/bullet/CMakeLists.txt",
"external/bullet/include/bullet/Bullet-C-Api.h",
"external/bullet/include/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.h",
"external/bullet/include/bullet/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h",
@ -2300,6 +2306,7 @@
"external/bullet/prebuilt/mac/libMiniCL.a",
"external/bullet/prebuilt/win32/debug/libbullet.lib",
"external/bullet/prebuilt/win32/release/libbullet.lib",
"external/chipmunk/CMakeLists.txt",
"external/chipmunk/include/chipmunk/chipmunk.h",
"external/chipmunk/include/chipmunk/chipmunk_ffi.h",
"external/chipmunk/include/chipmunk/chipmunk_private.h",
@ -2344,9 +2351,11 @@
"external/chipmunk/prebuilt/win10/x64/chipmunk.lib",
"external/chipmunk/prebuilt/win32/debug-lib/libchipmunk.lib",
"external/chipmunk/prebuilt/win32/release-lib/libchipmunk.lib",
"external/clipper/CMakeLists.txt",
"external/clipper/clipper.cpp",
"external/clipper/clipper.hpp",
"external/config.json",
"external/cmake/CocosExternalConfig.cmake",
"external/curl/CMakeLists.txt",
"external/curl/include/android/curl/curl.h",
"external/curl/include/android/curl/curlbuild-arm32.h",
"external/curl/include/android/curl/curlbuild-arm64.h",
@ -2423,8 +2432,13 @@
"external/curl/prebuilt/win10/x64/libcurl_imp.lib",
"external/curl/prebuilt/win32/libcurl.dll",
"external/curl/prebuilt/win32/libcurl.lib",
"external/edtaa3func/CMakeLists.txt",
"external/edtaa3func/edtaa3func.cpp",
"external/edtaa3func/edtaa3func.h",
"external/empty.cpp",
"external/fbx-conv/README.md",
"external/fbx-conv/mac/fbx-conv",
"external/fbx-conv/mac/libfbxsdk.dylib",
"external/flatbuffers/Android.mk",
"external/flatbuffers/CMakeLists.txt",
"external/flatbuffers/flatbuffers.h",
@ -2437,6 +2451,7 @@
"external/flatbuffers/idl_gen_text.cpp",
"external/flatbuffers/idl_parser.cpp",
"external/flatbuffers/util.h",
"external/freetype2/CMakeLists.txt",
"external/freetype2/include/android/freetype2/config/ftconfig.h",
"external/freetype2/include/android/freetype2/config/ftheader.h",
"external/freetype2/include/android/freetype2/config/ftmodule.h",
@ -2539,57 +2554,57 @@
"external/freetype2/include/ios/freetype2/tttables.h",
"external/freetype2/include/ios/freetype2/tttags.h",
"external/freetype2/include/ios/freetype2/ttunpat.h",
"external/freetype2/include/linux/freetype/config/ftconfig.h",
"external/freetype2/include/linux/freetype/config/ftheader.h",
"external/freetype2/include/linux/freetype/config/ftmodule.h",
"external/freetype2/include/linux/freetype/config/ftoption.h",
"external/freetype2/include/linux/freetype/config/ftstdlib.h",
"external/freetype2/include/linux/freetype/freetype.h",
"external/freetype2/include/linux/freetype/ftadvanc.h",
"external/freetype2/include/linux/freetype/ftautoh.h",
"external/freetype2/include/linux/freetype/ftbbox.h",
"external/freetype2/include/linux/freetype/ftbdf.h",
"external/freetype2/include/linux/freetype/ftbitmap.h",
"external/freetype2/include/linux/freetype/ftbzip2.h",
"external/freetype2/include/linux/freetype/ftcache.h",
"external/freetype2/include/linux/freetype/ftcffdrv.h",
"external/freetype2/include/linux/freetype/ftchapters.h",
"external/freetype2/include/linux/freetype/ftcid.h",
"external/freetype2/include/linux/freetype/fterrdef.h",
"external/freetype2/include/linux/freetype/fterrors.h",
"external/freetype2/include/linux/freetype/ftgasp.h",
"external/freetype2/include/linux/freetype/ftglyph.h",
"external/freetype2/include/linux/freetype/ftgxval.h",
"external/freetype2/include/linux/freetype/ftgzip.h",
"external/freetype2/include/linux/freetype/ftimage.h",
"external/freetype2/include/linux/freetype/ftincrem.h",
"external/freetype2/include/linux/freetype/ftlcdfil.h",
"external/freetype2/include/linux/freetype/ftlist.h",
"external/freetype2/include/linux/freetype/ftlzw.h",
"external/freetype2/include/linux/freetype/ftmac.h",
"external/freetype2/include/linux/freetype/ftmm.h",
"external/freetype2/include/linux/freetype/ftmodapi.h",
"external/freetype2/include/linux/freetype/ftmoderr.h",
"external/freetype2/include/linux/freetype/ftotval.h",
"external/freetype2/include/linux/freetype/ftoutln.h",
"external/freetype2/include/linux/freetype/ftpfr.h",
"external/freetype2/include/linux/freetype/ftrender.h",
"external/freetype2/include/linux/freetype/ftsizes.h",
"external/freetype2/include/linux/freetype/ftsnames.h",
"external/freetype2/include/linux/freetype/ftstroke.h",
"external/freetype2/include/linux/freetype/ftsynth.h",
"external/freetype2/include/linux/freetype/ftsystem.h",
"external/freetype2/include/linux/freetype/fttrigon.h",
"external/freetype2/include/linux/freetype/ftttdrv.h",
"external/freetype2/include/linux/freetype/fttypes.h",
"external/freetype2/include/linux/freetype/ftwinfnt.h",
"external/freetype2/include/linux/freetype/ftxf86.h",
"external/freetype2/include/linux/freetype/t1tables.h",
"external/freetype2/include/linux/freetype/ttnameid.h",
"external/freetype2/include/linux/freetype/tttables.h",
"external/freetype2/include/linux/freetype/tttags.h",
"external/freetype2/include/linux/freetype/ttunpat.h",
"external/freetype2/include/linux/ft2build.h",
"external/freetype2/include/linux/freetype2/config/ftconfig.h",
"external/freetype2/include/linux/freetype2/config/ftheader.h",
"external/freetype2/include/linux/freetype2/config/ftmodule.h",
"external/freetype2/include/linux/freetype2/config/ftoption.h",
"external/freetype2/include/linux/freetype2/config/ftstdlib.h",
"external/freetype2/include/linux/freetype2/freetype.h",
"external/freetype2/include/linux/freetype2/ft2build.h",
"external/freetype2/include/linux/freetype2/ftadvanc.h",
"external/freetype2/include/linux/freetype2/ftautoh.h",
"external/freetype2/include/linux/freetype2/ftbbox.h",
"external/freetype2/include/linux/freetype2/ftbdf.h",
"external/freetype2/include/linux/freetype2/ftbitmap.h",
"external/freetype2/include/linux/freetype2/ftbzip2.h",
"external/freetype2/include/linux/freetype2/ftcache.h",
"external/freetype2/include/linux/freetype2/ftcffdrv.h",
"external/freetype2/include/linux/freetype2/ftchapters.h",
"external/freetype2/include/linux/freetype2/ftcid.h",
"external/freetype2/include/linux/freetype2/fterrdef.h",
"external/freetype2/include/linux/freetype2/fterrors.h",
"external/freetype2/include/linux/freetype2/ftgasp.h",
"external/freetype2/include/linux/freetype2/ftglyph.h",
"external/freetype2/include/linux/freetype2/ftgxval.h",
"external/freetype2/include/linux/freetype2/ftgzip.h",
"external/freetype2/include/linux/freetype2/ftimage.h",
"external/freetype2/include/linux/freetype2/ftincrem.h",
"external/freetype2/include/linux/freetype2/ftlcdfil.h",
"external/freetype2/include/linux/freetype2/ftlist.h",
"external/freetype2/include/linux/freetype2/ftlzw.h",
"external/freetype2/include/linux/freetype2/ftmac.h",
"external/freetype2/include/linux/freetype2/ftmm.h",
"external/freetype2/include/linux/freetype2/ftmodapi.h",
"external/freetype2/include/linux/freetype2/ftmoderr.h",
"external/freetype2/include/linux/freetype2/ftotval.h",
"external/freetype2/include/linux/freetype2/ftoutln.h",
"external/freetype2/include/linux/freetype2/ftpfr.h",
"external/freetype2/include/linux/freetype2/ftrender.h",
"external/freetype2/include/linux/freetype2/ftsizes.h",
"external/freetype2/include/linux/freetype2/ftsnames.h",
"external/freetype2/include/linux/freetype2/ftstroke.h",
"external/freetype2/include/linux/freetype2/ftsynth.h",
"external/freetype2/include/linux/freetype2/ftsystem.h",
"external/freetype2/include/linux/freetype2/fttrigon.h",
"external/freetype2/include/linux/freetype2/ftttdrv.h",
"external/freetype2/include/linux/freetype2/fttypes.h",
"external/freetype2/include/linux/freetype2/ftwinfnt.h",
"external/freetype2/include/linux/freetype2/ftxf86.h",
"external/freetype2/include/linux/freetype2/t1tables.h",
"external/freetype2/include/linux/freetype2/ttnameid.h",
"external/freetype2/include/linux/freetype2/tttables.h",
"external/freetype2/include/linux/freetype2/tttags.h",
"external/freetype2/include/linux/freetype2/ttunpat.h",
"external/freetype2/include/mac/freetype2/config/ftconfig.h",
"external/freetype2/include/mac/freetype2/config/ftheader.h",
"external/freetype2/include/mac/freetype2/config/ftmodule.h",
@ -2698,6 +2713,7 @@
"external/freetype2/include/win10/freetype2/config/ftoption.h",
"external/freetype2/include/win10/freetype2/config/ftstdlib.h",
"external/freetype2/include/win10/freetype2/freetype.h",
"external/freetype2/include/win10/freetype2/ft2build.h",
"external/freetype2/include/win10/freetype2/ftadvanc.h",
"external/freetype2/include/win10/freetype2/ftautoh.h",
"external/freetype2/include/win10/freetype2/ftbbox.h",
@ -2742,7 +2758,6 @@
"external/freetype2/include/win10/freetype2/tttables.h",
"external/freetype2/include/win10/freetype2/tttags.h",
"external/freetype2/include/win10/freetype2/ttunpat.h",
"external/freetype2/include/win10/ft2build.h",
"external/freetype2/include/win32/freetype2/config/ftconfig.h",
"external/freetype2/include/win32/freetype2/config/ftheader.h",
"external/freetype2/include/win32/freetype2/config/ftmodule.h",
@ -2843,6 +2858,7 @@
"external/freetype2/prebuilt/win10/win32/freetype.lib",
"external/freetype2/prebuilt/win10/x64/freetype.lib",
"external/freetype2/prebuilt/win32/freetype.lib",
"external/glfw3/CMakeLists.txt",
"external/glfw3/include/linux/glfw3.h",
"external/glfw3/include/linux/glfw3native.h",
"external/glfw3/include/mac/glfw3.h",
@ -2924,6 +2940,7 @@
"external/json/stream.h",
"external/json/stringbuffer.h",
"external/json/writer.h",
"external/linux-specific/fmod/CMakeLists.txt",
"external/linux-specific/fmod/include/fmod.h",
"external/linux-specific/fmod/include/fmod.hpp",
"external/linux-specific/fmod/include/fmod_codec.h",
@ -2936,8 +2953,10 @@
"external/linux-specific/fmod/prebuilt/64-bit/libfmod.so.6",
"external/linux-specific/fmod/prebuilt/64-bit/libfmodL.so",
"external/linux-specific/fmod/prebuilt/64-bit/libfmodL.so.6",
"external/md5/CMakeLists.txt",
"external/md5/md5.c",
"external/md5/md5.h",
"external/openssl/CMakeLists.txt",
"external/openssl/include/android/openssl/aes.h",
"external/openssl/include/android/openssl/asn1.h",
"external/openssl/include/android/openssl/asn1_mac.h",
@ -3566,6 +3585,7 @@
"external/openssl/prebuilt/win32/libcrypto.lib",
"external/openssl/prebuilt/win32/libssl-1_1.dll",
"external/openssl/prebuilt/win32/libssl.lib",
"external/png/CMakeLists.txt",
"external/png/include/android/png.h",
"external/png/include/android/pngconf.h",
"external/png/include/android/pnglibconf.h",
@ -3594,6 +3614,7 @@
"external/png/prebuilt/tizen/x86/libpng.a",
"external/png/prebuilt/tvos/libpng.a",
"external/png/prebuilt/win32/libpng.lib",
"external/poly2tri/CMakeLists.txt",
"external/poly2tri/common/shapes.cc",
"external/poly2tri/common/shapes.h",
"external/poly2tri/common/utils.h",
@ -3671,6 +3692,7 @@
"external/recast/proj.win10/librecast.vcxproj.filters",
"external/recast/proj.win32/librecast.vcxproj",
"external/recast/proj.win32/librecast.vcxproj.filters",
"external/sqlite3/CMakeLists.txt",
"external/sqlite3/include/sqlite3.h",
"external/sqlite3/include/sqlite3ext.h",
"external/sqlite3/libraries/win10/arm/sqlite3.dll",
@ -3739,6 +3761,7 @@
"external/unzip/ioapi_mem.h",
"external/unzip/unzip.cpp",
"external/unzip/unzip.h",
"external/uv/CMakeLists.txt",
"external/uv/include/uv.h",
"external/uv/include/uv/aix.h",
"external/uv/include/uv/android-ifaddrs.h",
@ -3812,6 +3835,7 @@
"external/webp/prebuilt/tizen/x86/libwebp.a",
"external/webp/prebuilt/tvos/libwebp.a",
"external/webp/prebuilt/win32/libwebp.lib",
"external/websockets/CMakeLists.txt",
"external/websockets/include/android/libwebsockets.h",
"external/websockets/include/android/lws_config.h",
"external/websockets/include/ios/libwebsockets.h",
@ -3907,9 +3931,11 @@
"external/win10-specific/zlib/prebuilt/x64/zlib.lib",
"external/win10-specific/zlib/prebuilt/x64/zlib1.dll",
"external/win10-specific/zlib/prebuilt/x64/zlibstatic.lib",
"external/win32-specific/MP3Decoder/CMakeLists.txt",
"external/win32-specific/MP3Decoder/include/mpg123.h",
"external/win32-specific/MP3Decoder/prebuilt/libmpg123.dll",
"external/win32-specific/MP3Decoder/prebuilt/libmpg123.lib",
"external/win32-specific/OggDecoder/CMakeLists.txt",
"external/win32-specific/OggDecoder/include/ogg/ogg.h",
"external/win32-specific/OggDecoder/include/ogg/os_types.h",
"external/win32-specific/OggDecoder/include/vorbis/codec.h",
@ -3921,6 +3947,7 @@
"external/win32-specific/OggDecoder/prebuilt/libvorbis.lib",
"external/win32-specific/OggDecoder/prebuilt/libvorbisfile.dll",
"external/win32-specific/OggDecoder/prebuilt/libvorbisfile.lib",
"external/win32-specific/OpenalSoft/CMakeLists.txt",
"external/win32-specific/OpenalSoft/include/AL/al.h",
"external/win32-specific/OpenalSoft/include/AL/alc.h",
"external/win32-specific/OpenalSoft/include/AL/alext.h",
@ -3929,14 +3956,17 @@
"external/win32-specific/OpenalSoft/include/AL/efx.h",
"external/win32-specific/OpenalSoft/prebuilt/OpenAL32.dll",
"external/win32-specific/OpenalSoft/prebuilt/OpenAL32.lib",
"external/win32-specific/gles/CMakeLists.txt",
"external/win32-specific/gles/include/OGLES/GL/glew.h",
"external/win32-specific/gles/include/OGLES/GL/glxew.h",
"external/win32-specific/gles/include/OGLES/GL/wglew.h",
"external/win32-specific/gles/prebuilt/glew32.dll",
"external/win32-specific/gles/prebuilt/glew32.lib",
"external/win32-specific/icon/CMakeLists.txt",
"external/win32-specific/icon/include/iconv.h",
"external/win32-specific/icon/prebuilt/iconv.dll",
"external/win32-specific/icon/prebuilt/libiconv.lib",
"external/win32-specific/zlib/Readme.md",
"external/win32-specific/zlib/include/zconf.h",
"external/win32-specific/zlib/include/zlib.h",
"external/win32-specific/zlib/prebuilt/libzlib.lib",
@ -3944,8 +3974,10 @@
"external/xxhash/CMakeLists.txt",
"external/xxhash/xxhash.c",
"external/xxhash/xxhash.h",
"external/xxtea/CMakeLists.txt",
"external/xxtea/xxtea.cpp",
"external/xxtea/xxtea.h",
"external/zlib/CMakeLists.txt",
"external/zlib/include/zconf.h",
"external/zlib/include/zlib.h",
"external/zlib/prebuilt/android/Android.mk",
@ -3992,9 +4024,6 @@
"tools/appveyor-scripts/setup_android.py",
"tools/coding-style/include-linter.py",
"tools/coding-style/tailing-spaces.py",
"tools/fbx-conv/README.md",
"tools/fbx-conv/mac/fbx-conv",
"tools/fbx-conv/mac/libfbxsdk.dylib",
"tools/missing-tools.txt",
"tools/particle/convert_YCoordFlipped.py",
"tools/performance-analyze/README.md",
@ -4344,6 +4373,7 @@
"cocos/scripting/js-bindings/precheader.cpp",
"cocos/scripting/js-bindings/precheader.h",
"cocos/scripting/js-bindings/proj.android/Android.mk",
"cocos/scripting/js-bindings/proj.android/CMakeLists.txt",
"cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj/project.pbxproj",
"cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj",
"cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj.filters",
@ -4406,6 +4436,7 @@
"cocos/scripting/js-bindings/script/studio/parsers/timelineParser-1.x.js",
"cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js",
"cocos/scripting/js-bindings/script/studio/parsers/uiParser-1.x.js",
"external/spidermonkey/CMakeLists.txt",
"external/spidermonkey/README.md",
"external/spidermonkey/include/android/js-config-32.h",
"external/spidermonkey/include/android/js-config-64.h",
@ -4976,8 +5007,7 @@
"tools/tojs/cocos2dx_spine.ini",
"tools/tojs/cocos2dx_studio.ini",
"tools/tojs/cocos2dx_ui.ini",
"tools/tojs/genbindings.py",
"tools/tojs/userconf.ini"
"tools/tojs/genbindings.py"
],
"lua": [
"cocos/scripting/lua-bindings/CMakeLists.txt",
@ -5566,6 +5596,7 @@
"cocos/scripting/lua-bindings/manual/video/lua_cocos2dx_experimental_video_manual.cpp",
"cocos/scripting/lua-bindings/manual/video/lua_cocos2dx_experimental_video_manual.hpp",
"cocos/scripting/lua-bindings/proj.android/Android.mk",
"cocos/scripting/lua-bindings/proj.android/CMakeLists.txt",
"cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj",
"cocos/scripting/lua-bindings/proj.tizen/.cproject",
"cocos/scripting/lua-bindings/proj.tizen/.project",
@ -5707,6 +5738,7 @@
"external/lua/lua/lzio.h",
"external/lua/lua/prebuilt/ios/liblua.a",
"external/lua/lua/print.c",
"external/lua/luajit/CMakeLists.txt",
"external/lua/luajit/include/lauxlib.h",
"external/lua/luajit/include/lua.h",
"external/lua/luajit/include/lua.hpp",
@ -5722,6 +5754,7 @@
"external/lua/luajit/prebuilt/mac/libluajit.a",
"external/lua/luajit/prebuilt/win32/lua51.dll",
"external/lua/luajit/prebuilt/win32/lua51.lib",
"external/lua/luasocket/CMakeLists.txt",
"external/lua/luasocket/auxiliar.c",
"external/lua/luasocket/auxiliar.h",
"external/lua/luasocket/buffer.c",
@ -5859,7 +5892,6 @@
"tools/tolua/cocos2dx_spine.ini",
"tools/tolua/cocos2dx_studio.ini",
"tools/tolua/cocos2dx_ui.ini",
"tools/tolua/genbindings.py",
"tools/tolua/userconf.ini"
"tools/tolua/genbindings.py"
]
}

View File

@ -23,7 +23,7 @@
# THE SOFTWARE.
# ****************************************************************************/
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.6)
set(APP_NAME HelloCpp)
@ -48,10 +48,6 @@ if(APPLE OR WINDOWS)
cocos_mark_multi_resources(common_res_files RES_TO "Resources" FOLDERS ${GAME_RES_FOLDER})
endif()
include_directories(
Classes
${COCOS2DX_ROOT_PATH}/cocos/audio/include/
)
# add cross-platforms source files and header files
list(APPEND GAME_SOURCE
Classes/AppDelegate.cpp
@ -115,16 +111,26 @@ elseif(APPLE)
endif()
# mark app complie info and libs info
set(APP_SRC
${GAME_SOURCE}
set(all_code_files
${GAME_HEADER}
${GAME_SOURCE}
)
cocos_build_app(${APP_NAME}
APP_SRC "${APP_SRC}"
DEPEND_COMMON_LIBS "cocos2d"
DEPEND_ANDROID_LIBS "cocos2d_android"
)
if(NOT ANDROID)
add_executable(${APP_NAME} ${all_code_files})
else()
add_library(${APP_NAME} SHARED ${all_code_files})
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform)
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
endif()
target_link_libraries(${APP_NAME} cocos2d)
target_include_directories(${APP_NAME}
PRIVATE Classes
PRIVATE ${COCOS2DX_ROOT_PATH}/cocos/audio/include/
)
# mark app resources
setup_cocos_app_config(${APP_NAME})
if(APPLE)
set_target_properties(${APP_NAME} PROPERTIES RESOURCE "${APP_UI_RES}")
if(MACOSX)

View File

@ -24,7 +24,7 @@
# THE SOFTWARE.
# ****************************************************************************/
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.6)
set(APP_NAME HelloJavascript)
@ -66,13 +66,6 @@ endif()
set(GAME_SOURCE ${RUNTIME_SRC_ROOT}/Classes/AppDelegate.cpp)
set(GAME_HEADER ${RUNTIME_SRC_ROOT}/Classes/AppDelegate.h)
# sources need to compile info, include dirs and source files
include_directories(
${RUNTIME_SRC_ROOT}/Classes
${COCOS2DX_ROOT_PATH}/cocos/editor-support
${COCOS2DX_ROOT_PATH}/external/spidermonkey/include/${PLATFORM_FOLDER}
)
if(ANDROID)
# change APP_NAME to the share library name for Android, it's value depend on AndroidManifest.xml
set(APP_NAME cocos2djs)
@ -122,13 +115,19 @@ endif()
set(APP_SRC ${GAME_HEADER} ${GAME_SOURCE})
# mark app complie info and libs info
cocos_build_app(${APP_NAME}
APP_SRC "${APP_SRC}"
DEPEND_COMMON_LIBS "jscocos2d" "cocos2d"
DEPEND_ANDROID_LIBS "cocos2d_android"
)
if(NOT ANDROID)
add_executable(${APP_NAME} ${APP_SRC})
else()
add_library(${APP_NAME} SHARED ${APP_SRC})
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform)
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
endif()
target_link_libraries(${APP_NAME} jscocos2d)
target_include_directories(${APP_NAME} PRIVATE ${RUNTIME_SRC_ROOT}/Classes)
# mark app resources, resource will be copy auto after mark
setup_cocos_app_config(${APP_NAME})
if(APPLE)
set_target_properties(${APP_NAME} PROPERTIES RESOURCE "${APP_UI_RES}")
if(MACOSX)

View File

@ -21,7 +21,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# ****************************************************************************/
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.6)
set(APP_NAME HelloLua)
@ -135,15 +135,19 @@ endif()
set(APP_SRC ${GAME_HEADER} ${GAME_SOURCE})
# mark app complie info and libs info
cocos_build_app(${APP_NAME}
APP_SRC "${APP_SRC}"
DEPEND_COMMON_LIBS "luacocos2d" "cocos2d"
DEPEND_ANDROID_LIBS "cocos2d_android"
DEPEND_MACOSX_LIBS "simulator"
DEPEND_WINDOWS_LIBS "simulator"
)
if(NOT ANDROID)
add_executable(${APP_NAME} ${APP_SRC})
else()
add_library(${APP_NAME} SHARED ${APP_SRC})
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform)
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
endif()
# mark app resources
target_link_libraries(${APP_NAME} luacocos2d)
target_include_directories(${APP_NAME} PRIVATE ${RUNTIME_SRC_ROOT}/Classes)
# mark app resources, resource will be copy auto after mark
setup_cocos_app_config(${APP_NAME})
if(APPLE)
set_target_properties(${APP_NAME} PROPERTIES RESOURCE "${APP_UI_RES}")
if(MACOSX)

View File

@ -21,7 +21,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# ****************************************************************************/
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.6)
set(APP_NAME cpp-empty-test)
@ -113,16 +113,21 @@ set(all_code_files
${GAME_SOURCE}
)
include_directories(Classes)
# mark app complie info
if(NOT ANDROID)
add_executable(${APP_NAME} ${all_code_files})
else()
add_library(${APP_NAME} SHARED ${all_code_files})
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform)
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
endif()
# mark app complie info and libs info
cocos_build_app(${APP_NAME}
APP_SRC "${all_code_files}"
DEPEND_COMMON_LIBS "cocos2d"
DEPEND_ANDROID_LIBS "cocos2d_android"
)
target_link_libraries(${APP_NAME} cocos2d)
target_include_directories(${APP_NAME} PRIVATE Classes)
# mark app resources
setup_cocos_app_config(${APP_NAME})
if(APPLE)
set_target_properties(${APP_NAME} PROPERTIES RESOURCE "${APP_UI_RES}")
if(MACOSX)

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.6)
set(APP_NAME cpp-tests)
@ -91,7 +91,6 @@ list(APPEND GAME_HEADER
Classes/UnitTest/UnitTest.h
Classes/UnitTest/RefPtrTest.h
Classes/ConfigurationTest/ConfigurationTest.h
Classes/PhysicsTest/PhysicsTest.h
Classes/CurrentLanguageTest/CurrentLanguageTest.h
Classes/AppDelegate.h
Classes/LabelTest/LabelTestNew.h
@ -278,7 +277,6 @@ list(APPEND GAME_SOURCE
Classes/ParallaxTest/ParallaxTest.cpp
Classes/Particle3DTest/Particle3DTest.cpp
Classes/ParticleTest/ParticleTest.cpp
Classes/PhysicsTest/PhysicsTest.cpp
Classes/ReleasePoolTest/ReleasePoolTest.cpp
Classes/RenderTextureTest/RenderTextureTest.cpp
Classes/RotateWorldTest/RotateWorldTest.cpp
@ -360,16 +358,6 @@ if(WIN32 OR MACOSX OR LINUX)
)
endif()
if(USE_CHIPMUNK)
include_directories(${CHIPMUNK_INCLUDE_DIRS})
list(APPEND GAME_HEADER
Classes/ChipmunkTest/ChipmunkTest.h
)
list(APPEND GAME_SOURCE
Classes/ChipmunkTest/ChipmunkTest.cpp
)
endif()
if(USE_BOX2D)
list(APPEND GAME_HEADER
Classes/Box2DTest/Box2dTest.cpp
@ -449,31 +437,46 @@ if(USE_BULLET)
include_directories(${BULLET_INCLUDE_DIRS})
endif()
if(USE_CHIPMUNK)
include_directories(${CHIPMUNK_INCLUDE_DIRS})
list(APPEND GAME_HEADER
Classes/PhysicsTest/PhysicsTest.h
Classes/ChipmunkTest/ChipmunkTest.h
)
list(APPEND GAME_SOURCE
Classes/PhysicsTest/PhysicsTest.cpp
Classes/ChipmunkTest/ChipmunkTest.cpp
)
endif()
if(NOT LINUX)
list(APPEND GAME_SOURCE
Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp
)
endif()
include_directories(
Classes
${COCOS2DX_ROOT_PATH}/cocos/editor-support
)
# mark app complie info and libs info
set(APP_SRC
set(all_code_files
${GAME_HEADER}
${GAME_SOURCE}
)
cocos_build_app(${APP_NAME}
APP_SRC "${APP_SRC}"
DEPEND_COMMON_LIBS "cocos2d"
DEPEND_ANDROID_LIBS "cocos2d_android"
COMMON_USE_PKGS "FREETYPE" "CURL"
LINUX_USE_PKGS "FONTCONFIG" "GTK3"
)
if(NOT ANDROID)
add_executable(${APP_NAME} ${all_code_files})
else()
add_library(${APP_NAME} SHARED ${all_code_files})
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform)
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
endif()
target_link_libraries(${APP_NAME} cocos2d)
target_include_directories(${APP_NAME}
PRIVATE Classes
)
# mark app resources
setup_cocos_app_config(${APP_NAME})
if(APPLE)
set_target_properties(${APP_NAME} PROPERTIES RESOURCE "${APP_UI_RES}")
if(MACOSX)

View File

@ -21,14 +21,13 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# ****************************************************************************/
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.6)
set(APP_NAME js-tests)
project(${APP_NAME})
if(NOT DEFINED BUILD_ENGINE_DONE)
# define some variables
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/)
@ -43,6 +42,7 @@ set(res_main_files
"${CMAKE_CURRENT_SOURCE_DIR}/../main.js"
"${CMAKE_CURRENT_SOURCE_DIR}/../project.json"
)
# to check, dumplicate copy on macOS sometime. why?
# "${COCOS2DX_ROOT_PATH}/tests/cpp-tests/Resources"
set(res_res_folders
"${CMAKE_CURRENT_SOURCE_DIR}/../resjs"
@ -132,27 +132,23 @@ list(APPEND GAME_SOURCE
Classes/js_Effect3D_bindings.cpp
)
include_directories(
Classes
${COCOS2DX_ROOT_PATH}/cocos/scripting/js-bindings/auto
${COCOS2DX_ROOT_PATH}/cocos/scripting/js-bindings/manual
${COCOS2DX_ROOT_PATH}/cocos/base
${COCOS2DX_ROOT_PATH}/cocos/editor-support
${COCOS2DX_ROOT_PATH}/cocos/audio/include
${COCOS2DX_ROOT_PATH}/external/spidermonkey/include/${PLATFORM_FOLDER}
${COCOS2DX_ROOT_PATH}/external/chipmunk/include/chipmunk
)
set(APP_SRC ${GAME_HEADER} ${GAME_SOURCE})
# mark app complie info and libs info
cocos_build_app(${APP_NAME}
APP_SRC "${APP_SRC}"
DEPEND_COMMON_LIBS "jscocos2d" "cocos2d"
DEPEND_ANDROID_LIBS "cocos2d_android"
)
if(NOT ANDROID)
add_executable(${APP_NAME} ${APP_SRC})
else()
add_library(${APP_NAME} SHARED ${APP_SRC})
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/cpp-android)
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/scripting/js-bindings/proj.android ${ENGINE_BINARY_PATH}/cocos/js-android)
target_link_libraries(${APP_NAME} -Wl,--whole-archive js_android_spec -Wl,--no-whole-archive)
endif()
target_link_libraries(${APP_NAME} jscocos2d)
target_include_directories(${APP_NAME} PRIVATE Classes)
# mark app resources
setup_cocos_app_config(${APP_NAME})
if(APPLE)
set_target_properties(${APP_NAME} PROPERTIES RESOURCE "${APP_UI_RES}")
if(MACOSX)

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.6)
set(APP_NAME lua-empty-test)
@ -84,25 +84,23 @@ elseif(APPLE)
list(APPEND GAME_SOURCE ${cc_common_res})
endif()
include_directories(
Classes
${COCOS2DX_ROOT_PATH}/cocos/scripting/lua-bindings/auto
${COCOS2DX_ROOT_PATH}/cocos/scripting/lua-bindings/manual
${COCOS2DX_ROOT_PATH}/external/lua/luajit/include
${COCOS2DX_ROOT_PATH}/external/lua/tolua
)
include_directories(${LUAJIT_INCLUDE_DIRS})
set(APP_SRC ${GAME_HEADER} ${GAME_SOURCE})
# mark app complie info and libs info
cocos_build_app(${APP_NAME}
APP_SRC "${APP_SRC}"
DEPEND_COMMON_LIBS "luacocos2d" "cocos2d"
DEPEND_ANDROID_LIBS "cocos2d_android"
)
if(NOT ANDROID)
add_executable(${APP_NAME} ${APP_SRC})
else()
add_library(${APP_NAME} SHARED ${APP_SRC})
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/cpp-android)
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/scripting/lua-bindings/proj.android ${ENGINE_BINARY_PATH}/cocos/lua-android)
target_link_libraries(${APP_NAME} -Wl,--whole-archive lua_android_spec -Wl,--no-whole-archive)
endif()
target_link_libraries(${APP_NAME} luacocos2d)
target_include_directories(${APP_NAME} PRIVATE Classes)
# mark app resources
setup_cocos_app_config(${APP_NAME})
if(APPLE)
set_target_properties(${APP_NAME} PROPERTIES RESOURCE "${APP_UI_RES}")
if(MACOSX)

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.6)
set(APP_NAME lua-tests)
@ -93,24 +93,22 @@ elseif(APPLE)
list(APPEND GAME_SOURCE ${cc_common_res})
endif()
include_directories(
Classes
${COCOS2DX_ROOT_PATH}/cocos/scripting/lua-bindings/manual
${COCOS2DX_ROOT_PATH}/cocos/scripting/lua-bindings/auto
${COCOS2DX_ROOT_PATH}/external/lua/tolua
)
include_directories(${LUAJIT_INCLUDE_DIRS})
set(APP_SRC ${GAME_HEADER} ${GAME_SOURCE})
# mark app complie info and libs info
cocos_build_app(${APP_NAME}
APP_SRC "${APP_SRC}"
DEPEND_COMMON_LIBS "luacocos2d" "cocos2d"
DEPEND_ANDROID_LIBS "cocos2d_android"
)
if(NOT ANDROID)
add_executable(${APP_NAME} ${APP_SRC})
else()
add_library(${APP_NAME} SHARED ${APP_SRC})
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/cpp-android)
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/scripting/lua-bindings/proj.android ${ENGINE_BINARY_PATH}/cocos/lua-android)
target_link_libraries(${APP_NAME} -Wl,--whole-archive lua_android_spec -Wl,--no-whole-archive)
endif()
target_link_libraries(${APP_NAME} luacocos2d)
target_include_directories(${APP_NAME} PRIVATE Classes)
# mark app resources
setup_cocos_app_config(${APP_NAME})
if(APPLE)
set_target_properties(${APP_NAME} PROPERTIES RESOURCE "${APP_UI_RES}")
if(MACOSX)

View File

@ -19,7 +19,16 @@ function PushAndroidArtifacts
If ($env:build_type -eq "android_cpp_tests") {
Write-Host "Build tests\cpp-tests"
Push-Location $env:APPVEYOR_BUILD_FOLDER\tests\cpp-tests\proj.android\
& ./gradlew assembleDebug
& ./gradlew assembleRelease -PPROP_BUILD_TYPE=cmake --parallel --info
if ($lastexitcode -ne 0) {throw}
PushAndroidArtifacts
Pop-Location
} elseif ($env:build_type -eq "android_lua_tests") {
Write-Host "Build tests\lua-test"
Push-Location $env:APPVEYOR_BUILD_FOLDER\tests\lua-tests\project\proj.android\
# tocheck, release mode failed on "LuaTests:mergeReleaseAssets"
& ./gradlew assembleDebug -PPROP_BUILD_TYPE=ndk-build --parallel --info
if ($lastexitcode -ne 0) {throw}
PushAndroidArtifacts
Pop-Location
@ -39,7 +48,7 @@ If ($env:build_type -eq "android_cpp_tests") {
Write-Host "Build cocos_new_test"
Push-Location $env:APPVEYOR_BUILD_FOLDER\cocos_new_test\proj.android\
& ./gradlew assembleRelease
& ./gradlew assembleRelease -PPROP_BUILD_TYPE=cmake --parallel --info
if ($lastexitcode -ne 0) {throw}
PushAndroidArtifacts
Pop-Location
@ -49,27 +58,27 @@ If ($env:build_type -eq "android_cpp_tests") {
# & $python -u tools\cocos2d-console\bin\cocos.py gen-libs -p android -m release --ap android-15 --app-abi armeabi-v7a --agreement n
# if ($lastexitcode -ne 0) {throw}
} elseif ($env:build_type -eq "windows32_cocos_new_test") {
Write-Host "Create new project windows32_cocos_new_test"
& $python -u tools\cocos2d-console\bin\cocos.py --agreement n new -l cpp -p my.pack.qqqq cocos_new_test
if ($lastexitcode -ne 0) {throw}
} elseif ($env:build_type -eq "windows32_cmake_test") {
Write-Host "Build tests project by cmake"
& mkdir $env:APPVEYOR_BUILD_FOLDER\cocos_new_test\b
if ($lastexitcode -ne 0) {throw}
& mkdir $env:APPVEYOR_BUILD_FOLDER\win32-build
# if ($lastexitcode -ne 0) {throw} # mkdir return no-zero
Push-Location $env:APPVEYOR_BUILD_FOLDER\cocos_new_test\b
Push-Location $env:APPVEYOR_BUILD_FOLDER\win32-build
& cmake -DCMAKE_BUILD_TYPE=Release ..
if ($lastexitcode -ne 0) {throw}
& cmake --build . --config Release
if ($lastexitcode -ne 0) {throw}
& 7z a release_win32.7z $env:APPVEYOR_BUILD_FOLDER\cocos_new_test\b\bin\
& 7z a release_win32.7z $env:APPVEYOR_BUILD_FOLDER\win32-build\bin\
if ($lastexitcode -ne 0) {throw}
Push-AppveyorArtifact release_win32.7z
Pop-Location
}
Else {
# default, windows32_sln_test
& msbuild $env:APPVEYOR_BUILD_FOLDER\build\cocos2d-win32.sln /t:Build /p:Platform="Win32" /p:Configuration="Release" /m /consoleloggerparameters:"PerformanceSummary;NoSummary"
if ($lastexitcode -ne 0) {throw}

View File

@ -12,6 +12,7 @@ function install_android_ndk()
if [ "$BUILD_TARGET" == "android_ndk-build" ]\
|| [ "$BUILD_TARGET" == "android_lua_ndk-build" ]\
|| [ "$BUILD_TARGET" == "android_cmake" ]\
|| [ "$BUILD_TARGET" == "android_js_cmake" ]\
|| [ "$BUILD_TARGET" == "android_lua_cmake" ] ; then
python $COCOS2DX_ROOT/tools/appveyor-scripts/setup_android.py
else

View File

@ -39,27 +39,40 @@ function build_ios()
function build_mac_cmake()
{
pushd $COCOS2DX_ROOT
python -u tools/cocos2d-console/bin/cocos.py --agreement n new -l cpp -p my.pack.qqqq cocos_new_test
popd
cd $COCOS2DX_ROOT/cocos_new_test
NUM_OF_CORES=`getconf _NPROCESSORS_ONLN`
# pushd $COCOS2DX_ROOT
# python -u tools/cocos2d-console/bin/cocos.py --agreement n new -l cpp -p my.pack.qqqq cocos_new_test
# popd
# cd $COCOS2DX_ROOT/cocos_new_test
cd $COCOS2DX_ROOT
mkdir -p mac_cmake_build
cd mac_cmake_build
cmake ..
cmake --build .
cmake .. -GXcode
# cmake --build .
xcodebuild -project Cocos2d-x.xcodeproj -alltargets -jobs $NUM_OF_CORES build | xcpretty
#the following commands must not be removed
xcodebuild -project Cocos2d-x.xcodeproj -alltargets -jobs $NUM_OF_CORES build
exit 0
}
function build_ios_cmake()
{
pushd $COCOS2DX_ROOT
python -u tools/cocos2d-console/bin/cocos.py --agreement n new -l cpp -p my.pack.qqqq cocos_new_test
popd
cd $COCOS2DX_ROOT/cocos_new_test
NUM_OF_CORES=`getconf _NPROCESSORS_ONLN`
# pushd $COCOS2DX_ROOT
# python -u tools/cocos2d-console/bin/cocos.py --agreement n new -l cpp -p my.pack.qqqq cocos_new_test
# popd
# cd $COCOS2DX_ROOT/cocos_new_test
cd $COCOS2DX_ROOT
mkdir -p ios_cmake_build
cd ios_cmake_build
cmake .. -DCMAKE_TOOLCHAIN_FILE=$COCOS2DX_ROOT/cmake/ios.toolchain.cmake -GXcode -DIOS_PLATFORM=SIMULATOR64
cmake --build .
# too much logs on console when "cmake --build ."
# cmake --build .
xcodebuild -project Cocos2d-x.xcodeproj -alltargets -jobs $NUM_OF_CORES -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build | xcpretty
#the following commands must not be removed
xcodebuild -project Cocos2d-x.xcodeproj -alltargets -jobs $NUM_OF_CORES -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build
exit 0
}
@ -124,6 +137,19 @@ function build_android_lua_cmake()
}
function build_android_js_cmake()
{
# Build all samples
echo "Building Android samples js ..."
source ../environment.sh
# build lua-tests
pushd $COCOS2DX_ROOT/tests/js-tests/project/proj.android
./gradlew assembleDebug -PPROP_BUILD_TYPE=cmake --parallel --info
popd
}
function genernate_binding_codes()
{
if [ $TRAVIS_OS_NAME == "linux" ]; then
@ -158,12 +184,39 @@ function genernate_binding_codes()
fi
}
# generate cocos_files.json and check diff
function update_cocos_files()
{
# Don't exit on non-zero return value
set +e
COCOSFILE_PATH="$COCOS2DX_ROOT/templates/cocos2dx_files.json"
echo "Updates cocos_files.json"
$COCOS2DX_ROOT/tools/travis-scripts/generate-template-files.py
git diff FETCH_HEAD --stat --exit-code "$COCOSFILE_PATH"
COCOSFILE_DIFF_RETVAL=$?
if [ $LUA_DIFF_RETVAL -eq 0 ] && [ $JS_DIFF_RETVAL -eq 0 ] && [ $COCOSFILE_DIFF_RETVAL -eq 0 ]; then
echo
echo "No differences in generated files"
echo "Exiting with success."
echo
exit 0
else
echo
echo "Generated files differ from HEAD. Continuing."
echo
fi
# Exit on error
set -e
}
function generate_pull_request_for_binding_codes_and_cocosfiles()
{
COCOS_ROBOT_REMOTE="https://${GH_USER}:${GH_PASSWORD}@github.com/${GH_USER}/cocos2d-x.git"
LUA_AUTO_GENERATE_SCRIPT_PATH="$COCOS2DX_ROOT/cocos/scripting/lua-bindings/auto"
JS_AUTO_GENERATE_SCRIPT_PATH="$COCOS2DX_ROOT/cocos/scripting/js-bindings/auto"
COCOSFILE_PATH="$COCOS2DX_ROOT/templates/cocos2dx_files.json"
ELAPSEDSECS=`date +%s`
COCOS_BRANCH="update_lua_bindings_$ELAPSEDSECS"
COMMITTAG="[ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically"
@ -192,22 +245,7 @@ function generate_pull_request_for_binding_codes_and_cocosfiles()
JS_DIFF_RETVAL=$?
# generate cocos_files.json and check diff
echo "Updates cocos_files.json"
$COCOS2DX_ROOT/tools/travis-scripts/generate-template-files.py
git diff FETCH_HEAD --stat --exit-code "$COCOSFILE_PATH"
COCOSFILE_DIFF_RETVAL=$?
if [ $LUA_DIFF_RETVAL -eq 0 ] && [ $JS_DIFF_RETVAL -eq 0 ] && [ $COCOSFILE_DIFF_RETVAL -eq 0 ]; then
echo
echo "No differences in generated files"
echo "Exiting with success."
echo
exit 0
else
echo
echo "Generated files differ from HEAD. Continuing."
echo
fi
update_cocos_files
# Exit on error
set -e
@ -259,6 +297,11 @@ function run_pull_request()
build_android_lua_cmake
fi
# android_js
if [ $BUILD_TARGET == 'android_js_cmake' ]; then
build_android_js_cmake
fi
if [ $BUILD_TARGET == 'mac' ]; then
build_mac
fi
@ -298,6 +341,7 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
if [ "$BUILD_TARGET" == "android_cocos_new_test" ]; then
source ../environment.sh
pushd $COCOS2DX_ROOT
update_cocos_files
python -u tools/cocos2d-console/bin/cocos.py --agreement n new -l cpp -p my.pack.qqqq cocos_new_test
popd
pushd $COCOS2DX_ROOT/cocos_new_test/proj.android
@ -308,7 +352,8 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
if [ "$BUILD_TARGET" == "linux_cocos_new_test" ]; then
pushd $COCOS2DX_ROOT
python -u tools/cocos2d-console/bin/cocos.py --agreement n new -l cpp -p my.pack.qqqq cocos_new_test
update_cocos_files
python -u tools/cocos2d-console/bin/cocos.py --agreement n new -l lua -p my.pack.qqqq cocos_new_test
popd
CPU_CORES=`grep -c ^processor /proc/cpuinfo`
echo "Building tests ..."