From 5f94c2bceb678305f0495ce7c4d8c40a75ff5c69 Mon Sep 17 00:00:00 2001 From: Riatre Foo Date: Tue, 9 Oct 2018 21:55:54 +0800 Subject: [PATCH] Windows instructions --- Build.md | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Build.md b/Build.md index 52c247b..3580109 100644 --- a/Build.md +++ b/Build.md @@ -8,11 +8,6 @@ See [[Getting-started]] for recommended configuration options for common systems You may append `-G Ninja -DCMAKE_CXX_LINK_FLAGS=-fuse-ld=lld -DCMAKE_CXX_COMPILER=clang++` -[**Windows**] On Windows you have to explicitly tell CMake to target 64-bit -architecture by adding the `-DCMAKE_GENERATOR_PLATFORM=x64` option to the -cmake invocation (`cmake -DCMAKE_GENERATOR_PLATFORM=x64 ..`). 32-bit builds -are not supported at the moment. - ## CMake Options * `-DCMAKE_BUILD_TYPE=(Debug|MinSizeRel|Release|RelWithDebInfo)` @@ -80,7 +75,22 @@ Build ccls with `/usr/bin/clang++`. You may use the absolute path of `Release/cl ## Windows -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` +The Windows archive on releases.llvm.org does not contain library headers, since ccls uses Clang C++ APIs, it is not possible to build ccls with these releases. You have to either: + +1. Build LLVM+Clang by yourself with your favorite toolchain. +2. Get prebuilt LLVM+Clang from other sources. + +For 2, one possible way is use MSYS2, in MSYS2 MinGW 64-bit shell: + +``` +pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-jq mingw-w64-x86_64-ninja mingw-w64-x86_64-ncurses +mkdir build +cd build +cmake .. -G Ninja -DSYSTEM_CLANG=ON +cmake --build . +``` + +Building ccls with MSVC 2017 and locally built LLVM+Clang on Windows does not work right now, contributions welcome. ## Link against clang+llvm libraries compiled from source