.gitignore for v4 projects

Hi there is there any example .gitignore files for cocos2d-x v4 projects?

The .gitignore on Github https://github.com/cocos2d/cocos2d-x/blob/v4/.gitignore includes .a files for example, which removes all the prebuilt and required libs like libbox2d.a

Also when cloning the project on another computer I have to run CMAKE again to build the iOS Xcode project. Does CMAKE override the old .xcodeproj file or just update it?

All the best
Rambazamba

The .gitignore doesn’t delete anything. It tells git what NOT to attempt to check-in or track changes, etc. You WANT to rebuild the libraries on other machines as architectures can be different, libraries can be built with different compile options etc.

Yes cmake is required to build projects initially and then is updated as needed.

Thank you for the reply @slackmoehrle :slight_smile:

I am still a bit puzzled how this works when more people work on the same game for iOS.

Let’s assume person A pushes his changes including the xCode .xcodeproj file. For example person A added a lot of files and configured the xcode project etc.

Now person B wants to collaborate. B clones the repository including the .xcodeproj file. Right after checkout he needs to run: “cmake …/… -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneoscd” in the iOs folder so that everything is build.

This however rebuilds also the .xcodeproj file, and all the configuration, added source code files etc. are lost in the Xcode project, and B has to manually add sources and configure Xcode again. B is also not able to use the .xcodeproj file from A, as some of the CMAKE stuff inside it is only working for A.

Now when B pushes his changes and also an updated .xcodeproj file, A would have to do the same thing.

This seems very tedious to me - is there a better way of doing this?

Sorry for probably asking stupid questions :-/

All the best Rambazamba

Each developer maintains their own Xcode project. You don’t share this, usually. Why? Developers machines are setup differently with different paths and maybe different compiler flags depending on what they are doing. Maybe different search paths, etc

Maybe one developer is working on a different version of the game

1 Like

The CMakeLists.txt files shouldn’t be specific to any PC or developer. For example, it should never ever have hard-coded paths.

Also, the source files should not be added to xcodeproj directly, but all done through CMakeLists.txt, so that way the xcodeproj file is always generated with all the source file references.

Why would you want to check the xcodeproj file into your source control if you can generate it at any time? Any settings that need to be made in xcodeproj should really be done in CMakeLists.txt, same as with the source code references, so any time a developer recreates the project files using CMake, the xcodeproj will automatically be generated with the right settings.

Is there something specific in xcodeproj that CMake can’t automatically generate?

1 Like

Ah ok - now it makes sense for me :slight_smile:
Thx again for the explanation @R101 and @slackmoehrle

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.