diff options
| -rwxr-xr-x | build.sh | 2 | ||||
| -rw-r--r-- | build_windows_libraries.sh | 45 |
2 files changed, 37 insertions, 10 deletions
@@ -104,7 +104,7 @@ sed -i.bak \ ################################################################################ if [[ "$(uname -s)" == "MINGW"* ]]; then - ./build_windows_libraries.sh $1 + CPP_BUILD_MODES="Release" ./build_windows_libraries.sh $1 fi echo "Building Rust code in release mode using $RUSTC_VERSION..." diff --git a/build_windows_libraries.sh b/build_windows_libraries.sh index 2726170c75..b675112e28 100644 --- a/build_windows_libraries.sh +++ b/build_windows_libraries.sh @@ -3,12 +3,14 @@ set -eu # List of solutions to build WINFW_SOLUTIONS=${WINFW_SOLUTIONS:-"winfw"} WINDNS_SOLUTIONS=${WINDNS_SOLUTIONS:-"windns"} +WINROUTE_SOLUTIONS=${WINROUTE_SOLUTIONS:-"winroute"} -# Override this variable to set your own list of build configurations for -# wfpctl -CPP_BUILD_MODES=${CPP_BUILD_MODES:-"Debug Release"} -# Override this variable to set different target platforms for wfpctl -CPP_BUILD_TARGETS=${CPP_BUILD_TARGETS:-"x86 x64"} +# Override this variable to set your own list of build configurations. Set this +# to "Release" to build release versions. +CPP_BUILD_MODES=${CPP_BUILD_MODES:-"Debug"} +# Override this variable to set different target platforms. Add "x86" to build +# win32 versions. +CPP_BUILD_TARGETS=${CPP_BUILD_TARGETS:-"x64"} # Override this to set a different cargo target directory CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-"./target/"} @@ -46,18 +48,18 @@ function to_win_path fi } -function get_wfp_output_path +function get_solution_output_path { - local wfp_root=$1 + local solution_root=$1 local build_target=$2 local build_mode=$3 case $build_target in "x86") - echo "$wfp_root/bin/Win32-$build_mode" + echo "$solution_root/bin/Win32-$build_mode" ;; "x64") - echo "$wfp_root/bin/x64-$build_mode" + echo "$solution_root/bin/x64-$build_mode" ;; *) echo Unkown build target $build_target @@ -87,6 +89,25 @@ function get_cargo_target_dir echo "$CARGO_TARGET_DIR/$platform_triplet/${build_mode,,}" } +function copy_outputs +{ + local solution_path=$1 + local artifacts=$2 + + for mode in $CPP_BUILD_MODES; do + for target in $CPP_BUILD_TARGETS; do + local dll_path=$(get_solution_output_path $solution_path $target $mode) + local cargo_target=$(get_cargo_target_dir $target $mode) + mkdir -p $cargo_target + for artifact in $artifacts; do + cp "$dll_path/$artifact" "$cargo_target" + done + done + done + +} + + # Since Microsoft likes to name their architectures differently from Rust, this # function tries to match microsoft names to Rust names. function arch_from_build_target @@ -120,9 +141,15 @@ 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" "$WINFW_SOLUTIONS" build_project "$windns_root_path/windns.sln" "$WINDNS_SOLUTIONS" + build_project "$winroute_root_path/winroute.sln" "$WINROUTE_SOLUTIONS" + + copy_outputs $winfw_root_path "winfw.dll" + copy_outputs $windns_root_path "windns.dll" + copy_outputs $winroute_root_path "winroute.dll" } main |
