From 9275dda539d61e4a1ca9fba48ae53becff35d047 Mon Sep 17 00:00:00 2001 From: leda Date: Tue, 24 Apr 2018 13:46:20 +0800 Subject: [PATCH] adjust android / linux build config for cocos CLI (#18780) * make android native build default mode clear * update android native build comment * temp change sub-module, need change before merge * change tests project cmake file dir * change PROP_BUILD_TYPE to PROP_BUILD_TYPE * change var name for build.gradle * modify others 3 tests project config * make compile_sdk_version same as target_sdk_version * update sdk version in CI config script * update sub-module to cocos2d * let the cmake build of template project more clear * update cocos-console submodule --- cmake/README.md | 9 +++++---- templates/cpp-template-default/CMakeLists.txt | 15 +++++++-------- .../proj.android/app/build.gradle | 10 ++++------ .../proj.android/gradle.properties | 11 ++++++----- templates/js-template-default/CMakeLists.txt | 16 +++++++--------- .../runtime-src/proj.android/app/build.gradle | 10 ++++------ .../runtime-src/proj.android/gradle.properties | 11 ++++++----- .../gradle/wrapper/gradle-wrapper.properties | 2 +- templates/lua-template-default/CMakeLists.txt | 18 ++++++++---------- .../runtime-src/proj.android/app/build.gradle | 10 ++++------ .../runtime-src/proj.android/gradle.properties | 11 ++++++----- tests/CMakeLists.txt | 10 ---------- tests/cpp-empty-test/.cocos-project.json | 5 +---- .../proj.android/app/build.gradle | 10 ++++------ .../proj.android/gradle.properties | 11 ++++++----- tests/cpp-tests/.cocos-project.json | 5 +---- tests/cpp-tests/proj.android/app/build.gradle | 10 ++++------ tests/cpp-tests/proj.android/gradle.properties | 11 ++++++----- .../proj.android/app/build.gradle | 6 ++---- .../proj.android/gradle.properties | 9 +++++++-- tests/js-tests/.cocos-project.json | 4 +--- .../project/proj.android/app/build.gradle | 10 ++++------ .../project/proj.android/gradle.properties | 11 ++++++----- tests/lua-empty-test/.cocos-project.json | 4 +--- .../project/proj.android/app/build.gradle | 10 ++++------ .../project/proj.android/gradle.properties | 11 ++++++----- .../project/proj.android/app/build.gradle | 6 ++---- .../project/proj.android/gradle.properties | 9 +++++++-- tests/lua-tests/.cocos-project.json | 4 +--- .../project/proj.android/app/build.gradle | 10 ++++------ .../project/proj.android/gradle.properties | 11 ++++++----- .../proj.android/app/build.gradle | 6 ++---- .../proj.android/gradle.properties | 9 +++++++-- tools/appveyor-scripts/setup_android.py | 4 ++-- tools/cocos2d-console | 2 +- 35 files changed, 143 insertions(+), 168 deletions(-) diff --git a/cmake/README.md b/cmake/README.md index 0908ad2d68..982975dcdc 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -57,10 +57,11 @@ The default build is for iOS device, if you want to run on simulator, please add We use the Gradle to Android applacition, and Gradle use cmake to build the native code, see the [property](https://github.com/cocos2d/cocos2d-x/blob/84be684e3858393a6f3efc50e3f95d4e0ac92a20/tests/cpp-empty-test/proj.android/gradle.properties#L38): `PROP_NDK_MODE`, it control the way of native build ```sh -# android cmake support -# uncomment it, native code will build by cmake -# keep comment, native code will build by ndkBuild -#PROP_NDK_MODE=cmake +# android native code build type +# none, native code will never be compiled. +# cmake, native code will be compiled by CMakeLists.txt +# ndk-build, native code will be compiled by Android.mk +PROP_BUILD_TYPE=ndk-build ``` If you want to add cmake build arguments, please add it at [externalNativeBuild](https://github.com/cocos2d/cocos2d-x/blob/84be684e3858393a6f3efc50e3f95d4e0ac92a20/tests/cpp-empty-test/proj.android/app/build.gradle#L25) block of [app/build.gradle] file. diff --git a/templates/cpp-template-default/CMakeLists.txt b/templates/cpp-template-default/CMakeLists.txt index e64e113a93..6da81efe9a 100644 --- a/templates/cpp-template-default/CMakeLists.txt +++ b/templates/cpp-template-default/CMakeLists.txt @@ -29,15 +29,14 @@ set(APP_NAME TemplateCpp) project (${APP_NAME}) -if(NOT DEFINED BUILD_ENGINE_DONE) - set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cocos2d) - set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) +set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cocos2d) +set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) - include(CocosBuildSet) - CocosBuildSet() - if(NOT USE_COCOS_PREBUILT) - add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) - endif() +include(CocosBuildSet) +CocosBuildSet() + +if(NOT USE_COCOS_PREBUILT) + add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) endif() # record sources, headers, resources... diff --git a/templates/cpp-template-default/proj.android/app/build.gradle b/templates/cpp-template-default/proj.android/app/build.gradle index d62819a034..f31528e629 100644 --- a/templates/cpp-template-default/proj.android/app/build.gradle +++ b/templates/cpp-template-default/proj.android/app/build.gradle @@ -14,15 +14,14 @@ android { versionName "1.0" externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none targets 'MyGame' arguments 'NDK_TOOLCHAIN_VERSION=clang' arguments '-j' + Runtime.runtime.availableProcessors() } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { targets 'MyGame' arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \ @@ -51,13 +50,12 @@ android { } externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none path "jni/Android.mk" } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { path "../../CMakeLists.txt" } diff --git a/templates/cpp-template-default/proj.android/gradle.properties b/templates/cpp-template-default/proj.android/gradle.properties index 8b017de604..f234b82087 100644 --- a/templates/cpp-template-default/proj.android/gradle.properties +++ b/templates/cpp-template-default/proj.android/gradle.properties @@ -18,7 +18,7 @@ # org.gradle.parallel=true # Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=25 +PROP_COMPILE_SDK_VERSION=27 # Android SDK version that will be used as the earliest version of android this application can run on PROP_MIN_SDK_VERSION=14 @@ -35,10 +35,11 @@ PROP_BUILD_TOOLS_VERSION=27.0.1 # Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 PROP_APP_ABI=armeabi-v7a -# android cmake support -# uncomment it, native code will build by cmake -# keep comment, native code will build by ndkBuild -#PROP_NDK_MODE=cmake +# android native code build type +# none, native code will never be compiled. +# cmake, native code will be compiled by CMakeLists.txt +# ndk-build, native code will be compiled by Android.mk +PROP_BUILD_TYPE=ndk-build # uncomment it and fill in sign information for release mode #RELEASE_STORE_FILE=file path of keystore diff --git a/templates/js-template-default/CMakeLists.txt b/templates/js-template-default/CMakeLists.txt index 98af467872..ac309cde33 100644 --- a/templates/js-template-default/CMakeLists.txt +++ b/templates/js-template-default/CMakeLists.txt @@ -31,17 +31,15 @@ set(APP_NAME TemplateJS) project(${APP_NAME}) set(RUNTIME_SRC_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/runtime-src) +set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/cocos2d-x) +set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) -if(NOT DEFINED BUILD_ENGINE_DONE) - set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/cocos2d-x) - set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) +include(CocosBuildSet) +CocosBuildSet() - include(CocosBuildSet) - CocosBuildSet() - if(NOT USE_COCOS_PREBUILT) - set(BUILD_JS_LIBS ON) - add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) - endif(NOT USE_COCOS_PREBUILT) +if(NOT USE_COCOS_PREBUILT) + set(BUILD_JS_LIBS ON) + add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) endif() # script and source files info, not need to compile diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/app/build.gradle b/templates/js-template-default/frameworks/runtime-src/proj.android/app/build.gradle index b053d6ec96..65565a5b3c 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.android/app/build.gradle +++ b/templates/js-template-default/frameworks/runtime-src/proj.android/app/build.gradle @@ -14,15 +14,14 @@ android { versionName "1.0" externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none targets 'cocos2djs' arguments 'NDK_TOOLCHAIN_VERSION=clang' arguments '-j' + Runtime.runtime.availableProcessors() } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \ "-DUSE_CHIPMUNK=TRUE", "-DUSE_BULLET=TRUE", "-DBUILD_JS_LIBS=TRUE" @@ -49,13 +48,12 @@ android { } externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none path "jni/Android.mk" } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { path "../../../../CMakeLists.txt" } diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/gradle.properties b/templates/js-template-default/frameworks/runtime-src/proj.android/gradle.properties index 8b017de604..f234b82087 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.android/gradle.properties +++ b/templates/js-template-default/frameworks/runtime-src/proj.android/gradle.properties @@ -18,7 +18,7 @@ # org.gradle.parallel=true # Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=25 +PROP_COMPILE_SDK_VERSION=27 # Android SDK version that will be used as the earliest version of android this application can run on PROP_MIN_SDK_VERSION=14 @@ -35,10 +35,11 @@ PROP_BUILD_TOOLS_VERSION=27.0.1 # Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 PROP_APP_ABI=armeabi-v7a -# android cmake support -# uncomment it, native code will build by cmake -# keep comment, native code will build by ndkBuild -#PROP_NDK_MODE=cmake +# android native code build type +# none, native code will never be compiled. +# cmake, native code will be compiled by CMakeLists.txt +# ndk-build, native code will be compiled by Android.mk +PROP_BUILD_TYPE=ndk-build # uncomment it and fill in sign information for release mode #RELEASE_STORE_FILE=file path of keystore diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties b/templates/js-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties index e171624e52..792cc6758f 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/templates/js-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip diff --git a/templates/lua-template-default/CMakeLists.txt b/templates/lua-template-default/CMakeLists.txt index 48745e89d7..0eab1bf093 100644 --- a/templates/lua-template-default/CMakeLists.txt +++ b/templates/lua-template-default/CMakeLists.txt @@ -28,18 +28,16 @@ set(APP_NAME TemplateLua) project(${APP_NAME}) set(RUNTIME_SRC_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/runtime-src) +set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/cocos2d-x) +set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) -if(NOT DEFINED BUILD_ENGINE_DONE) - set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/cocos2d-x) - set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) +include(CocosBuildSet) +CocosBuildSet() - include(CocosBuildSet) - CocosBuildSet() - if(NOT USE_COCOS_PREBUILT) - set(BUILD_LUA_LIBS ON) - set(BUILD_SIMU_LIB ON) - add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) - endif() +if(NOT USE_COCOS_PREBUILT) + set(BUILD_LUA_LIBS ON) + set(BUILD_SIMU_LIB ON) + add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) endif() # script and source files info, not need to compile diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/build.gradle b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/build.gradle index 88fa61878e..93b0b16e7d 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/build.gradle +++ b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/build.gradle @@ -14,15 +14,14 @@ android { versionName "1.0" externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none targets 'cocos2dlua' arguments 'NDK_TOOLCHAIN_VERSION=clang' arguments '-j' + Runtime.runtime.availableProcessors() } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \ "-DUSE_CHIPMUNK=TRUE", "-DUSE_BULLET=TRUE", "-DBUILD_LUA_LIBS=TRUE" @@ -50,13 +49,12 @@ android { } externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none path "jni/Android.mk" } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { path "../../../../CMakeLists.txt" } diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/gradle.properties b/templates/lua-template-default/frameworks/runtime-src/proj.android/gradle.properties index 8b017de604..f234b82087 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.android/gradle.properties +++ b/templates/lua-template-default/frameworks/runtime-src/proj.android/gradle.properties @@ -18,7 +18,7 @@ # org.gradle.parallel=true # Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=25 +PROP_COMPILE_SDK_VERSION=27 # Android SDK version that will be used as the earliest version of android this application can run on PROP_MIN_SDK_VERSION=14 @@ -35,10 +35,11 @@ PROP_BUILD_TOOLS_VERSION=27.0.1 # Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 PROP_APP_ABI=armeabi-v7a -# android cmake support -# uncomment it, native code will build by cmake -# keep comment, native code will build by ndkBuild -#PROP_NDK_MODE=cmake +# android native code build type +# none, native code will never be compiled. +# cmake, native code will be compiled by CMakeLists.txt +# ndk-build, native code will be compiled by Android.mk +PROP_BUILD_TYPE=ndk-build # uncomment it and fill in sign information for release mode #RELEASE_STORE_FILE=file path of keystore diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2043a5a637..bc896b1791 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -39,13 +39,3 @@ add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/js-tests/project ${ENGINE_BINARY_PA 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) - -# # temp feature: add engine all template project, as the test project, it make template project test easier -# add_subdirectory(${COCOS2DX_ROOT_PATH}/templates/cpp-template-default ${ENGINE_BINARY_PATH}/template/cpp-template-default) - -# add_subdirectory(${COCOS2DX_ROOT_PATH}/templates/js-template-default ${ENGINE_BINARY_PATH}/template/js-template-default) - -# # TODO: run on Windows exist defect, need to check later -# add_subdirectory(${COCOS2DX_ROOT_PATH}/templates/lua-template-default ${ENGINE_BINARY_PATH}/template/lua-template-default) - - diff --git a/tests/cpp-empty-test/.cocos-project.json b/tests/cpp-empty-test/.cocos-project.json index 0f82f0d79f..ee51a259d7 100644 --- a/tests/cpp-empty-test/.cocos-project.json +++ b/tests/cpp-empty-test/.cocos-project.json @@ -8,10 +8,7 @@ }, "linux_cfg": { "project_path": "proj.linux", - "project_name": "cpp-empty-test", - "cmake_path": "../../", - "build_dir": "../../build/linux-build", - "build_result_dir": "cpp-empty-test" + "project_name": "cpp-empty-test" }, "ios_cfg": { "project_path": "../../build", diff --git a/tests/cpp-empty-test/proj.android/app/build.gradle b/tests/cpp-empty-test/proj.android/app/build.gradle index e9a69ae16b..4cfdf3b529 100644 --- a/tests/cpp-empty-test/proj.android/app/build.gradle +++ b/tests/cpp-empty-test/proj.android/app/build.gradle @@ -14,15 +14,14 @@ android { versionName "1.0" externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none targets 'cpp_empty_test' arguments 'NDK_TOOLCHAIN_VERSION=clang' arguments '-j' + Runtime.runtime.availableProcessors() } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { targets "cpp_empty_test" arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", @@ -51,13 +50,12 @@ android { } externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none path "jni/Android.mk" } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { path "../../CMakeLists.txt" } diff --git a/tests/cpp-empty-test/proj.android/gradle.properties b/tests/cpp-empty-test/proj.android/gradle.properties index 8b017de604..f234b82087 100644 --- a/tests/cpp-empty-test/proj.android/gradle.properties +++ b/tests/cpp-empty-test/proj.android/gradle.properties @@ -18,7 +18,7 @@ # org.gradle.parallel=true # Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=25 +PROP_COMPILE_SDK_VERSION=27 # Android SDK version that will be used as the earliest version of android this application can run on PROP_MIN_SDK_VERSION=14 @@ -35,10 +35,11 @@ PROP_BUILD_TOOLS_VERSION=27.0.1 # Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 PROP_APP_ABI=armeabi-v7a -# android cmake support -# uncomment it, native code will build by cmake -# keep comment, native code will build by ndkBuild -#PROP_NDK_MODE=cmake +# android native code build type +# none, native code will never be compiled. +# cmake, native code will be compiled by CMakeLists.txt +# ndk-build, native code will be compiled by Android.mk +PROP_BUILD_TYPE=ndk-build # uncomment it and fill in sign information for release mode #RELEASE_STORE_FILE=file path of keystore diff --git a/tests/cpp-tests/.cocos-project.json b/tests/cpp-tests/.cocos-project.json index 78f9f5b3de..e3ca562bd0 100644 --- a/tests/cpp-tests/.cocos-project.json +++ b/tests/cpp-tests/.cocos-project.json @@ -8,10 +8,7 @@ }, "linux_cfg": { "project_path": "proj.linux", - "project_name": "cpp-tests", - "cmake_path": "../../", - "build_dir": "../../build/linux-build", - "build_result_dir": "cpp-tests" + "project_name": "cpp-tests" }, "ios_cfg": { "project_path": "../../build", diff --git a/tests/cpp-tests/proj.android/app/build.gradle b/tests/cpp-tests/proj.android/app/build.gradle index 5a3eb2aec4..f1c2fd8341 100644 --- a/tests/cpp-tests/proj.android/app/build.gradle +++ b/tests/cpp-tests/proj.android/app/build.gradle @@ -14,15 +14,14 @@ android { versionName "1.0" externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none targets 'cpp_tests' arguments 'NDK_TOOLCHAIN_VERSION=clang' arguments '-j' + Runtime.runtime.availableProcessors() } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { targets 'cpp_tests' arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \ @@ -50,13 +49,12 @@ android { } externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none path "jni/Android.mk" } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { path "../../CMakeLists.txt" } diff --git a/tests/cpp-tests/proj.android/gradle.properties b/tests/cpp-tests/proj.android/gradle.properties index 8b017de604..f234b82087 100644 --- a/tests/cpp-tests/proj.android/gradle.properties +++ b/tests/cpp-tests/proj.android/gradle.properties @@ -18,7 +18,7 @@ # org.gradle.parallel=true # Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=25 +PROP_COMPILE_SDK_VERSION=27 # Android SDK version that will be used as the earliest version of android this application can run on PROP_MIN_SDK_VERSION=14 @@ -35,10 +35,11 @@ PROP_BUILD_TOOLS_VERSION=27.0.1 # Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 PROP_APP_ABI=armeabi-v7a -# android cmake support -# uncomment it, native code will build by cmake -# keep comment, native code will build by ndkBuild -#PROP_NDK_MODE=cmake +# android native code build type +# none, native code will never be compiled. +# cmake, native code will be compiled by CMakeLists.txt +# ndk-build, native code will be compiled by Android.mk +PROP_BUILD_TYPE=ndk-build # uncomment it and fill in sign information for release mode #RELEASE_STORE_FILE=file path of keystore diff --git a/tests/game-controller-test/proj.android/app/build.gradle b/tests/game-controller-test/proj.android/app/build.gradle index 76d66c996d..3be0118975 100644 --- a/tests/game-controller-test/proj.android/app/build.gradle +++ b/tests/game-controller-test/proj.android/app/build.gradle @@ -15,8 +15,7 @@ android { externalNativeBuild { ndkBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) { - // skip the NDK Build step if PROP_NDK_MODE is none + if (PROP_BUILD_TYPE == 'ndk-build') { targets 'game_controller_test' arguments 'NDK_TOOLCHAIN_VERSION=clang' arguments '-j' + Runtime.runtime.availableProcessors() @@ -34,8 +33,7 @@ android { externalNativeBuild { ndkBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) { - // skip the NDK Build step if PROP_NDK_MODE is none + if (PROP_BUILD_TYPE == 'ndk-build') { path "jni/Android.mk" } } diff --git a/tests/game-controller-test/proj.android/gradle.properties b/tests/game-controller-test/proj.android/gradle.properties index 846f5a4bb1..81ff4ef4eb 100644 --- a/tests/game-controller-test/proj.android/gradle.properties +++ b/tests/game-controller-test/proj.android/gradle.properties @@ -18,7 +18,7 @@ # org.gradle.parallel=true # Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=25 +PROP_COMPILE_SDK_VERSION=27 # Android SDK version that will be used as the earliest version of android this application can run on PROP_MIN_SDK_VERSION=14 @@ -33,7 +33,12 @@ PROP_BUILD_TOOLS_VERSION=27.0.1 # Available architextures (armeabi | armeabi-v7a | arm64-v8a | x86) # To build for multiple architexture, use the `:` between them # Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 -PROP_APP_ABI=armeabi +PROP_APP_ABI=armeabi-v7a + +# android native code build type +# none, native code will never be compiled. +# ndk-build, native code will be compiled by Android.mk +PROP_BUILD_TYPE=ndk-build # uncomment it and fill in sign information for release mode #RELEASE_STORE_FILE=file path of keystore diff --git a/tests/js-tests/.cocos-project.json b/tests/js-tests/.cocos-project.json index b62bcef23e..2f8d56f2b2 100644 --- a/tests/js-tests/.cocos-project.json +++ b/tests/js-tests/.cocos-project.json @@ -40,9 +40,7 @@ "linux_cfg": { "project_path": "project/proj.linux", "project_name": "js-tests", - "cmake_path": "../../", - "build_dir": "../../build/linux-build", - "build_result_dir": "js-tests" + "cmake_path": "project" }, "wp8_1_cfg" : { "project_path": "../../build", diff --git a/tests/js-tests/project/proj.android/app/build.gradle b/tests/js-tests/project/proj.android/app/build.gradle index 70f4dc2621..329bfb882c 100644 --- a/tests/js-tests/project/proj.android/app/build.gradle +++ b/tests/js-tests/project/proj.android/app/build.gradle @@ -12,15 +12,14 @@ android { versionName "1.0" externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none targets 'js_tests' arguments 'NDK_TOOLCHAIN_VERSION=clang' arguments '-j' + Runtime.runtime.availableProcessors() } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { targets "js_tests" arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \ @@ -48,13 +47,12 @@ android { } externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none path "jni/Android.mk" } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { path "../../CMakeLists.txt" } diff --git a/tests/js-tests/project/proj.android/gradle.properties b/tests/js-tests/project/proj.android/gradle.properties index 8b017de604..f234b82087 100644 --- a/tests/js-tests/project/proj.android/gradle.properties +++ b/tests/js-tests/project/proj.android/gradle.properties @@ -18,7 +18,7 @@ # org.gradle.parallel=true # Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=25 +PROP_COMPILE_SDK_VERSION=27 # Android SDK version that will be used as the earliest version of android this application can run on PROP_MIN_SDK_VERSION=14 @@ -35,10 +35,11 @@ PROP_BUILD_TOOLS_VERSION=27.0.1 # Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 PROP_APP_ABI=armeabi-v7a -# android cmake support -# uncomment it, native code will build by cmake -# keep comment, native code will build by ndkBuild -#PROP_NDK_MODE=cmake +# android native code build type +# none, native code will never be compiled. +# cmake, native code will be compiled by CMakeLists.txt +# ndk-build, native code will be compiled by Android.mk +PROP_BUILD_TYPE=ndk-build # uncomment it and fill in sign information for release mode #RELEASE_STORE_FILE=file path of keystore diff --git a/tests/lua-empty-test/.cocos-project.json b/tests/lua-empty-test/.cocos-project.json index a7ce63f9ff..e8b6cedd06 100644 --- a/tests/lua-empty-test/.cocos-project.json +++ b/tests/lua-empty-test/.cocos-project.json @@ -9,9 +9,7 @@ "linux_cfg": { "project_path": "project/proj.linux", "project_name": "lua-empty-test", - "cmake_path": "../../", - "build_dir": "../../build/linux-build", - "build_result_dir": "lua-empty-test" + "cmake_path": "project" }, "ios_cfg": { "project_path": "../../build", diff --git a/tests/lua-empty-test/project/proj.android/app/build.gradle b/tests/lua-empty-test/project/proj.android/app/build.gradle index 36def1422b..f4a768480f 100644 --- a/tests/lua-empty-test/project/proj.android/app/build.gradle +++ b/tests/lua-empty-test/project/proj.android/app/build.gradle @@ -14,15 +14,14 @@ android { versionName "1.0" externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none targets 'lua_empty_test' arguments 'NDK_TOOLCHAIN_VERSION=clang' arguments '-j' + Runtime.runtime.availableProcessors() } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { targets "lua_empty_test" arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \ @@ -50,13 +49,12 @@ android { } externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none path "jni/Android.mk" } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { path "../../CMakeLists.txt" } diff --git a/tests/lua-empty-test/project/proj.android/gradle.properties b/tests/lua-empty-test/project/proj.android/gradle.properties index 8b017de604..f234b82087 100644 --- a/tests/lua-empty-test/project/proj.android/gradle.properties +++ b/tests/lua-empty-test/project/proj.android/gradle.properties @@ -18,7 +18,7 @@ # org.gradle.parallel=true # Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=25 +PROP_COMPILE_SDK_VERSION=27 # Android SDK version that will be used as the earliest version of android this application can run on PROP_MIN_SDK_VERSION=14 @@ -35,10 +35,11 @@ PROP_BUILD_TOOLS_VERSION=27.0.1 # Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 PROP_APP_ABI=armeabi-v7a -# android cmake support -# uncomment it, native code will build by cmake -# keep comment, native code will build by ndkBuild -#PROP_NDK_MODE=cmake +# android native code build type +# none, native code will never be compiled. +# cmake, native code will be compiled by CMakeLists.txt +# ndk-build, native code will be compiled by Android.mk +PROP_BUILD_TYPE=ndk-build # uncomment it and fill in sign information for release mode #RELEASE_STORE_FILE=file path of keystore diff --git a/tests/lua-game-controller-test/project/proj.android/app/build.gradle b/tests/lua-game-controller-test/project/proj.android/app/build.gradle index 00a8f7a298..4a650e9380 100644 --- a/tests/lua-game-controller-test/project/proj.android/app/build.gradle +++ b/tests/lua-game-controller-test/project/proj.android/app/build.gradle @@ -15,8 +15,7 @@ android { externalNativeBuild { ndkBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) { - // skip the NDK Build step if PROP_NDK_MODE is none + if (PROP_BUILD_TYPE == 'ndk-build') { targets 'lua_game_controller' arguments 'NDK_TOOLCHAIN_VERSION=clang' arguments '-j' + Runtime.runtime.availableProcessors() @@ -34,8 +33,7 @@ android { externalNativeBuild { ndkBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) { - // skip the NDK Build step if PROP_NDK_MODE is none + if (PROP_BUILD_TYPE == 'ndk-build') { path "jni/Android.mk" } } diff --git a/tests/lua-game-controller-test/project/proj.android/gradle.properties b/tests/lua-game-controller-test/project/proj.android/gradle.properties index 846f5a4bb1..81ff4ef4eb 100644 --- a/tests/lua-game-controller-test/project/proj.android/gradle.properties +++ b/tests/lua-game-controller-test/project/proj.android/gradle.properties @@ -18,7 +18,7 @@ # org.gradle.parallel=true # Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=25 +PROP_COMPILE_SDK_VERSION=27 # Android SDK version that will be used as the earliest version of android this application can run on PROP_MIN_SDK_VERSION=14 @@ -33,7 +33,12 @@ PROP_BUILD_TOOLS_VERSION=27.0.1 # Available architextures (armeabi | armeabi-v7a | arm64-v8a | x86) # To build for multiple architexture, use the `:` between them # Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 -PROP_APP_ABI=armeabi +PROP_APP_ABI=armeabi-v7a + +# android native code build type +# none, native code will never be compiled. +# ndk-build, native code will be compiled by Android.mk +PROP_BUILD_TYPE=ndk-build # uncomment it and fill in sign information for release mode #RELEASE_STORE_FILE=file path of keystore diff --git a/tests/lua-tests/.cocos-project.json b/tests/lua-tests/.cocos-project.json index f52292b7a1..507df64534 100644 --- a/tests/lua-tests/.cocos-project.json +++ b/tests/lua-tests/.cocos-project.json @@ -9,9 +9,7 @@ "linux_cfg": { "project_path": "project/proj.linux", "project_name": "lua-tests", - "cmake_path": "../../", - "build_dir": "../../build/linux-build", - "build_result_dir": "lua-tests" + "cmake_path": "project" }, "ios_cfg": { "project_path": "../../build", diff --git a/tests/lua-tests/project/proj.android/app/build.gradle b/tests/lua-tests/project/proj.android/app/build.gradle index 4179059357..262fa57c29 100644 --- a/tests/lua-tests/project/proj.android/app/build.gradle +++ b/tests/lua-tests/project/proj.android/app/build.gradle @@ -14,15 +14,14 @@ android { versionName "1.0" externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none targets 'lua_tests' arguments 'NDK_TOOLCHAIN_VERSION=clang' arguments '-j' + Runtime.runtime.availableProcessors() } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { targets 'lua_tests' arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \ @@ -50,13 +49,12 @@ android { } externalNativeBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE == 'ndk') { + if (PROP_BUILD_TYPE == 'ndk-build') { ndkBuild { - // skip the NDK Build step if PROP_NDK_MODE is none path "jni/Android.mk" } } - else if (PROP_NDK_MODE == 'cmake') { + else if (PROP_BUILD_TYPE == 'cmake') { cmake { path "../../CMakeLists.txt" } diff --git a/tests/lua-tests/project/proj.android/gradle.properties b/tests/lua-tests/project/proj.android/gradle.properties index 8b017de604..f234b82087 100644 --- a/tests/lua-tests/project/proj.android/gradle.properties +++ b/tests/lua-tests/project/proj.android/gradle.properties @@ -18,7 +18,7 @@ # org.gradle.parallel=true # Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=25 +PROP_COMPILE_SDK_VERSION=27 # Android SDK version that will be used as the earliest version of android this application can run on PROP_MIN_SDK_VERSION=14 @@ -35,10 +35,11 @@ PROP_BUILD_TOOLS_VERSION=27.0.1 # Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 PROP_APP_ABI=armeabi-v7a -# android cmake support -# uncomment it, native code will build by cmake -# keep comment, native code will build by ndkBuild -#PROP_NDK_MODE=cmake +# android native code build type +# none, native code will never be compiled. +# cmake, native code will be compiled by CMakeLists.txt +# ndk-build, native code will be compiled by Android.mk +PROP_BUILD_TYPE=ndk-build # uncomment it and fill in sign information for release mode #RELEASE_STORE_FILE=file path of keystore diff --git a/tests/performance-tests/proj.android/app/build.gradle b/tests/performance-tests/proj.android/app/build.gradle index 3e619cde97..79e9582d18 100644 --- a/tests/performance-tests/proj.android/app/build.gradle +++ b/tests/performance-tests/proj.android/app/build.gradle @@ -15,8 +15,7 @@ android { externalNativeBuild { ndkBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) { - // skip the NDK Build step if PROP_NDK_MODE is none + if (PROP_BUILD_TYPE == 'ndk-build') { targets 'cocos2dcpp' arguments 'NDK_TOOLCHAIN_VERSION=clang' arguments '-j' + Runtime.runtime.availableProcessors() @@ -35,8 +34,7 @@ android { externalNativeBuild { ndkBuild { - if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) { - // skip the NDK Build step if PROP_NDK_MODE is none + if (PROP_BUILD_TYPE == 'ndk-build') { path "jni/Android.mk" } } diff --git a/tests/performance-tests/proj.android/gradle.properties b/tests/performance-tests/proj.android/gradle.properties index 846f5a4bb1..81ff4ef4eb 100644 --- a/tests/performance-tests/proj.android/gradle.properties +++ b/tests/performance-tests/proj.android/gradle.properties @@ -18,7 +18,7 @@ # org.gradle.parallel=true # Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=25 +PROP_COMPILE_SDK_VERSION=27 # Android SDK version that will be used as the earliest version of android this application can run on PROP_MIN_SDK_VERSION=14 @@ -33,7 +33,12 @@ PROP_BUILD_TOOLS_VERSION=27.0.1 # Available architextures (armeabi | armeabi-v7a | arm64-v8a | x86) # To build for multiple architexture, use the `:` between them # Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86 -PROP_APP_ABI=armeabi +PROP_APP_ABI=armeabi-v7a + +# android native code build type +# none, native code will never be compiled. +# ndk-build, native code will be compiled by Android.mk +PROP_BUILD_TYPE=ndk-build # uncomment it and fill in sign information for release mode #RELEASE_STORE_FILE=file path of keystore diff --git a/tools/appveyor-scripts/setup_android.py b/tools/appveyor-scripts/setup_android.py index 0447b8b29e..84ca5529f2 100644 --- a/tools/appveyor-scripts/setup_android.py +++ b/tools/appveyor-scripts/setup_android.py @@ -82,8 +82,8 @@ def install_android_sdk(): switches = " --verbose --sdk_root=" + ANDROID_SDK + " " cmd1 = SDK_MANAGER + switches packages = [ - "platforms;android-15", - "build-tools;25.0.0", + "platforms;android-27", + "build-tools;27.0.1", "platform-tools", "tools" ] diff --git a/tools/cocos2d-console b/tools/cocos2d-console index 03d1f8d291..1b69aa81a0 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit 03d1f8d291ed63439918fa4b180c7b9d698a2bfd +Subproject commit 1b69aa81a05d727cd15d5d41c94c0e7332bb622e