From 2a65ceef86675034d0eae3be18fe4c4faec7d24a Mon Sep 17 00:00:00 2001 From: coulsonwang Date: Mon, 11 May 2020 15:15:02 +0800 Subject: [PATCH] fix ci compile issue (#2433) * fix CI compil issue * fix CI compile issue * fix ANDROID_PLATFORM * fix macors --- native/.travis.yml | 24 +++++++++---------- native/cocos/renderer/core/CoreDef.h | 8 +++---- native/cocos/renderer/gfx-metal/MTLDevice.h | 1 + .../js-bindings/manual/jsb_gfx_manual.cpp | 10 ++++---- native/external/config.json | 2 +- .../proj.android-studio/app/build.gradle | 2 +- 6 files changed, 25 insertions(+), 22 deletions(-) diff --git a/native/.travis.yml b/native/.travis.yml index efcb071e60..432b72c718 100644 --- a/native/.travis.yml +++ b/native/.travis.yml @@ -6,18 +6,18 @@ matrix: env: - BUILD_TARGET=windows_cmake language: cpp - # - os: osx - # env: - # - BUILD_TARGET=macosx_cmake - # language: cpp - # osx_image: xcode10.3 - # sudo: required - # - os: osx - # env: - # - BUILD_TARGET=ios_cmake - # language: cpp - # osx_image: xcode10.3 - # sudo: required + - os: osx + env: + - BUILD_TARGET=macosx_cmake + language: cpp + osx_image: xcode10.3 + sudo: required + - os: osx + env: + - BUILD_TARGET=ios_cmake + language: cpp + osx_image: xcode10.3 + sudo: required - os: linux dist: xenial sudo: required diff --git a/native/cocos/renderer/core/CoreDef.h b/native/cocos/renderer/core/CoreDef.h index 108da80821..352838040b 100755 --- a/native/cocos/renderer/core/CoreDef.h +++ b/native/cocos/renderer/core/CoreDef.h @@ -306,15 +306,15 @@ Note: #define CC_TOSTR(s) #s #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) -//# ifdef CC_STATIC -//# define CC_CORE_API -//# else +# ifdef CC_STATIC +# define CC_CORE_API +# else # ifdef CC_CORE_EXPORTS # define CC_CORE_API __declspec(dllexport) # else # define CC_CORE_API __declspec(dllimport) # endif -//# endif +# endif #else # define CC_CORE_API #endif diff --git a/native/cocos/renderer/gfx-metal/MTLDevice.h b/native/cocos/renderer/gfx-metal/MTLDevice.h index b3d20d3742..522f33716c 100644 --- a/native/cocos/renderer/gfx-metal/MTLDevice.h +++ b/native/cocos/renderer/gfx-metal/MTLDevice.h @@ -13,6 +13,7 @@ public: virtual bool initialize(const GFXDeviceInfo& info) override; virtual void destroy() override; virtual void resize(uint width, uint height) override; + virtual void begin() override {}; virtual void present() override; virtual GFXWindow* createWindow(const GFXWindowInfo& info) override; virtual GFXQueue* createQueue(const GFXQueueInfo& info) override; diff --git a/native/cocos/scripting/js-bindings/manual/jsb_gfx_manual.cpp b/native/cocos/scripting/js-bindings/manual/jsb_gfx_manual.cpp index d53dc99953..650d1a20d0 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_gfx_manual.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_gfx_manual.cpp @@ -9,6 +9,10 @@ #if (CC_PLATFORM == CC_PLATFORM_ANDROID || CC_PLATFORM == CC_PLATFORM_WINDOWS) #define USE_GLES2 +#elif (CC_PLATFORM == CC_PLATFORM_MAC_IOS) +#define USE_GLES3 +#else +#define USE_METAL #endif #ifdef USE_GLES2 @@ -726,13 +730,11 @@ bool register_all_gfx_manual(se::Object* obj) register_all_gles2(obj); __jsb_cocos2d_GLES2Device_proto->defineFunction("copyBuffersToTexture", _SE(js_gfx_GLES2Device_copyBuffersToTexture)); __jsb_cocos2d_GLES2Device_proto->defineFunction("copyTexImagesToTexture", _SE(js_gfx_GLES2Device_copyTexImagesToTexture)); -#endif // USE_GLES2 - +#elif defined USE_GLES3 register_all_gles3(obj); __jsb_cocos2d_GLES3Device_proto->defineFunction("copyBuffersToTexture", _SE(js_gfx_GLES3Device_copyBuffersToTexture)); __jsb_cocos2d_GLES3Device_proto->defineFunction("copyTexImagesToTexture", _SE(js_gfx_GLES3Device_copyTexImagesToTexture)); - -#if (CC_PLATFORM == CC_PLATFORM_MAC_OSX) +#elif defined USE_METAL register_all_mtl(obj); __jsb_cocos2d_CCMTLDevice_proto->defineFunction("copyBuffersToTexture", _SE(js_gfx_CCMTLDevice_copyBuffersToTexture)); __jsb_cocos2d_CCMTLDevice_proto->defineFunction("copyTexImagesToTexture", _SE(js_gfx_CCMTLDevice_copyTexImagesToTexture)); diff --git a/native/external/config.json b/native/external/config.json index decda7b700..61576320f0 100644 --- a/native/external/config.json +++ b/native/external/config.json @@ -1,5 +1,5 @@ { - "version": "v3d-4", + "version": "v3d-10", "zip_file_size": "115677698", "repo_name": "cocos2d-x-lite-external", "repo_parent": "https://github.com/cocos-creator/" diff --git a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/build.gradle b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/build.gradle index 4cce932b66..35af902d95 100755 --- a/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/build.gradle +++ b/native/templates/js-template-link/frameworks/runtime-src/proj.android-studio/app/build.gradle @@ -17,7 +17,7 @@ android { if (project.hasProperty("PROP_USE_CMAKE")) { cmake { targets "cocos2djs" - arguments "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", "-DCOCOS_X_ROOT=${COCOS_X_ROOT}" + arguments "-DANDROID_STL=c++_static", "-DANDROID_PLATFORM=android-$PROP_TARGET_SDK_VERSION", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", "-DCOCOS_X_ROOT=${COCOS_X_ROOT}" cppFlags "-frtti -fexceptions -fsigned-char" abiFilters.addAll(PROP_APP_ABI.split(':').collect{it as String}) }