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 <mike.kaganski@collabora.com>
Reviewed-by: René Engelhard <rene@debian.org>
Tested-by: Jenkins
This commit is contained in:
Mike Kaganski
2025-10-31 17:26:08 +01:00
parent b6d2fe4fcc
commit 08aacf4edf
3 changed files with 12 additions and 4 deletions
+2 -2
View File
@@ -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:
+1 -1
View File
@@ -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:
+9 -1
View File
@@ -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