-
Notifications
You must be signed in to change notification settings - Fork 162
Home
This should meet most users' need.
$ ./waf configure --prefix ~/.local/stow/cquery # --prefix is optional, it specifies install directory
$ ./waf build # -g -O3, built build/release/bin/cquery
$ ./waf install # optional, copies the executable to $PREFIX/bin/cquery
Use this setting if you want to use gdb/lldb to debug cquery.
$ ./waf configure --variant=debug
$ ./waf build --variant=debug # -g -O0, built build/debug/bin/cquery
GCC sometimes emits better debug information, pass --check-cxx-compiler=g++
if you want to use g++
instead of clang++
to build cquery.
$ ./waf configure --variant=asan
$ ./waf build --variant=asan # -g -O -fsanitize=address,undefined, built build/asan/bin/cquery
Default build (--variant=release
) uses bundled clang+llvm. If you have clang installed on your system and do not want to see build/release/lib/clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-14.04/
installed to your PREFIX:
# If you have `llvm-config-3.9` in your $PATH
./waf configure --variant=system --use-system-clang --llvm-config=llvm-config-3.9
Other bundled versions:
./waf configure --variant=clang5 --bundled-clang=5.0.0
5.0.0 is not recommended because a bug was introduced before 5.0.0 and the fix https://reviews.llvm.org/D37700 is not included in the 5.0.0 release. You may see bogus unterminated #if
errors.
It is recommended to use Windows 10 (build >= 14972) and enable Developer Mode, as the build script will create several symbolic links during the build process. If creating symbolic link is not possible (most possibly due to lacking privilege), it will do a copy instead.
Install Visual Studio 2017 Build Tools,
Python and 7-Zip. 7z.exe
is expected to be in PATH. You may then simply:
python waf configure
python waf build
waf install
is not possible on Windows, instead you could simply copy build\release\bin\*
.
To use system clang:
python waf configure --use-system-clang --clang-prefix "C:\Program Files\LLVM\"
Guillaume Papin(@Scarcasm) has a thorough article about compilation databases.
% mkdir build
% (cd build; cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=YES ..)
% ln -s build/compile_commands.json
Bear is a tool that generates a compilation database for clang tooling. It can be used for any project based on Makefile
.
bear make
# generates compile_commands.json
ninja -t compdb rule_names... > compile_commands.json
Load the clang_compilation_database
tool in your wscript:
def configure(conf):
conf.load('clang_compilation_database')
./waf configure build
ln -s build/compile_commands.json
- Emacs
- Vim and Neovim: https://github.com/autozimu/LanguageClient-neovim/wiki/cquery
- Visual Studio Code
- Nuclide: add
cquery
to your PATH and enable the cquery check in the Nuclide/Atom settings.
Dump JSON requests and responses:
sudo sysdig -As999 --unbuffered -p '%evt.type %evt.buffer' "proc.pid=$(pgrep -fn build/app) and fd.type=pipe" | egrep -v '^Content|^$'
Passing the option --log-stdin-stdout-to-stderr
.
Some issues introduce diagnostic methods:
-
https://github.com/jacobdufault/cquery/issues/192
clang_toggleCrashRecovery(0)
beforeclang_indexTranslationUnit
to disable crash recovery and get the stack trace from a debugger.