@@ -96,6 +96,7 @@ fn build_and_link_libsbml(dep_build: &str) -> miette::Result<String> {
96
96
. static_crt ( true )
97
97
. profile ( "Release" )
98
98
. define ( "WITH_STATIC_RUNTIME" , "ON" )
99
+ . define ( "WITH_STABLE_PACKAGES" , "ON" ) // add support for all stable packages
99
100
. define ( "WITH_LIBXML" , WITH_LIBXML )
100
101
. define ( "WITH_EXPAT" , WITH_EXPAT )
101
102
//
@@ -125,6 +126,7 @@ fn build_and_link_libsbml(dep_build: &str) -> miette::Result<String> {
125
126
cmake:: Config :: new ( LIBSBML_PATH )
126
127
. profile ( "Release" )
127
128
. define ( "WITH_STATIC_RUNTIME" , "OFF" )
129
+ . define ( "WITH_STABLE_PACKAGES" , "ON" ) // add support for all stable packages
128
130
. define ( "WITH_LIBXML" , WITH_LIBXML )
129
131
. define ( "WITH_EXPAT" , WITH_EXPAT )
130
132
. build ( )
@@ -138,8 +140,21 @@ fn build_and_link_libsbml(dep_build: &str) -> miette::Result<String> {
138
140
// static library is named "libsbml-static" and not "libsbml".
139
141
// which seems to confuse the rustc linker.
140
142
println ! ( "cargo:rustc-link-lib=libsbml-static" ) ;
143
+ } else if cfg ! ( target_os = "linux" ) {
144
+ // On Linux, we need to link against the static libraries
145
+ // if you thought windows had it rough, on linux
146
+ // it should just have been rustc-link-lib=sbml,
147
+ // but that didnt work, so lets bypass what cargo is doing
148
+ // and sneak the static library and dependencies into the link line
149
+ println ! ( "cargo:rustc-link-arg=-Wl,{}/lib/libsbml-static.a" , dst. display( ) ) ;
150
+ println ! ( "cargo:rustc-link-arg=-Wl,-lz" ) ;
151
+ println ! ( "cargo:rustc-link-arg=-Wl,-lexpat" ) ;
152
+ println ! ( "cargo:rustc-link-arg=-Wl,-lbz2" ) ;
153
+ println ! ( "cargo:rustc-link-arg=-Wl,-lstdc++" ) ;
154
+ println ! ( "cargo:rustc-link-arg=-Wl,-lc" ) ;
155
+ println ! ( "cargo:rustc-link-arg=-Wl,-lm" ) ;
141
156
} else {
142
- // On MacOS and Linux , we can just link against the dynamic library
157
+ // On MacOS, we can just link against the dynamic library
143
158
println ! ( "cargo:rustc-link-lib=dylib={}" , LIBSBML_NAME ) ;
144
159
}
145
160
@@ -198,7 +213,7 @@ fn print_dir_contents(path: &str) -> miette::Result<()> {
198
213
if path. is_file ( ) {
199
214
if let Some ( ext) = path. extension ( ) {
200
215
let ext_str = ext. to_string_lossy ( ) . to_lowercase ( ) ;
201
- if [ "a" , "dylib" , "lib" ] . contains ( & ext_str. as_str ( ) ) {
216
+ if [ "a" , "dylib" , "lib" , "so" ] . contains ( & ext_str. as_str ( ) ) {
202
217
println ! ( "cargo:info={}" , path. display( ) ) ;
203
218
}
204
219
}
0 commit comments