Do not clean Windows modules between building arm and x86

This commit is contained in:
David Lönnhager 2025-01-21 09:35:45 +01:00
parent 2f77310b6c
commit 3068d8f0e0
2 changed files with 37 additions and 19 deletions

View File

@ -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 {
@ -51,8 +59,6 @@ function build_solution {
local path="$1"
local sln="$1/$2"
clean_solution "$path"
for mode in $CPP_BUILD_MODES; do
for target in $CPP_BUILD_TARGETS; do
build_solution_config "$sln" "$mode" "$target"
@ -92,20 +98,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 +118,11 @@ function main {
build_nsis_plugins
}
main
case $ACTION in
"build") build_all;;
"clean") clean_all;;
*)
echo "Unknown build action: $ACTION"
exit 1
;;
esac

View File

@ -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=(