Skip to content

Commit d0a03c4

Browse files
nolangemstorsjo
authored andcommitted
Use CMake's build and install functionality
This allows simplification, this functionality was added long ago to CMake. Further motivation is to be able to re-direct the installation, make/ninja install allow this by setting DESTDIR but this generally doesnt work well with window paths (see [1]). [1] - https://cmake.org/cmake/help/latest/envvar/DESTDIR.html#envvar:DESTDIR
1 parent 97cd12a commit d0a03c4

File tree

5 files changed

+10
-18
lines changed

5 files changed

+10
-18
lines changed

build-compiler-rt.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ fi
6868

6969
if command -v ninja >/dev/null; then
7070
CMAKE_GENERATOR="Ninja"
71-
BUILDCMD=ninja
7271
else
7372
: ${CORES:=$(nproc 2>/dev/null)}
7473
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
@@ -79,7 +78,6 @@ else
7978
CMAKE_GENERATOR="MSYS Makefiles"
8079
;;
8180
esac
82-
BUILDCMD=make
8381
fi
8482

8583
cd llvm-project/compiler-rt
@@ -123,8 +121,8 @@ for arch in $ARCHS; do
123121
-DCMAKE_C_FLAGS_INIT="$CFGUARD_CFLAGS" \
124122
-DCMAKE_CXX_FLAGS_INIT="$CFGUARD_CFLAGS" \
125123
$SRC_DIR
126-
$BUILDCMD ${CORES:+-j${CORES}}
127-
$BUILDCMD install
124+
cmake --build . ${CORES:+-j${CORES}}
125+
cmake --install .
128126
mkdir -p "$PREFIX/$arch-w64-mingw32/bin"
129127
if [ -n "$SANITIZERS" ]; then
130128
mv "$CLANG_RESOURCE_DIR/lib/windows/"*.dll "$PREFIX/$arch-w64-mingw32/bin"

build-libcxx.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ cd runtimes
6262

6363
if command -v ninja >/dev/null; then
6464
CMAKE_GENERATOR="Ninja"
65-
BUILDCMD=ninja
6665
else
6766
: ${CORES:=$(nproc 2>/dev/null)}
6867
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
@@ -73,7 +72,6 @@ else
7372
CMAKE_GENERATOR="MSYS Makefiles"
7473
;;
7574
esac
76-
BUILDCMD=make
7775
fi
7876

7977
for arch in $ARCHS; do
@@ -114,7 +112,7 @@ for arch in $ARCHS; do
114112
-DCMAKE_CXX_FLAGS_INIT="$CFGUARD_CFLAGS" \
115113
..
116114

117-
$BUILDCMD ${CORES:+-j${CORES}}
118-
$BUILDCMD install
115+
cmake --build . ${CORES:+-j${CORES}}
116+
cmake --install .
119117
cd ..
120118
done

build-lldb-mi.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ fi
5353

5454
if command -v ninja >/dev/null; then
5555
CMAKE_GENERATOR="Ninja"
56-
BUILDCMD=ninja
5756
else
5857
: ${CORES:=$(nproc 2>/dev/null)}
5958
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
@@ -64,7 +63,6 @@ else
6463
CMAKE_GENERATOR="MSYS Makefiles"
6564
;;
6665
esac
67-
BUILDCMD=make
6866
fi
6967

7068
export LLVM_DIR="$PREFIX"
@@ -147,4 +145,5 @@ cmake \
147145
$CMAKEFLAGS \
148146
..
149147

150-
$BUILDCMD ${CORES:+-j${CORES}} install/strip
148+
cmake --build . ${CORES:+-j${CORES}}
149+
cmake --install . --strip

build-llvm.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ fi
138138

139139
if command -v ninja >/dev/null; then
140140
CMAKE_GENERATOR="Ninja"
141-
BUILDCMD=ninja
142141
else
143142
: ${CORES:=$(nproc 2>/dev/null)}
144143
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
@@ -149,7 +148,6 @@ else
149148
CMAKE_GENERATOR="MSYS Makefiles"
150149
;;
151150
esac
152-
BUILDCMD=make
153151
fi
154152

155153
CMAKEFLAGS="$LLVM_CMAKEFLAGS"
@@ -309,6 +307,7 @@ cmake \
309307
$CMAKEFLAGS \
310308
..
311309

312-
$BUILDCMD ${CORES:+-j${CORES}} install/strip
310+
cmake --build . ${CORES:+-j${CORES}}
311+
cmake --install . --strip
313312

314313
cp ../LICENSE.TXT $PREFIX

build-openmp.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ cd llvm-project/openmp
5252

5353
if command -v ninja >/dev/null; then
5454
CMAKE_GENERATOR="Ninja"
55-
BUILDCMD=ninja
5655
else
5756
: ${CORES:=$(nproc 2>/dev/null)}
5857
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
@@ -63,7 +62,6 @@ else
6362
CMAKE_GENERATOR="MSYS Makefiles"
6463
;;
6564
esac
66-
BUILDCMD=make
6765
fi
6866

6967
for arch in $ARCHS; do
@@ -95,8 +93,8 @@ for arch in $ARCHS; do
9593
-DCMAKE_CXX_FLAGS_INIT="$CFGUARD_CFLAGS" \
9694
$CMAKEFLAGS \
9795
..
98-
$BUILDCMD ${CORES:+-j${CORES}}
99-
$BUILDCMD install
96+
cmake --build . ${CORES:+-j${CORES}}
97+
cmake --install .
10098
rm -f $PREFIX/$arch-w64-mingw32/bin/*iomp5md*
10199
rm -f $PREFIX/$arch-w64-mingw32/lib/*iomp5md*
102100
cd ..

0 commit comments

Comments
 (0)