Windows build fix (#18231)
Fix Windows CI build. And properly support building without Ninja.
Austin S. Hemmelgarn committed
Jul 26, 2024 at 11:25 UTC
da3cc243413bc591632c1386285b00bbb1cd011f
3 files changed
+14
-6
packaging/windows/compile-on-windows.sh
+13
-4
@@ -23,10 +23,18 @@ if [ -d "${build}" ]; then
23
rm -rf "${build}"
24
fi
25
26
+generator="Unix Makefiles"
27
+build_args="-j $(nproc)"
28
+
29
+if command -v ninja >/dev/null 2>&1; then
30
+ generator="Ninja"
31
+ build_args="-k 1"
32
+fi
33
+
34
${GITHUB_ACTIONS+echo "::group::Configuring"}
35
# shellcheck disable=SC2086
36
/usr/bin/cmake -S "${repo_root}" -B "${build}" \
29
- -G Ninja \
37
+ -G "${generator}" \
38
-DCMAKE_INSTALL_PREFIX="/opt/netdata" \
39
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
40
-DCMAKE_C_FLAGS="-fstack-protector-all -O0 -ggdb -Wall -Wextra -Wno-char-subscripts -Wa,-mbig-obj -pipe -DNETDATA_INTERNAL_CHECKS=1 -D_FILE_OFFSET_BITS=64 -D__USE_MINGW_ANSI_STDIO=1" \
@@ -39,15 +47,16 @@ ${GITHUB_ACTIONS+echo "::group::Configuring"}
47
-DENABLE_ML=On \
48
-DENABLE_BUNDLED_JSONC=On \
49
-DENABLE_BUNDLED_PROTOBUF=Off \
42
- ${EXTRA_CMAKE_OPTIONS:-''}
50
+ ${EXTRA_CMAKE_OPTIONS:-}
51
${GITHUB_ACTIONS+echo "::endgroup::"}
52
53
${GITHUB_ACTIONS+echo "::group::Building"}
46
-ninja -C "${build}" -k 1
54
+# shellcheck disable=SC2086
55
+cmake --build "${build}" -- ${build_args}
56
${GITHUB_ACTIONS+echo "::endgroup::"}
57
58
if [ -t 1 ]; then
59
echo
60
echo "Compile with:"
52
- echo "ninja -v -C \"${build}\" || ninja -v -C \"${build}\" -j 1"
61
+ echo "cmake --build \"${build}\""
62
fi
packaging/windows/msys2-dependencies.sh
-1
@@ -36,7 +36,6 @@ pacman -S --noconfirm \
36
msys/libuv-devel \
37
msys/pcre2-devel \
38
msys/zlib-devel \
39
- ninja \
39
openssl-devel \
40
protobuf-devel \
41
python \
packaging/windows/package-windows.sh
+1
-1
@@ -19,7 +19,7 @@ fi
19
set -exu -o pipefail
20
21
${GITHUB_ACTIONS+echo "::group::Installing"}
22
-ninja -C "${build}" -k 1 install
22
+cmake --install "${build}"
23
${GITHUB_ACTIONS+echo "::endgroup::"}
24
25
if [ ! -f "/msys2-installer.exe" ]; then