I am trying to minimise the build time for android because I have to use 3 architectures for special purpose while building that takes around 50 minutes time in my MacPro high configuration pc
. I follow this tutorial. But when I run cocos gen-libs
command terminal says argument not found
that means gen-libs not available in cocos2d-x3.17.1
.
Now How can I make prebuild library in cocos2d-x3.17.1
.
N.B: I am using cocos2d-x3.17.1, ndk19b, android-studio 3.1
Thanks in advance
This has been deprecated for a few releases now.
You can with CMake but I don’t think we will support that much longer either.
This how I build cocos2d-x once and use cocos2d-x lib in many games.
It works out of the box for Mac/Win10/Linux/iOS but with Android you have to do some tricks. Please see points 3,4,5.
-
File structure
dev/CMakeLists.txt
dev/cocos2d-x
dev/my_game_1
dev/my_game_2
dev/my_game_n
dev/my_test
-
dev/CMakeLists.txt
cmake_minimum_required(VERSION 3.6)
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cocos2d-x)
set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/)
include(CocosBuildSet)
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core)
if(ANDROID)
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform)
endif()
add_subdirectory(my_game_1)
add_subdirectory(my_game_2)
…
add_subdirectory(my_game_n)
-
One project build all *.so files
dev\my_test\proj.android\app\build.gradle
cmake {
path “…/…/…/dev/CMakeLists.txt”
}
gradlew assembleRelease -PPROP_APP_ABI=armeabi-v7a:x86
-
Script copy proper *.so files to proper folders dev\my_game_n\proj.android\app\jniLibs
-
each game compile only java code and use compiled *.so files
cd dev\my_game_n
gradlew assembleRelease -PPROP_BUILD_TYPE=none
p.s.
But if you have only 1 game just compile it once and that’s all.
Did you release game in Google Play with cocos2d-x3.17.1, ndk19b?
Do you also do this for iOS out of curiosity?
Yes. Points 1 and 2 are the same for all platforms.
This is beauty of cmake
Thanks for your reply.
May be it will be help. I will test the procedures.