[librsvg] win32/rsvg-rust.mak: Streamline Rust build process



commit facef142477c7e13b773254bc7ace683c8096ea5
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Jun 15 20:16:43 2017 +0800

    win32/rsvg-rust.mak: Streamline Rust build process
    
    As the recommended way to setup Rust is via rustup, set the default
    toolchain/target during the NMake build process, so that one will only
    need to have the Rust executables in their PATH and ensure that they
    have the needed toolchains (i686-pc-windows-msvc and/or
    x86_64-pc-windows-msvc) installed via rustup.
    
    Please note that we are being conservative here-we use the stable
    releases of the toolchains only.  If using a beta/nightly toolchain
    release, one needs to update this file for this purpose.

 win32/rsvg-rust.mak |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/win32/rsvg-rust.mak b/win32/rsvg-rust.mak
index 1fccd93..fdde436 100644
--- a/win32/rsvg-rust.mak
+++ b/win32/rsvg-rust.mak
@@ -4,6 +4,16 @@
 CARGO = cargo
 !endif
 
+!if "$(RUSTUP)" == ""
+RUSTUP = rustup
+!endif
+
+!if "$(PLAT)" == "x64"
+RUST_TARGET = x86_64
+!else
+RUST_TARGET = i686
+!endif
+
 !if "$(VALID_CFGSET)" == "TRUE"
 BUILD_RUST = 1
 !else
@@ -11,10 +21,15 @@ BUILD_RUST = 0
 !endif
 
 !if "$(BUILD_RUST)" == "1"
+
+CARGO_TARGET = --target $(RUST_TARGET)-pc-windows-msvc
+DEFAULT_TARGET = stable-$(RUST_TARGET)-pc-windows-msvc
+RUSTUP_CMD = $(RUSTUP) default $(DEFAULT_TARGET)
+
 !if "$(CFG)" == "release" || "$(CFG)" == "Release"
-CARGO_CMD = $(CARGO) build --release
+CARGO_CMD = $(CARGO) build $(CARGO_TARGET) --release
 !else
-CARGO_CMD = $(CARGO) build
+CARGO_CMD = $(CARGO) build $(CARGO_TARGET)
 !endif
 
 all: vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_internals\$(CFG)\rsvg_internals.lib
@@ -22,6 +37,7 @@ all: vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_internals\$(CFG)\rsvg_internals.lib
 vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_internals\$(CFG)\rsvg_internals.lib:
        @set CARGO_TARGET_DIR=..\win32\vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_internals
        @set GTK_LIB_DIR=..\..\vs$(VSVER)\$(PLAT)\lib;$(LIB)
+       $(RUSTUP_CMD)
        @cd ..\rust
        $(CARGO_CMD) --verbose
        @cd ..\win32\vs$(VSVER)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]