Skip to content

Create compilation database compile_commands.json from Xcode projects.

License

Notifications You must be signed in to change notification settings

vsapsai/xcode_compilation_db

Repository files navigation

xcode_compilation_db.py creates compilation database compile_commands.json from Xcode projects.

It uses the same approach as scan-build in Clang Static Analyzer. I.e. it replaces C and C++ compilers with c_interposer.py and cpp_interposer.py respectively. Then it invokes xcodebuild and aforementioned scripts intercept and store compilation commands. xcode_compilation_db.py is used the following way:

python xcode_compilation_db.py xcodebuild -scheme FooApp build

Please note that the tool is new and untested. Use it cautiously.

Alternatives

Bear by László Nagy. Main disadvantage for me is that it needs to be compiled. I prefer a Python script. And I haven't checked how it works with Xcode projects.

DTrace. Sean Silva has suggested to use DTrace to generate compile_commands.json and there is even execsnoop example. Unfortunately, on Mac OS X curpsinfo->pr_psargs doesn't work. You can try to inspect execve arguments directly with arg0, arg1, etc. Brendan Gregg has written a nice instruction how to do this. But arg1 is char *const argv[] and I haven't found any way to inspect null-terminated array.

oclint/oclint-xcodebuild. It creates compile_commands.json by parsing xcodebuild output. I have found it after creating xcode_compilation_db.py and haven't checked how it works.

clang-tags by François Févotte. See User manual. 2.1. Creating the compilation database for more details.

About

Create compilation database compile_commands.json from Xcode projects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published