Skip to content

Commit

Permalink
Do not clean Windows modules between building arm and x86
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Jan 21, 2025
1 parent cb538fc commit 683aefa
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 17 deletions.
46 changes: 30 additions & 16 deletions build-windows-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;;
Expand All @@ -16,24 +17,31 @@ 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"}
# List of target platforms to build for.
# 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 {
Expand Down Expand Up @@ -92,25 +100,31 @@ 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"

build_nsis_plugins
}

main
case $ACTION in
"build") build_all;;
"clean") clean_all;;
*)
echo "Unknown build action: $ACTION"
exit 1
;;
esac
8 changes: 7 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;;
Expand All @@ -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=(
Expand Down

0 comments on commit 683aefa

Please sign in to comment.