Skip to content

Commit

Permalink
Merge branch 'v3' into pba-cocos2dx-3.17.1
Browse files Browse the repository at this point in the history
* v3: (83 commits)
  setPercent after initialization (cocos2d#19718)
  Update CHANGELOG
  [js-tests/cpp-tests] iOS: add fonts to Info.plist (cocos2d#19708)
  update release note and change log (cocos2d#19711)
  fix get environment (cocos2d#19690)
  rename Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.* to Cocos2dxLuaJavaBridge.* (cocos2d#19694)
  fix twice copy lua scripts error (cocos2d#19687) (cocos2d#19691)
  protect empty string (cocos2d#19680)
  modify engine version (cocos2d#19677)
  fix Sprite update_blend_func (cocos2d#19649)
  [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (cocos2d#19648)
  add clang-tidy support (cocos2d#19643)
  [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (cocos2d#19644)
  add optimization for OPPO. (cocos2d#19631)
  Optimize cases where loop variable is unecessarily copied in a range-for loop. (cocos2d#19637)
  Changed shader data types mediump to highp to remove possible sprite joggling on some Android phones. (cocos2d#19633)
  remove redundant user-defined copy constructor and destructor, (cocos2d#19636)
  move parseIntegerList to a free function in ccUtils, add few testcases (cocos2d#19634)
  update binding generator (cocos2d#19625)
  rewrite parseIntegerList with better performance (cocos2d#19619)
  ...
  • Loading branch information
kaushikpaperboat committed Sep 11, 2019
2 parents e662268 + 1528ea0 commit e3ad9b6
Show file tree
Hide file tree
Showing 412 changed files with 3,790 additions and 23,300 deletions.
10 changes: 10 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
Checks: >
-*,
performance-faster-string-find,
performance-for-range-copy,
WarningsAsErrors: '*'
HeaderFilterRegex: '/(?!external)/.*'
AnalyzeTemporaryDtors: false
FormatStyle: none
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,7 @@ tests/*/project/proj.android/.settings/org.eclipse.buildship.core.prefs
# tmp folder for temp usage
tmp/
temp/

# external libs zip
*.zip
**/simulator/
18 changes: 13 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ matrix:
include:
# linux
- os: linux
dist: xenial
env:
- BUILD_TARGET=linux
- GEN_BINDING_AND_COCOSFILE=true
Expand All @@ -10,6 +11,12 @@ matrix:
- secure: M5lyDs0qai15mWHzJdkh0WPfVJJmVZu6SWtYULxatukGPXVwoQvmEtYAwAW+iz6aM+tXksQ/mk6nW5L8UFbHm+n6yrsa5bZU9sGXjilPE8p8bLFYDmIbPRazU+E6pBP3J2CDoAm0XnWkiYQ8feTxKTo6ysLnHAEjyaHTw0+Q1GM=
sudo: required
language: cpp
# clang-tidy
- os: linux
dist: xenial
env: BUILD_TARGET=linux_clang_tidy
language: cpp
sudo: required
# mac_cmake
- os: osx
env: BUILD_TARGET=mac_cmake
Expand All @@ -24,7 +31,7 @@ matrix:
sudo: required
# android ndk-build
- os: linux
env: BUILD_TARGET=android_ndk-build
env: BUILD_TARGET=android_cpp_ndk-build
language: android
sudo: required
# android_lua ndk-build
Expand All @@ -34,7 +41,7 @@ matrix:
sudo: required
# android cmake
- os: linux
env: BUILD_TARGET=android_cmake
env: BUILD_TARGET=android_cpp_cmake
language: android
sudo: required
# android_lua cmake
Expand All @@ -60,11 +67,12 @@ matrix:
osx_image: xcode9.3
sudo: required
- os: linux
env: BUILD_TARGET=android_cocos_new_test
language: cpp
env: BUILD_TARGET=android_cocos_new_cpp_test
language: android
sudo: required
- os: linux
env: BUILD_TARGET=linux_cocos_new_test
dist: xenial
env: BUILD_TARGET=linux_cocos_new_lua_test
language: cpp
sudo: required

Expand Down
26 changes: 25 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
cocos2d-x-3.17.2 May.21 2019

[NEW] Network: added clear requests and responses method to httpclient
[NEW] UI: VideoPlayer added ability to enable/disable looping, resonding user input
[NEW] UI: VideoPlayer added function to set style
[NEW] IMEDispacher: added a function to check if any IME dispatcher is active
[NEW] Renderer: add a function to get current clearing color
[NEW] Lua: added binding codes for `EventDispathcer::addCustomEventListener()`

[REFINE] Android: added optimization codes for OPPO devcies
[REFINE] Network: improved websocket traces
[REFINE] Android: supported Android P cutout area
[REFINE] FontAtlas: font atlas texture initialization delayed
[REFINE] LOG: CCLOG may block thread on windows

[FIX] FileUtils:fixed a bug that `listFiles()` can not work correctly if the file path starts with `assets/` on Android
[FIX] AssetsManager: fixed a bug that `_percent` is always be 0 during the update process
[FIX] Texture2D: fixed memory leak if `Texture2D::setAlphaTexture()` is invoked many times
[FIX] FontAtlasCache: avoided crash if a file path is too long
[FIX] Audio: fixed crash on iOS
[FIX] UI: VideoPlayer could not play video in obb file on Android
[FIX] SpriteFrame: fixed performance issue in parsing plist files
[FIX] 3rd: unzip failed to uncompress files

cocos2d-x-3.17.1 Nov.19 2018

[REFINE] Renderer: properly reduce clear buffer times to save energy
Expand Down Expand Up @@ -69,7 +93,7 @@ cocos2d-x-3.17.1 Nov.19 2018
[FIX] Android: keep cocos2dx activity at task root by mark "singleTask" in manifest
[FIX] Android: fix crash caused by JNIEnv null pointer in getStringUTFCharsJNI function
[FIX] Android: use 'Binary names' style on JNI for ClassLoader.loadClass
[FIX] Android: allow cleartext HTTP traffic by default
[FIX] Android: allow cleartext HTTP traffic by default for all tests project
[FIX] Windows: Support VS2017 in release mode
[FIX] Action: fix repeat CallFunc for some times, may never stop
[FIX] Physics: fix PhysicsJointMotor setRate and getRate Bad Access Crash
Expand Down
15 changes: 10 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ AssureOutOfSourceBuilds()
# works before build libcocos2d
include(CocosBuildSet)

# build options
option(BUILD_TESTS "Build tests" ON)

# default tests include lua, js test project, so we set those option on to build libs
set(BUILD_LUA_LIBS ON)
set(BUILD_JS_LIBS ON)
Expand All @@ -50,8 +53,10 @@ add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core)
# prevent tests project to build "cocos2d-x/cocos" again
set(BUILD_ENGINE_DONE ON)
# add engine all tests project
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/cpp-empty-test ${ENGINE_BINARY_PATH}/tests/cpp-empty-test)
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/cpp-tests ${ENGINE_BINARY_PATH}/tests/cpp-tests)
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/js-tests/project ${ENGINE_BINARY_PATH}/tests/js-tests)
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/lua-empty-test/project ${ENGINE_BINARY_PATH}/tests/lua-empty-test)
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/lua-tests/project ${ENGINE_BINARY_PATH}/tests/lua-test)
if (BUILD_TESTS)
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/cpp-empty-test ${ENGINE_BINARY_PATH}/tests/cpp-empty-test)
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/cpp-tests ${ENGINE_BINARY_PATH}/tests/cpp-tests)
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/js-tests/project ${ENGINE_BINARY_PATH}/tests/js-tests)
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/lua-empty-test/project ${ENGINE_BINARY_PATH}/tests/lua-empty-test)
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/lua-tests/project ${ENGINE_BINARY_PATH}/tests/lua-test)
endif()
8 changes: 4 additions & 4 deletions build/cocos2d_libs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13718,7 +13718,7 @@
1551A34D158F2AB200E66CFE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
EXECUTABLE_EXTENSION = a;
Expand Down Expand Up @@ -13759,7 +13759,7 @@
1551A34E158F2AB200E66CFE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
EXECUTABLE_EXTENSION = a;
Expand Down Expand Up @@ -13872,7 +13872,7 @@
A07A4D621783777C0073F6A7 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
ENABLE_BITCODE = NO;
EXECUTABLE_PREFIX = "";
Expand Down Expand Up @@ -13909,7 +13909,7 @@
A07A4D631783777C0073F6A7 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
ENABLE_BITCODE = NO;
EXECUTABLE_PREFIX = "";
Expand Down
6 changes: 4 additions & 2 deletions build/cocos2d_tests.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7520,6 +7520,7 @@
1A0EE41118CDF775004CD58F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-cpp-empty-test";
CODE_SIGN_IDENTITY = "iPhone Developer";
ENABLE_BITCODE = NO;
Expand All @@ -7540,6 +7541,7 @@
1A0EE41218CDF775004CD58F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-cpp-empty-test";
CODE_SIGN_IDENTITY = "iPhone Developer";
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -8250,7 +8252,7 @@
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
COMBINE_HIDPI_IMAGES = YES;
Expand Down Expand Up @@ -8281,7 +8283,7 @@
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
COMBINE_HIDPI_IMAGES = YES;
Expand Down
49 changes: 1 addition & 48 deletions build/install-deps-linux.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/bash

# Change directory to the location of this script
echo "This Shell Script will install dependencies for cocos2d-x"
echo "if you execute this shell more than once it will get errors when building libGLFW.so"
echo -n "Are you continue? (y/n) "
read answer
if echo "$answer" | grep -iq "^y" ;then
Expand All @@ -11,24 +9,13 @@ else
exit
fi

cd $(dirname ${BASH_SOURCE[0]})

if [ ! $(command -v apt-get) ]; then
echo "Not a .deb package system. Please install dependencies manually"
exit 0
fi

#install g++-4.9
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y > /dev/null
sudo apt-get update

DEPENDS='libx11-dev'
DEPENDS+=' libxmu-dev'
DEPENDS+=' libglu1-mesa-dev'
DEPENDS+=' libgl2ps-dev'
DEPENDS+=' libxi-dev'
DEPENDS+=' gcc-4.9'
DEPENDS+=' g++-4.9'
DEPENDS+=' libzip-dev'
DEPENDS+=' libpng12-dev'
DEPENDS+=' libcurl4-gnutls-dev'
Expand All @@ -39,38 +26,4 @@ DEPENDS+=' libssl-dev'
DEPENDS+=' libgtk-3-dev'
DEPENDS+=' binutils'

MISSING=
echo "Checking for missing packages ..."
for i in $DEPENDS; do
if ! dpkg-query -W --showformat='${Status}\n' $i | grep "install ok installed" > /dev/null; then
MISSING+="$i "
fi
done

if [ -n "$MISSING" ]; then
TXTCOLOR_DEFAULT="\033[0;m"
TXTCOLOR_GREEN="\033[0;32m"
echo -e $TXTCOLOR_GREEN"Missing packages: $MISSING.\nYou may be asked for your password for package installation."$TXTCOLOR_DEFAULT
CUR_APT_VERSION="$(apt --version | grep -o '[0-9].[0-9]')"
REQ_APT_VERSION="1.1"
if [ 1 -ge "$(echo "${CUR_APT_VERSION} >= ${REQ_APT_VERSION}" | bc)" ]
then
sudo apt-get install --allow-change-held-packages $MISSING -y > /dev/null
else
sudo apt-get install --force-yes --yes $MISSING > /dev/null
fi
fi



sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 60

echo "Cocos uses GCC Version: `gcc --version`"
echo "Cocos uses G++ Version: `g++ --version`"
echo "Cocos uses ld Version: `ld --version`"
echo "Cocos uses /usr/bin/ld Version: `/usr/bin/ld --version`"

sudo apt-get install --force-yes --yes $DEPENDS > /dev/null
56 changes: 26 additions & 30 deletions cmake/Modules/CocosBuildHelpers.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
include(CMakeParseArguments)

# copy resource `FILES` and `FOLDERS` to `COPY_TO` folder
function(cocos_copy_res)
# copy resource `FILES` and `FOLDERS` to TARGET_FILE_DIR/Resources
function(cocos_copy_target_res cocos_target)
set(oneValueArgs COPY_TO)
set(multiValueArgs FILES FOLDERS)
cmake_parse_arguments(opt "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# copy files
foreach(cc_file ${opt_FILES})
get_filename_component(file_name ${cc_file} NAME)
configure_file(${cc_file} "${opt_COPY_TO}/${file_name}" COPYONLY)
add_custom_command(TARGET ${cocos_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "copy file into Resources: ${file_name} ..."
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${cc_file} "${opt_COPY_TO}/${file_name}"
)
endforeach()
# copy folders files
foreach(cc_folder ${opt_FOLDERS})
Expand All @@ -17,7 +20,10 @@ function(cocos_copy_res)
foreach(res_file ${folder_files})
get_filename_component(res_file_abs_path ${res_file} ABSOLUTE)
file(RELATIVE_PATH res_file_relat_path ${folder_abs_path} ${res_file_abs_path})
configure_file(${res_file} "${opt_COPY_TO}/${res_file_relat_path}" COPYONLY)
add_custom_command(TARGET ${cocos_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "copy file into Resources: ${res_file_relat_path} ..."
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${res_file} "${opt_COPY_TO}/${res_file_relat_path}"
)
endforeach()
endforeach()
endfunction()
Expand Down Expand Up @@ -79,8 +85,9 @@ function(get_target_depends_ext_dlls cocos_target all_depend_dlls_out)
search_depend_libs_recursive(${cocos_target} depend_libs)
foreach(depend_lib ${depend_libs})
if(TARGET ${depend_lib})
get_target_property(tmp_dlls ${depend_lib} CC_DEPEND_DLLS)
if(tmp_dlls)
get_target_property(found_shared_lib ${depend_lib} IMPORTED_IMPLIB)
if(found_shared_lib)
get_target_property(tmp_dlls ${depend_lib} IMPORTED_LOCATION)
list(APPEND all_depend_ext_dlls ${tmp_dlls})
endif()
endif()
Expand All @@ -89,20 +96,19 @@ function(get_target_depends_ext_dlls cocos_target all_depend_dlls_out)
set(${all_depend_dlls_out} ${all_depend_ext_dlls} PARENT_SCOPE)
endfunction()

# copy the `cocos_target` needed dlls into `COPY_TO` folder
# copy the `cocos_target` needed dlls into TARGET_FILE_DIR
function(cocos_copy_target_dll cocos_target)
set(oneValueArgs COPY_TO)
cmake_parse_arguments(opt "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
get_target_depends_ext_dlls(${cocos_target} all_depend_dlls)
# remove repeat items
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)
configure_file(${cc_dll_file} "${opt_COPY_TO}/${cc_dll_name}" COPYONLY)
add_custom_command(TARGET ${cocos_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "copy dll into target file dir: ${cc_dll_name} ..."
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${cc_dll_file} "$<TARGET_FILE_DIR:${cocos_target}>/${cc_dll_name}"
)
endforeach()
endfunction()

Expand Down Expand Up @@ -168,31 +174,21 @@ function(source_group_single_file single_file)
source_group("${ide_file_group}" FILES ${single_file})
endfunction()

# setup a cocos application, include "APP_BIN_DIR", "APP_RES_DIR" config
# setup a cocos application
function(setup_cocos_app_config app_name)
# set target PROPERTIES, depend different platforms
# put all output app into bin/${app_name}
set_target_properties(${app_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${app_name}")
if(APPLE)
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin")
set_target_properties(${app_name} PROPERTIES MACOSX_BUNDLE 1
)
# output macOS/iOS .app
set_target_properties(${app_name} PROPERTIES MACOSX_BUNDLE 1)
elseif(MSVC)
# only Debug and Release mode was supported when using MSVC.
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}/$<CONFIG>")
set(APP_RES_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}/${CMAKE_BUILD_TYPE}/Resources")
#Visual Studio Defaults to wrong type
set_target_properties(${app_name} PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")
else(LINUX)
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/${APP_NAME}")
set(APP_RES_DIR "${APP_BIN_DIR}/Resources")
# visual studio default is Console app, but we need Windows app
set_property(TARGET ${app_name} APPEND PROPERTY LINK_FLAGS "/SUBSYSTEM:WINDOWS")
endif()
set_target_properties(${app_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")

# auto mark code files for IDE when mark app
if(XCODE OR VS)
cocos_mark_code_files(${APP_NAME})
cocos_mark_code_files(${app_name})
endif()

set(APP_RES_DIR ${APP_RES_DIR} PARENT_SCOPE)
endfunction()

# if cc_variable not set, then set it cc_value
Expand Down
Loading

0 comments on commit e3ad9b6

Please sign in to comment.