[CMake] One build system to rule them all. Because cross-platform libs need cross-platform build systems

[CMake] One build system to rule them all. Because cross-platform libs need cross-platform build systems
0.0 0


It seems our build system could use some unification - it’s very good that everything works, but it would be lovely if we could unify the different build systems into one.

Others have looked at CMake in the past, but I’d like for us to take another look and hopefully drive adoption.

Project forked at https://github.com/ReubenBond/cocos2d-x (I’m working on the gles20 branch for some reason).
CMake is successfully building the HelloCpp sample on Linux with preliminary work done for Android using the android-cmake project.

I’ll keep charging ahead regardless, because this is useful to me, but please do go and check it out, provide suggestions and/or pull requests. :slight_smile:

# Abstract the style into one or more CMake modules
# Android builds (using android-cmake toolchain - https://code.google.com/p/android-cmake/)
# Windows builds
# IOS builds (using ios-cmake toolchain - https://code.google.com/p/ios-cmake/)
# MacOSX builds

CMake - http://en.wikipedia.org/wiki/CMake
Why CMake? - https://lwn.net/Articles/188693/


very interesting work, thanks!


Cool, it makes sense!


Are you still working on this? Sometimes I use Cmake to crosscompile in Windows, Linux, Android and iOS and its awesome to develop. Tell me if you want some help.


I just got pinged on twitter about this. Unfortunately I shelved the project before getting it to a fully working state - like so many things in life.

Sorry, people. I hope someone else is able to port the build system to CMake.


Today Jetbrains released an early preview of the cross-platform C++ IDE called Clion.

Clion supports CMake build system and has lua and js plugins.If the build system was ported to CMake, cocos2d-x would get a cool cross-platform IDE with lots of useful features like static analysis and automated refactoring out of the box.


Hi guys!

Lets continue to work on this! It is a great idea. I trying to do something similar by my own.


@walzer @zhangxm @slackmoehrle Why CMake still not used?
Even with already ready pull request https://github.com/cocos2d/cocos2d-x/pull/18154 it’s ignored?


+1. I am on Android/Win/Mac/iOS.


@drelaptop please do research on CMake for all platforms.


Got, I will start it in this week

@KAMIKAZE I have been keeping focus on your PR, and try my best to make CMake used. some suggestions bring out to that PR, please have a look.


Thanks, but it’s not my pr, anyway good feature. And if some other pr’s from newnon was ignored too, I’m not sure if he will get back to that pr… time time…


thanks for your mention it, every one’s pr should get reply in time. and it’s so excited that the author have get back!


The old CMake logic of using 3rd-library is not easy to understand, and difficult to extend for us.

Now I have time to improve that, and thinking how to do that, however no good idea for now, so I came to forum and want to get some help about it. Would you like share you ideas with me? I wonder whether some project like cocos2d-x having much library to link, and using CMake as build system exist. which I can refer to.

We need help testing v3.17