Skip to content

Instantly share code, notes, and snippets.

@AtnNn
Created February 17, 2020 01:04
Show Gist options
  • Save AtnNn/c415306ca0cb7c73a7826fe1ea04f779 to your computer and use it in GitHub Desktop.
Save AtnNn/c415306ca0cb7c73a7826fe1ea04f779 to your computer and use it in GitHub Desktop.
Build rtags on Windows
set -eu
# /mingw64/include conflicts with /usr/include
if [[ ! -e llvm-include ]]; then
mkdir -p llvm-include
pacboy files mingw-w64-x86_64-llvm mingw-w64-x86_64-clang |
perl -ne 'print "$1\n" if /\/mingw64\/include\/(.*)/' |
while read -r h; do
mkdir -p llvm-include/"$(dirname "$h")"
ln -s /mingw64/include/"$h" llvm-include/"$h"
done
fi
rm -rf build
# For `llvm-config`
PATH=$PATH:/mingw64/bin
cmake -B build -S . \
-G 'MSYS Makefiles' \
-DCMAKE_CXX_COMPILER=g++ \
-DOPENSSL_CRYPTO_LIBRARY='/usr/lib/libcrypto.a' \
-DLIBCLANG_CXXFLAGS="-I `pwd`/llvm-include" \
-DCMAKE_INSTALL_PREFIX='c:/opt/rtags'
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129
find build -name \*.rsp -exec sed -i 's|-isystem [^ ]*||g' {} \;
make -C build -j `nproc`
set -eu
# /mingw64/include conflicts with /usr/include
if [[ ! -e llvm-include ]]; then
mkdir -p llvm-include
pacboy files mingw-w64-x86_64-llvm mingw-w64-x86_64-clang |
perl -ne 'print "$1\n" if /\/mingw64\/include\/(.*)/' |
while read -r h; do
mkdir -p llvm-include/"$(dirname "$h")"
ln -s /mingw64/include/"$h" llvm-include/"$h"
done
fi
rm -rf build
# For `llvm-config`
PATH=$PATH:/mingw64/bin
cmake -B build -S . \
-G 'MSYS Makefiles' \
-DCMAKE_CXX_COMPILER=g++ \
-DOPENSSL_CRYPTO_LIBRARY='/usr/lib/libcrypto.a' \
-DLIBCLANG_CXXFLAGS="-I `pwd`/llvm-include" \
-DCMAKE_INSTALL_PREFIX='c:/opt/rtags'
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129
find build -name \*.rsp -exec sed -i 's|-isystem [^ ]*||g' {} \;
make -C build -j `nproc`
cmake --install build --component rtags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment