diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 08:15:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 08:15:35 +0000 |
commit | f09848204fa5283d21ea43e262ee41aa578e1808 (patch) | |
tree | c62385d7adf209fa6a798635954d887f718fb3fb /packaging/windows/compile-on-windows.sh | |
parent | Releasing debian version 1.46.3-2. (diff) | |
download | netdata-f09848204fa5283d21ea43e262ee41aa578e1808.tar.xz netdata-f09848204fa5283d21ea43e262ee41aa578e1808.zip |
Merging upstream version 1.47.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/windows/compile-on-windows.sh')
-rwxr-xr-x | packaging/windows/compile-on-windows.sh | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/packaging/windows/compile-on-windows.sh b/packaging/windows/compile-on-windows.sh new file mode 100755 index 000000000..ceb4f5502 --- /dev/null +++ b/packaging/windows/compile-on-windows.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +REPO_ROOT="$(dirname "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd -P)")")" +CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-RelWithDebInfo}" + +# shellcheck source=./win-build-dir.sh +. "${REPO_ROOT}/packaging/windows/win-build-dir.sh" + +set -exu -o pipefail + +if [ -d "${build}" ]; then + rm -rf "${build}" +fi + +generator="Unix Makefiles" +build_args="-j $(nproc)" + +if command -v ninja >/dev/null 2>&1; then + generator="Ninja" + build_args="-k 1" +fi + +COMMON_CFLAGS="-Wa,-mbig-obj -pipe -D_FILE_OFFSET_BITS=64 -D__USE_MINGW_ANSI_STDIO=1" + +if [ "${CMAKE_BUILD_TYPE}" = "Debug" ]; then + BUILD_CFLAGS="-fstack-protector-all -O0 -ggdb -Wall -Wextra -Wno-char-subscripts -DNETDATA_INTERNAL_CHECKS=1 ${COMMON_CFLAGS} ${CFLAGS:-}" +else + BUILD_CFLAGS="-O2 ${COMMON_CFLAGS} ${CFLAGS:-}" +fi + +${GITHUB_ACTIONS+echo "::group::Configuring"} +# shellcheck disable=SC2086 +CFLAGS="${BUILD_CFLAGS}" /usr/bin/cmake \ + -S "${REPO_ROOT}" \ + -B "${build}" \ + -G "${generator}" \ + -DCMAKE_INSTALL_PREFIX="/opt/netdata" \ + -DBUILD_FOR_PACKAGING=On \ + -DNETDATA_USER="${USER}" \ + -DENABLE_ACLK=On \ + -DENABLE_CLOUD=On \ + -DENABLE_H2O=Off \ + -DENABLE_ML=On \ + -DENABLE_PLUGIN_GO=On \ + -DENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE=Off \ + -DENABLE_BUNDLED_JSONC=On \ + -DENABLE_BUNDLED_PROTOBUF=Off \ + ${EXTRA_CMAKE_OPTIONS:-} +${GITHUB_ACTIONS+echo "::endgroup::"} + +${GITHUB_ACTIONS+echo "::group::Building"} +# shellcheck disable=SC2086 +cmake --build "${build}" -- ${build_args} +${GITHUB_ACTIONS+echo "::endgroup::"} + +if [ -t 1 ]; then + echo + echo "Compile with:" + echo "cmake --build \"${build}\"" +fi |