From cd04223474e351ab56a60e7411fb95fec15d24ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20L=C3=B6nnhager?= Date: Tue, 21 Jan 2025 09:35:45 +0100 Subject: [PATCH] Do not clean Windows modules between building arm and x86 --- build-windows-modules.sh | 46 ++++++++++++++++++++++++++-------------- build.sh | 8 ++++++- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/build-windows-modules.sh b/build-windows-modules.sh index 6fcfc7ae85cc..59552a113d54 100755 --- a/build-windows-modules.sh +++ b/build-windows-modules.sh @@ -6,6 +6,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$SCRIPT_DIR" source scripts/utils/host +source scripts/utils/log case $HOST in x86_64-pc-windows-msvc) HOST_TARGET=x64;; @@ -16,6 +17,19 @@ case $HOST in ;; esac +ACTION=build + +while [[ "$#" -gt 0 ]]; do + case $1 in + clean) ACTION="clean";; + *) + log_error "Unknown parameter: $1" + exit 1 + ;; + esac + shift +done + # List of solution configurations to build. # Default configurations generated by Visual Studio are "Release" and "Debug". CPP_BUILD_MODES=${CPP_BUILD_MODES:-"Debug"} @@ -23,17 +37,11 @@ CPP_BUILD_MODES=${CPP_BUILD_MODES:-"Debug"} # Common platforms include "x86" and "x64". CPP_BUILD_TARGETS=${CPP_BUILD_TARGETS:-"$HOST_TARGET"} -IS_RELEASE=${IS_RELEASE:-"false"} - function clean_solution { local path="$1" - - if [[ "$IS_RELEASE" == "true" ]]; then - # Clean all intermediate and output files - rm -r "${path:?}/bin/"* || true - else - echo "Will NOT clean intermediate files in $path/bin/ in dev builds" - fi + # Clean all intermediate and output files + echo "Removing ${path:?}..." + rm -r "${path:?}/bin/"* 2>/dev/null || true } function build_solution_config { @@ -92,20 +100,19 @@ function get_solution_output_path { function build_nsis_plugins { local nsis_root_path="./windows/nsis-plugins" - - clean_solution "$nsis_root_path" build_solution_config "$nsis_root_path/nsis-plugins.sln" "Release" "x86" } -function clean_libraries { +function clean_all { + local nsis_root_path="./windows/nsis-plugins" + clean_solution "$nsis_root_path" + clean_solution "./windows/libshared" clean_solution "./windows/windows-libraries" clean_solution "./windows/libwfp" } -function main { - clean_libraries - +function build_all { build_solution "./windows/winfw" "winfw.sln" build_solution "./windows/driverlogic" "driverlogic.sln" @@ -113,4 +120,11 @@ function main { build_nsis_plugins } -main +case $ACTION in + "build") build_all;; + "clean") clean_all;; + *) + echo "Unknown build action: $ACTION" + exit 1 + ;; +esac diff --git a/build.sh b/build.sh index 7d2bce9d511e..82123e6cf826 100755 --- a/build.sh +++ b/build.sh @@ -312,6 +312,12 @@ function build { } if [[ "$(uname -s)" == "MINGW"* ]]; then + if [[ "$IS_RELEASE" == "true" ]]; then + ./build-windows-modules.sh clean + else + echo "Will NOT clean intermediate files in ./windows/**/bin/ in dev builds" + fi + for t in "${TARGETS[@]:-"$HOST"}"; do case "${t:-"$HOST"}" in x86_64-pc-windows-msvc) CPP_BUILD_TARGET=x64;; @@ -323,7 +329,7 @@ if [[ "$(uname -s)" == "MINGW"* ]]; then esac log_header "Building C++ code in $CPP_BUILD_MODE mode for $CPP_BUILD_TARGET" - CPP_BUILD_MODES=$CPP_BUILD_MODE CPP_BUILD_TARGETS=$CPP_BUILD_TARGET IS_RELEASE=$IS_RELEASE ./build-windows-modules.sh + CPP_BUILD_MODES=$CPP_BUILD_MODE CPP_BUILD_TARGETS=$CPP_BUILD_TARGET ./build-windows-modules.sh if [[ "$SIGN" == "true" ]]; then CPP_BINARIES=(