Mac
-
首先需安装cmake和llvm
brew install cmake llvm
-
emacs里执行M-x irony-install-server得到安装执行命令
cmake -DCMAKE_INSTALL_PREFIX\=/Users/kumotyou/.emacs.d/irony/ \ /Users/kumotyou/.emacs.d/elpa/irony-20200130.849/server \ && cmake --build . --use-stderr --config Release --target install
-
添加环境变量
-DCMAKE_PREFIX_PATH=/usr/local/opt/llvm -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON -DLIBCLANG_INCLUDE_DIR=/usr/local/opt/llvm/include -DLIBCLANG_LIBRARY=/usr/local/opt/llvm/lib/libclang.dylib
-
最终编译命令
cmake -DCMAKE_INSTALL_PREFIX\=/Users/kumotyou/.emacs.d/irony/ \ -DCMAKE_PREFIX_PATH=/usr/local/opt/llvm \ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \ -DLIBCLANG_INCLUDE_DIR=/usr/local/opt/llvm/include \ -DLIBCLANG_LIBRARY=/usr/local/opt/llvm/lib/libclang.dylib \ /Users/kumotyou/.emacs.d/elpa/irony-20200130.849/server \ && cmake --build . --use-stderr --config Release --target install
Ubuntu
-
拉取ccls源码, 并进入ccls根目录
git clone https://github.com/MaskRay/ccls cd ccls
-
拉取第三方依赖. (主要是rapidjson)
git submodule update --init --recursive
-
下载llvm的二进制包并解压
wget -c http://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz tar xf clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
-
在根目录下执行cmake 执行结果保存到Release文件夹中
cmake -H. -BRelease -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/path/to/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04 cmake --build Release
-
开始编译
cd Release make -j4 #使用4线程编译
-
编译完成, 安装
sudo make install