@@ -80,25 +80,25 @@ fn run_builder<'a, B: BindingBuilder<'a>>(
8080) -> B {
8181 let mut platforms = PlatformLocations :: new ( ) ;
8282 if let Some ( package_src) = package_src {
83- let platform_path = [ package_src, Platform :: Linux . to_string ( ) ]
83+ let platform_path = [ package_src, Platform :: Win64 . to_string ( ) ]
8484 . iter ( )
8585 . collect :: < PathBuf > ( ) ;
8686 if platform_path. is_dir ( ) {
87- platforms. add ( Platform :: Linux , platform_path) ;
87+ platforms. add ( Platform :: Win64 , platform_path) ;
8888 }
8989
90- let platform_path = [ package_src, Platform :: Win64 . to_string ( ) ]
90+ let platform_path = [ package_src, Platform :: Linux . to_string ( ) ]
9191 . iter ( )
9292 . collect :: < PathBuf > ( ) ;
9393 if platform_path. is_dir ( ) {
94- platforms. add ( Platform :: Win64 , platform_path) ;
94+ platforms. add ( Platform :: Linux , platform_path) ;
9595 }
9696
97- let platform_path = [ package_src, Platform :: Win32 . to_string ( ) ]
97+ let platform_path = [ package_src, Platform :: LinuxMusl . to_string ( ) ]
9898 . iter ( )
9999 . collect :: < PathBuf > ( ) ;
100100 if platform_path. is_dir ( ) {
101- platforms. add ( Platform :: Win32 , platform_path) ;
101+ platforms. add ( Platform :: LinuxMusl , platform_path) ;
102102 }
103103 } else {
104104 platforms. add ( Platform :: current ( ) , ffi_path ( ) ) ;
@@ -108,7 +108,18 @@ fn run_builder<'a, B: BindingBuilder<'a>>(
108108 panic ! ( "No platforms found!" ) ;
109109 }
110110
111+ let has_dynamic_libs = platforms. has_dynamic_lib ( ) ;
112+
111113 let mut builder = B :: new ( settings, platforms) ;
114+
115+ if B :: requires_dynamic_lib ( ) && !has_dynamic_libs {
116+ println ! (
117+ "Skipping {} because it requires dynamic libraries" ,
118+ B :: name( )
119+ ) ;
120+ return builder;
121+ }
122+
112123 builder. generate ( package_src. is_some ( ) ) ;
113124
114125 if package_src. is_none ( ) {
@@ -132,6 +143,8 @@ pub struct BindingBuilderSettings<'a> {
132143}
133144
134145trait BindingBuilder < ' a > {
146+ fn name ( ) -> & ' static str ;
147+ fn requires_dynamic_lib ( ) -> bool ;
135148 fn new ( settings : & ' a BindingBuilderSettings < ' a > , platforms : PlatformLocations ) -> Self ;
136149 fn generate ( & mut self , is_packaging : bool ) ;
137150 fn build ( & mut self ) ;
@@ -175,6 +188,14 @@ impl<'a> CBindingBuilder<'a> {
175188}
176189
177190impl < ' a > BindingBuilder < ' a > for CBindingBuilder < ' a > {
191+ fn name ( ) -> & ' static str {
192+ "c"
193+ }
194+
195+ fn requires_dynamic_lib ( ) -> bool {
196+ false
197+ }
198+
178199 fn new ( settings : & ' a BindingBuilderSettings < ' a > , platforms : PlatformLocations ) -> Self {
179200 Self {
180201 settings,
@@ -256,6 +277,14 @@ impl<'a> DotnetBindingBuilder<'a> {
256277}
257278
258279impl < ' a > BindingBuilder < ' a > for DotnetBindingBuilder < ' a > {
280+ fn name ( ) -> & ' static str {
281+ "dotnet"
282+ }
283+
284+ fn requires_dynamic_lib ( ) -> bool {
285+ true
286+ }
287+
259288 fn new ( settings : & ' a BindingBuilderSettings < ' a > , platforms : PlatformLocations ) -> Self {
260289 Self {
261290 settings,
@@ -359,6 +388,14 @@ impl<'a> JavaBindingBuilder<'a> {
359388}
360389
361390impl < ' a > BindingBuilder < ' a > for JavaBindingBuilder < ' a > {
391+ fn name ( ) -> & ' static str {
392+ "java"
393+ }
394+
395+ fn requires_dynamic_lib ( ) -> bool {
396+ true
397+ }
398+
362399 fn new ( settings : & ' a BindingBuilderSettings < ' a > , platforms : PlatformLocations ) -> Self {
363400 Self {
364401 settings,
0 commit comments