.

Fangrui Song 2018-05-13 09:38:51 -07:00
parent 27d6b87b0b
commit 19d5330f37

@ -4,35 +4,25 @@
* GCC 6 or higher * GCC 6 or higher
* MSVC 2017 or higher (included with VS2017 Build Tools) * MSVC 2017 or higher (included with VS2017 Build Tools)
After installing the required dependencies, clone the repository along with its See [[Getting-started]] for simple cmake build instructions.
git submodules using:
`git clone https://github.com/MaskRay/ccls --recursive`
``` You may append `-G Ninja -DCMAKE_CXX_LINK_FLAGS=-fuse-ld=lld -DCMAKE_CXX_COMPILER=clang++`
# create a build directory called `release`
% cmake -H. -Brelease
# build
% cmake --build release
```
[**Windows**] On Windows you have to explicitly tell CMake to target 64-bit [**Windows**] On Windows you have to explicitly tell CMake to target 64-bit
architecture by adding the `-DCMAKE_GENERATOR_PLATFORM=x64` option to the architecture by adding the `-DCMAKE_GENERATOR_PLATFORM=x64` option to the
cmake invocation (`cmake -DCMAKE_GENERATOR_PLATFORM=x64 ..`). 32-bit builds cmake invocation (`cmake -DCMAKE_GENERATOR_PLATFORM=x64 ..`). 32-bit builds
are not supported at the moment. are not supported at the moment.
This command generates project files for your system's default generator (Linux:
make, Windows: MSBuild). CMake defaults to a Release build and links ccls
against the libclang library which it downloads from <https://releases.llvm.org>.
## CMake Options ## CMake Options
* `-DCMAKE_BUILD_TYPE=(Debug|MinSizeRel|Release|RelWithDebInfo)` * `-DCMAKE_BUILD_TYPE=(Debug|MinSizeRel|Release|RelWithDebInfo)`
Default: Release
Set the build type. The most important ones are Debug and Release. Set the build type. The most important ones are Debug and Release.
* `-DSYSTEM_CLANG=(ON|OFF)` * `-DSYSTEM_CLANG=(ON|OFF)`
Default: ON
Enable `SYSTEM_CLANG` if you want to link ccls against a system installation 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. of Clang instead of downloading Clang from releases.llvm.org during the configure process.
@ -43,6 +33,7 @@ of Clang instead of downloading Clang from releases.llvm.org during the configur
* `-DCLANG_USE_BUNDLED_LIBC++=on` * `-DCLANG_USE_BUNDLED_LIBC++=on`
`clang+llvm*` downloaded from releases.llvm.org also provides libc++ libraries.
`libstdc++ >= 5.3` supports `experimental/filesystem`. If your `libstdc++` is old, you can use `libc++` in the bundled clang+llvm archive: `libstdc++ >= 5.3` supports `experimental/filesystem`. If your `libstdc++` is old, you can use `libc++` in the bundled clang+llvm archive:
```zsh ```zsh
@ -79,15 +70,8 @@ cmake --build release
``` ```
~/Dev/llvm/release/include/llvm/Config/config.h ~/Dev/llvm/release/include/llvm/Config/config.h
~/Dev/llvm/release/tools/clang/include/clang/Config/config.h ~/Dev/llvm/release/tools/clang/include/clang/Config/config.h
``` # libclang
~/Dev/llvm/release/lib/libclang.so
``` # -resource-dir
% tree ~/Dev/llvm/static-release/lib/ -L 3 ~/Dev/llvm/release/lib/clang/7.0.0
├── clang
│   └── 7.0.0
│   ├── include
│   └── lib
├── libclang.so -> libclang.so.7
├── libclang.so.7 -> libclang.so.7.0
└── libclang.so.7.0
``` ```