nickdiego / compiledb

Tool for generating Clang's JSON Compilation Database files for make-based build systems.
GNU General Public License v3.0
1.38k stars 123 forks source link

Add --macro and --full-path parameters #80

Closed rhssk closed 5 years ago

rhssk commented 5 years ago

Both of these arguments improve the workflow with rtags.

--macro (-m) appends a list of predefined compiler macros to the end of "arguments" section in compilation database.

This argument is useful when working with codebase that has a lot of directives like these: #if defined(__arch1__) || defined(__arch2__) If they are not explicitly defined, the code in those #ifs won't be added to the rtags database.

--full-path searches the user's $PATH for the compiler executable and in case it's found, replaces the executable name with the full path to executable in "arguments" section in compilation database.

This argument allows to specify the compiler path only once, when calling compiledb, like so: PATH=/opt/buildroot/bin:$PATH compiledb --full-path make After that no additional configuration is needed for rtags and one rdm service can be used to handle separate projects with separate compilers in separate PATHs.