-
Notifications
You must be signed in to change notification settings - Fork 9
/
build
executable file
·110 lines (105 loc) · 3.07 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/env bash
if [[ "$1" == deb || "$1" == llvm-debug ]]
then
mkdir -p debug && pushd debug || exit 1
else
mkdir -p release && pushd release || exit 1
fi
mkdir -p install
if [[ "$1" == install ]]; then
ninja && sudo ninja install
else
target=..
case "$1" in
ozone)
# This will build an ozone-<version>.tar.gz in your target directory.
mvn clean package -DskipTests=true -Dmaven.javadoc.skip=true -Phdds -Pdist -Dtar -DskipShade
;;
llvm)
target=../llvm
cmake_args=(
-DLLVM_TARGETS_TO_BUILD='X86'
-DLLVM_CCACHE_BUILD=1
-DLLVM_ENABLE_PROJECTS='clang;libcxx;libcxxabi;compiler-rt;lld'
-DCMAKE_BUILD_TYPE=Release
-DGCC_INSTALL_PREFIX='/tmp/gentoo/usr'
-DLLVM_BUILD_LLVM_DYLIB=1
# -DCLANG_DEFAULT_CXX_STDLIB=libc++
# -DCLANG_DEFAULT_RTLIB=compiler-rt
-DCLANG_DEFAULT_LINKER=lld
-DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=1'
-DCMAKE_INSTALL_PREFIX=$PWD/install
)
;;
llvm-debug)
target=../llvm
cmake_args=(
-DLLVM_TARGETS_TO_BUILD='X86'
-DLLVM_CCACHE_BUILD=1
-DLLVM_ENABLE_PROJECTS='clang;libcxx;libcxxabi;compiler-rt;lld'
-DCMAKE_BUILD_TYPE=Debug
-DLLVM_BUILD_LLVM_DYLIB=1
-DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=1'
-DCMAKE_INSTALL_PREFIX=$PWD/install
)
;;
ccls)
cmake_args=(
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DUSE_SHARED_LLVM=On
-DCMAKE_PREFIX_PATH="$HOME/git/llvm-project/release;$HOME/git/llvm-project/release/tools/clang;$HOME/git/llvm-project/llvm;$HOME/git/llvm-project/clang"
)
;;
ccls-os)
cmake_args=(
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_CXX_COMPILER=clang++
)
;;
ccls-debug)
cmake_args=(
-DCMAKE_BUILD_TYPE=Debug
-DUSE_SHARED_LLVM=On
-DCMAKE_PREFIX_PATH="$HOME/git/llvm-project/release;$HOME/git/llvm-project/release/tools/clang;$HOME/git/llvm-project/llvm;$HOME/git/llvm-project/clang"
)
;;
obs)
cmake_args=(
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_INSTALL_LIBDIR=lib
)
;;
deb)
cmake_args=(
-DCMAKE_BUILD_TYPE=Debug
)
;;
folly)
cmake_args=(
-DBUILD_SHARED_LIBS=1
)
;;
mtrace)
cmake_args=(
-DDISABLE_CLIENT=1
)
;;
fish)
cmake_args=(
-DCMAKE_INSTALL_PREFIX:PATH=/tmp/gentoo/usr/local/
-DCMAKE_BUILD_TYPE=Release
)
;;
*)
cmake_args=(
-DCMAKE_BUILD_TYPE=Release
)
;;
esac
if cmake "$target" -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=On "${cmake_args[@]}" && ninja; then
[[ "$2" == install ]] && ninja install
[[ "$1" == llvm ]] && cd lib && ln -sf libLLVM-*.so libLLVM.so
fi
fi
popd
ln -sf release/compile_commands.json .