change cquery to ccls and improve indentation

康小广 2018-06-27 11:43:19 -05:00
parent b1f1e8df75
commit b6613e2b4c

@ -17,51 +17,51 @@ are not supported at the moment.
* `-DCMAKE_BUILD_TYPE=(Debug|MinSizeRel|Release|RelWithDebInfo)`
Default: Release
Set the build type. The most important ones are Debug and Release.
Default: Release
Set the build type. The most important ones are Debug and Release.
* `-DSYSTEM_CLANG=(ON|OFF)`
Default: ON
Enable `SYSTEM_CLANG` if you want to link ccls against a system installation
of Clang instead of downloading Clang from releases.llvm.org during the configure process.
Default: ON
Enable `SYSTEM_CLANG` if you want to link ccls against a system installation
of Clang instead of downloading Clang from releases.llvm.org during the configure process.
```
% cmake -H. -Brelease -DCMAKE_INSTALL_PREFIX=/usr -DSYSTEM_CLANG=On
% cmake --build release
```
```
% cmake -H. -Brelease -DCMAKE_INSTALL_PREFIX=/usr -DSYSTEM_CLANG=On
% cmake --build release
```
* `-DCLANG_USE_BUNDLED_LIBC++=on`
`clang+llvm*` downloaded from releases.llvm.org also provides libc++ libraries.
If your `libstdc++` is too old, you can use `libc++` in the bundled clang+llvm archive:
`clang+llvm*` downloaded from releases.llvm.org also provides libc++ libraries.
If your `libstdc++` is too old, you can use `libc++` in the bundled clang+llvm archive:
```zsh
# If your clang++ is old, you may rerun this command with clang++ replaced to
# the absolute path of bundled/clang+llvm-*/bin/clang++
cmake -H. -Brelease -G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCLANG_USE_BUNDLED_LIBC++=on
```
```zsh
# If your clang++ is old, you may rerun this command with clang++ replaced to
# the absolute path of bundled/clang+llvm-*/bin/clang++
cmake -H. -Brelease -G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCLANG_USE_BUNDLED_LIBC++=on
```
* `-DCMAKE_PREFIX_PATH="custom_install_path"`
When you want to use a system installed Clang but it is not installed into any
default CMake search location (for example if you built LLVM from source) you
can tell CMake where to search by adding search paths to `CMAKE_PREFIX_PATH`.
CMake searches the paths in `CMAKE_PREFIX_PATH` for 'include' and 'lib'
subdirectories containing the required Clang headers and libraries. For example,
to use a system installation of Clang on Windows you can add the following
option: `-DCMAKE_PREFIX_PATH="C:/Program Files/LLVM"`.
When you want to use a system installed Clang but it is not installed into any
default CMake search location (for example if you built LLVM from source) you
can tell CMake where to search by adding search paths to `CMAKE_PREFIX_PATH`.
CMake searches the paths in `CMAKE_PREFIX_PATH` for 'include' and 'lib'
subdirectories containing the required Clang headers and libraries. For example,
to use a system installation of Clang on Windows you can add the following
option: `-DCMAKE_PREFIX_PATH="C:/Program Files/LLVM"`.
You may add directories for `include` and `lib` separated by a `;`, e.g. to use trunk clang:
`-DCMAKE_PREFIX_PATH="$HOME/Dev/llvm/release;$HOME/Dev/llvm/tools/clang"`
You may add directories for `include` and `lib` separated by a `;`, e.g. to use trunk clang:
`-DCMAKE_PREFIX_PATH="$HOME/Dev/llvm/release;$HOME/Dev/llvm/tools/clang"`
* `-DUSE_SHARED_LLVM=on`
Link against `libLLVM.so` instead of `libLLVMSupport.a libLLVMDemangle.a ...`
Link against `libLLVM.so` instead of `libLLVMSupport.a libLLVMDemangle.a ...`
## Windows
If using Windows the automatically downloaded LLVM binaries are 64-bit; you should build cquery in 64-bit as well. You can tell cmake to build 64-bit using `-DCMAKE_GENERATOR_PLATFORM=x64`
If using Windows the automatically downloaded LLVM binaries are 64-bit; you should build ccls in 64-bit as well. You can tell cmake to build 64-bit using `-DCMAKE_GENERATOR_PLATFORM=x64`
## Link against clang+llvm libraries compiled from source
@ -77,7 +77,7 @@ cd ~/Dev
cmake -H. -Brelease -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_SHARED_LIBS=ON -DLLVM_ENABLE_LLD=ON -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_GO_TESTS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_USE_SPLIT_DWARF=On -DLLVM_OPTIMIZED_TABLEGEN=On
```
Remove `LLVM_ENABLE_LLD` if don't have lld (a much faster linker than bfd/gold) installed
Remove `LLVM_ENABLE_LLD` if don't have lld (a much faster linker than bfd/gold) installed
Remove `BUILD_SHARED_LIBS` if you want to build static libraries (`libclangDriver.a` `libLLVMSupport.a`, note `libclang.so` is still a shared object)
Then build ccls: