CMake and Cocos and Project structure

Trying to get my head around v4.

I created a new project and pulled some old code into it. I managed to understand CMake enough to be able to have CMakeLists.txt file/files to cover my whole project structure. In this first instance I created a mac-build. However what I can’t get my head around is the inclusion of cocos2d in my project folder.

Previously I was using precompiled libraries. I don’t want to include the cocos2d folder in my git repos. And I also want to be able to easily keep cocos updated and to keep the project up to date as well.

What am I missing?

Chris

I use sym links to cocos2d in my project so that I don’t commit to git or I can change cocos2d-x versions in my projects just by changing the link

1 Like

I’ve been using a symbolic junction link to the cocos2d folder (on Windows) as well for several reasons, one of which is to reduce the size of the projects on disk, and for convenience of having all projects point to the same source (in case the engine code has fixes applied etc.).

One thing though, would it be a good idea to add support for creating a link to the cocos2d folder instead of copying it when using the ‘cocos new …’ command?

Like adding a new switch to be passed into this command:
cocos new gamename -p com.example.gamename -l cpp -d . [-optional_switch_to_create_link]

Something like -s or -c or whatever else makes sense to use, so it simply creates a symbolic link (or junction type link if using Windows) etc.

1 Like

So when I try that, I get the following

CMake Error at CMakeLists.txt:49 (include):
  include could not find load file:

    CocosBuildSet


CMake Error at CMakeLists.txt:50 (add_subdirectory):
  add_subdirectory given source "/Users/chris/cocos/midnight/cocos2d/cocos"
  which is not an existing directory.


CMake Error at CMakeLists.txt:61 (cocos_mark_multi_resources):
  Unknown CMake command "cocos_mark_multi_resources".