From 08aacf4edfd6374e55a8886c0e31cd8d1ba11ac3 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 30 Oct 2025 11:40:36 +0500 Subject: Fix --enable-rust-uno build on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: René Engelhard Tested-by: Jenkins --- 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(-) 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 -- cgit v1.2.3