File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -197,8 +197,25 @@ fn main() {
197
197
// When building from Cargo, try to find MetaCall
198
198
match find_metacall_library ( ) {
199
199
Ok ( lib_path) => {
200
+ // Define linker flags
200
201
println ! ( "cargo:rustc-link-search=native={}" , lib_path. path. display( ) ) ;
201
202
println ! ( "cargo:rustc-link-lib=dylib={}" , lib_path. library) ;
203
+
204
+ // Set the runtime environment variable for finding the library during tests
205
+ #[ cfg( target_os = "linux" ) ]
206
+ println ! (
207
+ "cargo:rustc-env=LD_LIBRARY_PATH={}" ,
208
+ lib_path. path. display( )
209
+ ) ;
210
+
211
+ #[ cfg( target_os = "macos" ) ]
212
+ println ! (
213
+ "cargo:rustc-env=DYLD_LIBRARY_PATH={}" ,
214
+ lib_path. path. display( )
215
+ ) ;
216
+
217
+ #[ cfg( target_os = "windows" ) ]
218
+ println ! ( "cargo:rustc-env=PATH={}" , lib_path. path. display( ) ) ;
202
219
}
203
220
Err ( e) => {
204
221
// Print the error
You can’t perform that action at this time.
0 commit comments