Skip to content

Commit e143bf0

Browse files
committed
README: update the part about the compile_commands
1 parent 2f7644b commit e143bf0

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

README.md

+20-16
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,6 @@ cmake . -DLLVM_CONFIG_EXECUTABLE=/usr/local/Cellar/llvm/<your_llvm_version>/bin/
7272
make
7373
```
7474

75-
compile_commands.json
76-
=====================
77-
We need a compile_commands.json file to know how your project is usually compiled.
78-
There are multiple ways to get this file:
79-
80-
* For cmake, pass -DCMAKE_EXPORT_COMPILE_COMMANDS=ON as a cmake parameter
81-
* For qmake, configure/autoconf and others, follow the instructions in scripts/fake_compiler.sh or scripts/woboq_cc.js.
82-
These are fake compilers that append the compiler invocation to the json file and forward to the real compiler.
83-
Your real compiler is overriden using the CC/CXX environment variables
84-
Make sure to have the json file properly terminated.
85-
* There is also a project called Build EAR (Bear) that achieves a similar thing as our fake compilers
86-
but is using LD_PRELOAD to inject itself into the build process to catch how the compiler is invoked.
87-
https://github.com/rizsotto/Bear
88-
89-
9075
Using the generator
9176
===================
9277

@@ -152,7 +137,9 @@ codebrowser_generator -a -o <output_dir> -b <buld_dir> -p <projectname>:<source_
152137

153138
-o with the output directory where the generated files will be put
154139

155-
-b the "build directory" containing the compile_commands.json
140+
-b the "build directory" containing the compile_commands.json If this argument
141+
is not passed, the compilation arguments can be passed on the command line
142+
after --
156143

157144
-p (one or more) with project specification. That is the name of the project,
158145
the absolute path of the source code, and the revision separated by colons
@@ -183,6 +170,23 @@ codebrowser_indexgenerator <output_dir> [-d data_url] [-p project_definition]
183170
default to ../data relative to the output dir
184171
example: -d https://code.woboq.org/data
185172

173+
Compilation Database
174+
====================
175+
The generator is a tool which uses clang's LibTooling. It needs either a
176+
compile_commands.json or the arguments to be passed after '--' if they are
177+
the same for every file.
178+
179+
To generate the compile_commands.json:
180+
* For cmake, pass -DCMAKE_EXPORT_COMPILE_COMMANDS=ON as a cmake parameter
181+
* For qmake, configure/autoconf and others, follow the instructions in scripts/fake_compiler.sh or scripts/woboq_cc.js.
182+
These are fake compilers that append the compiler invocation to the json file and forward to the real compiler.
183+
Your real compiler is overriden using the CC/CXX environment variables
184+
Make sure to have the json file properly terminated.
185+
* There is also a project called Build EAR (Bear) that achieves a similar thing as our fake compilers
186+
but is using LD_PRELOAD to inject itself into the build process to catch how the compiler is invoked.
187+
https://github.com/rizsotto/Bear
188+
189+
186190

187191
Getting help
188192
============

0 commit comments

Comments
 (0)