Not elegant cmake prebuilt feature was removed in 3.17.1 release

Not elegant cmake prebuilt feature was removed in 3.17.1 release
0

#1

In cocos2d-x 3.17 release, we try to support prebuilt libs in cmake build, by 3 options supplied:

GEN_COCOS_PREBUILT / USE_COCOS_PREBUILT / COCOS_PREBUILT_ROOT

As far as I know, CMake official didn’t builtin prebuilt feature, that similar with gen-libs . So that this feature is a really hack method, and make the cmake scripts more bloated. To simply the cmake scripts, make it easy understand ,we removed it. also with @CrazyHappyGame strongly suggest to do this simplification.

what’s your options, and do existed any elegant method to do this?

history comments:
https://github.com/cocos2d/cocos2d-x/pull/19109#issue-222070365


#2

Does this info help?

Where the example uses ExternalProject_Add

https://cmake.org/cmake/help/latest/module/ExternalProject.html


#3

thanks for this info, it will helps that build only once, and reuse it in different cocos2dx games build.

I will try this way later. but 3.17.1 is coming, afraid that I cant finish it before this release, so I want to put it into next milestone.


#4

One of the many ways to build library once and reuse it in multiple games is to create root CMakeLists.txt which will contains all games. For example please check.: https://github.com/cocos2d/cocos2d-x-external.

$ git clone https://github.com/cocos2d/cocos2d-x-external.git
$ cd cocos2d-x-external
$ mkdir build
$ cd build
$ cmake …
$ time cmake --build . --target game1
real 2m1.080s
~2 minutes - builds all deps and game1
$ time cmake --build . --target game 2
real 0m2.080s
~2 seconds only! - builds only game2. deps were built with game1