Some questions about keeping the Xcode project in sync

This last month I’ve been experimenting with building Blender and adding some minor custom things, just to get to know the source code. I primarily do this by working in Xcode, so I used the instructions in the Building Blender for macOS wiki article.

During this month Blender development obviously continued, so I had to keep my repositories in sync. The above mentioned Blender wiki article details the make update command, that apparently not only updates the main Blender repository, but also the SVN libraries, tests and some other stuff. Which seems to work just fine. By the way, the Git Usage wiki article mentions some different commands for keeping the repository up-to-date. I guess the make update command does the same, but more. Am I right?

Anyway, I noticed I wasn’t always able to build the Xcode project after performing a make update. I figured I had to rerun the cmake . -B ../build_xcode/ -G "Xcode" command to regenerate the Xcode project files. Is this indeed the proper workflow? So after each repository update you also have to update the Xcode project? If so, why doesn’t make update include this? Or why isn’t there a separate make xcodeproject command?

The script is at build_files/utils/make_update.py. It updates submodules too.

If cmake files change, or say a file is renamed and xcodeproj file still has the old file referenced, build will fail.

Yes. Cmake generates/ updates the build system recipe as per the changes in cmakelists.txt or cmakecache.txt in source folder or build folder respectively.
Although the command can just be cmake ./ in the build folder.

It can be done in Xcode also, by building ZERO_CHECK scheme followed by the usual INSTALL. But I’ve found it a tad bit less reliable.

What if I want to use ninja or make generator ? Or just don’t want to build anything at all.

Err no-one asked for it…
I personally just wrote another script that updates the code and creates the xcode project with my custom cmake/ compile/ link options.
Also, it make new devs familiar with cmake I guess ? I don’t agree with adding xcodeproject target to the GNUmakefile. It’s a minority even among macOS devs.
You’ll get used to it.

1 Like

Thanks for your reply! I disagree and think there should definitely be an easier to remember command to update the Xcode project. But anyhow, it doesn’t matter. I’ll type the longer command line.

You may see the history of GNUmakefile file to see how other options were added, particularly ccache. It was recent. Post a patch, if you wish, adding the new option and set the reviewers to platform:macos.
BUILD_COMMAND in that case would probably be xcodebuild -target.
make -s -C "/Users/t/build_darwin_lite" -j 4 install would have to be converted to xcodebuild -target install, -j 4 is redundant and -C "path.." would have to be removed.

I never added the option on windows, since there is no way for the make in the source folder to know where the build folders are (i generally have 5-6 of them at any given time) on linux/mac a similar problem may exist. Even if you detect the ‘standard’ build folder, it may not be the one the user wants.

Is running cmake ./ in the build folder really that much of an issue?

Is running cmake ./ in the build folder really that much of an issue?

No, I guess it isn’t. But the official Blender build documentation lists a considerably longer command, cmake . -B ../build_xcode/ -G "Xcode", as the one to use. Having to type that multiple times a day after each make update gets tedious. Maybe the documentation needs a refresh?

I don’t know what the best way is. I’m new to Blender. I’m following the manual. Don’t have multiple build folders. When I have some time I might look into a smarter way.

That’s the command for generating a new project, once generated the shorter one can be used,

1 Like