diff options
| -rw-r--r-- | build_windows_modules.sh | 53 |
1 files changed, 39 insertions, 14 deletions
diff --git a/build_windows_modules.sh b/build_windows_modules.sh index 4475226407..9121a07e0e 100644 --- a/build_windows_modules.sh +++ b/build_windows_modules.sh @@ -1,10 +1,10 @@ set -eu -# Override this variable to set your own list of build configurations. Set this -# to "Release" to build release versions. +# List of solution configurations to build. +# Default configurations generated by Visual Studio are "Release" and "Debug". CPP_BUILD_MODES=${CPP_BUILD_MODES:-"Debug"} -# Override this variable to set different target platforms. Add "x86" to build -# win32 versions. +# List of target platforms to build for. +# Common platforms include "x86" and "x64". CPP_BUILD_TARGETS=${CPP_BUILD_TARGETS:-"x64"} # Override this to set a different cargo target directory CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-"./target/"} @@ -13,24 +13,40 @@ if [[ "${1:-""}" == "--dev-build" ]]; then DEV_BUILD=true fi -# Builds visual studio projects -function build_project +function clean_solution { local path="$1" - local sln="$1/$2" - + if [[ -z "${DEV_BUILD+x}" ]]; then # Clean all intermediate and output files rm -r $path/bin/* || true fi +} + +function build_solution_config +{ + local sln="$1" + local config="$2" + local platform="$3" set -x + cmd.exe "/c msbuild.exe /m $(to_win_path $sln) /p:Configuration=$config /p:Platform=$platform" + set +x +} + +# Builds visual studio solution in all (specified) configurations +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 - cmd.exe "/c msbuild.exe /m $(to_win_path $sln) /p:Configuration=$mode /p:Platform=$target" + build_solution_config $sln $mode $target done done - set +x } function to_win_path @@ -133,20 +149,29 @@ function rustc_host_arch | tr -d '"' } -function main +function build_nsis_plugins { + local nsis_root_path=${CPP_ROOT_PATH:-"./windows/nsis-plugins"} + clean_solution "$nsis_root_path" + build_solution_config "$nsis_root_path/nsis-plugins.sln" "Release" "x86" +} + +function main +{ local winfw_root_path=${CPP_ROOT_PATH:-"./windows/winfw"} local windns_root_path=${CPP_ROOT_PATH:-"./windows/windns"} local winroute_root_path=${CPP_ROOT_PATH:-"./windows/winroute"} - build_project "$winfw_root_path" "winfw.sln" - build_project "$windns_root_path" "windns.sln" - build_project "$winroute_root_path" "winroute.sln" + build_solution "$winfw_root_path" "winfw.sln" + build_solution "$windns_root_path" "windns.sln" + build_solution "$winroute_root_path" "winroute.sln" copy_outputs $winfw_root_path "winfw.dll" copy_outputs $windns_root_path "windns.dll" copy_outputs $winroute_root_path "winroute.dll" + + build_nsis_plugins } main |
