Update cmake for impatient

Fangrui Song 2018-08-31 10:21:06 -07:00
parent 10753c81a2
commit 24c89e8be4

@ -11,6 +11,8 @@
For all others, below are the quick commands for the impatient. Detailed instructions can be found at [[Build]]. For all others, below are the quick commands for the impatient. Detailed instructions can be found at [[Build]].
If you are on Linux, this requires libstdc++ shipped with GCC > 7 for good support of C++17 header files, even if you use clang++.
```zsh ```zsh
git clone https://github.com/MaskRay/ccls --depth=1 git clone https://github.com/MaskRay/ccls --depth=1
cd ccls cd ccls
@ -19,21 +21,20 @@ cmake -H. -BRelease
cmake --build Release cmake --build Release
``` ```
The executable is at `release/ccls`. The executable is at `Release/ccls`.
Additional notes: If your `libstdc++` is too old (no C++17 header files) or have an old GCC/Clang, you may use the `-DCLANG_USE_BUNDLED_LIBC++=on` command at [[Build]]. FreeBSD and some Linux distributions provide system clang. You may use `-DSYSTEM_CLANG=on`.
But caution is that you need to identify whether the clang library is compiled with `-DLLVM_ENABLE_RTTI=on`
* Arch Linux: `cmake -H. -BRelease -DUSE_SHARED_LLVM=on`. You may also use [aur/ccls-git](https://aur.archlinux.org/packages/ccls-git) which links against `extra/clang`. There was a [SIGSEGV issue](https://github.com/MaskRay/ccls/issues/30) which has been fixed. * Arch Linux: [aur/ccls-git](https://aur.archlinux.org/packages/ccls-git). There was a [SIGSEGV issue](https://github.com/MaskRay/ccls/issues/30) which has been fixed. `cmake -H. -BRelease -DSYSTEM_CLANG=on -DUSE_SHARED_LLVM=on -DLLVM_ENABLE_RTTI=on`
* FreeBSD * FreeBSD
+ with `llvm60` installed: `cmake -H. -BRelease -DSYSTEM_CLANG=on -DUSE_SHARED_LLVM=on -DCMAKE_PREFIX_PATH=/usr/local/llvm60` + with `llvm60` installed: `cmake -H. -BRelease -DSYSTEM_CLANG=on -DUSE_SHARED_LLVM=on -DCMAKE_PREFIX_PATH=/usr/local/llvm60`
+ use libc++: `cmake -H. -BRelease -DCLANG_USE_BUNDLED_LIBC++=on` + use libc++: `cmake -H. -BRelease -DCLANG_USE_BUNDLED_LIBC++=on`
* Linux with newer libstdc++ and clang>=6: `cmake -H. -BRelease -DUSE_SHARED_LLVM=on`
* Linux with `gcc < 7` but `clang >= 5`, `cmake -H. -BRelease -DCMAKE_CXX_COMPILER=clang++`
Debian: `apt install zlib1g-dev` Debian: `apt install zlib1g-dev`
Install g++-7 on Ubuntu 16.04: https://gist.github.com/jlblancoc/99521194aba975286c80f93e47966dc5 Install g++-7 on Ubuntu 16.04: https://gist.github.com/jlblancoc/99521194aba975286c80f93e47966dc5
`-DUSE_SHARED_LLVM=on` (optional) makes linked executable smaller. `-DUSE_SHARED_LLVM=on` (optional, if you have `libLLVM.so`) makes linked executable smaller.
`-G Ninja` to build with ninja. `-G Ninja` to build with ninja.
### Setup your editor ### Setup your editor