rust_uno/Extension_rust_uno-example.mk |    4 ++--
 rust_uno/Library_rust_uno-example.mk   |    2 +-
 rust_uno/build.rs                      |   10 +++++++++-
 3 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 08aacf4edfd6374e55a8886c0e31cd8d1ba11ac3
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Oct 30 11:40:36 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Fri Oct 31 17:26:08 2025 +0100

    Fix --enable-rust-uno build on Windows
    
    No idea how to stop putting files to SRCDIR.
    No idea how to link against sal3.dll - I had to add instdir/sdk/lib
    in rust_uno/build.rs, because I found no other *sal*.lib.
    
    Change-Id: Ib236ab7a9da90a21bab00117841a04cd685a2be0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193179
    Reviewed-by: Mike Kaganski <[email protected]>
    Reviewed-by: RenĂ© Engelhard <[email protected]>
    Tested-by: Jenkins

diff --git a/rust_uno/Extension_rust_uno-example.mk 
b/rust_uno/Extension_rust_uno-example.mk
index fea1677e1966..d0ee22a657d7 100644
--- a/rust_uno/Extension_rust_uno-example.mk
+++ b/rust_uno/Extension_rust_uno-example.mk
@@ -14,13 +14,13 @@ $(eval $(call 
gb_Extension_add_file,rust_uno-example,platform.components,$(call
 $(eval $(call gb_Extension_add_files,rust_uno-example,, \
     $(SRCDIR)/rust_uno/example/Addons.xcu \
     $(SRCDIR)/rust_uno/example/ProtocolHandler.xcu \
-    $(SRCDIR)/rust_uno/target/release/librust_uno.so \
+    $(SRCDIR)/rust_uno/target/release/$(if $(filter 
WNT,$(OS_FOR_BUILD)),rust_uno.dll,librust_uno.so) \
 ))
 
 $(eval $(call gb_Extension_add_libraries,rust_uno-example, \
     rust_uno-example \
 ))
 
-$(SRCDIR)/rust_uno/target/release/librust_uno.so: $(call 
gb_CustomTarget_get_target,rust_uno/cargo)
+$(SRCDIR)/rust_uno/target/release/$(if $(filter 
WNT,$(OS_FOR_BUILD)),rust_uno.dll,librust_uno.so): $(call 
gb_CustomTarget_get_target,rust_uno/cargo)
 
 # vim: set noet sw=4 ts=4:
diff --git a/rust_uno/Library_rust_uno-example.mk 
b/rust_uno/Library_rust_uno-example.mk
index bee03c23c3b6..4f55a5b28296 100644
--- a/rust_uno/Library_rust_uno-example.mk
+++ b/rust_uno/Library_rust_uno-example.mk
@@ -31,7 +31,7 @@ $(eval $(call gb_Library_use_sdk_api,rust_uno-example))
 
 $(call gb_Library_get_target,rust_uno-example): $(call 
gb_CustomTarget_get_target,rust_uno/cargo)
 $(eval $(call gb_Library_add_libs,rust_uno-example,\
-    $(SRCDIR)/rust_uno/target/release/librust_uno.so \
+    $(SRCDIR)/rust_uno/target/release/$(if $(filter 
WNT,$(OS_FOR_BUILD)),rust_uno.dll.lib,librust_uno.so) \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/rust_uno/build.rs b/rust_uno/build.rs
index cf64720a0e14..a5c819986b80 100644
--- a/rust_uno/build.rs
+++ b/rust_uno/build.rs
@@ -14,12 +14,20 @@
 fn main() {
     // Tell cargo to link against the rust_uno-cpp library
     // This library contains the generated C++ bridge functions
-    println!("cargo:rustc-link-lib=rust_uno-cpplo");
+    // It requires linking against sal3.dll on Windows
+    if cfg!(windows) {
+        println!("cargo:rustc-link-lib=irust_uno-cpp");
+        println!("cargo:rustc-link-lib=isal");
+    } else {
+        println!("cargo:rustc-link-lib=rust_uno-cpplo");
+    }
 
     // Add the LibreOffice instdir/program directory to the library search path
     // This is where librust_uno-cpplo.so is located
+    // sal3.dll's .lib is under sdk/lib
     if let Ok(instdir) = std::env::var("INSTDIR") {
         println!("cargo:rustc-link-search=native={}/program", instdir);
+        println!("cargo:rustc-link-search=native={}/sdk/lib", instdir);
     }
 
     // Also try the workdir path where the library might be during build

Reply via email to