File tree Expand file tree Collapse file tree 2 files changed +23
-11
lines changed
docker/test/fixtures/rust Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ fn main() {
19
19
}
20
20
21
21
cc:: Build :: new ( ) . file ( "hello_c.c" ) . compile ( "hello_c" ) ;
22
- if target_os == "openbsd" || target_os == "windows" && target_env == "gnu" {
22
+ if target_os == "openbsd" || target_os == "windows" {
23
23
} else {
24
24
// Make sure that the link with libc works.
25
25
println ! ( "cargo:rustc-link-lib=c" ) ;
@@ -37,6 +37,11 @@ fn main() {
37
37
) ;
38
38
}
39
39
40
+ // TODO(windows-msvc):
41
+ if target_os == "windows" && target_env == "msvc" {
42
+ println ! ( "cargo:rustc-cfg=no_cmake" ) ;
43
+ return ;
44
+ }
40
45
let cmake_dst = cmake:: build ( "libhello_cmake" ) ;
41
46
println ! ( "cargo:rustc-link-search=native={}" , cmake_dst. display( ) ) ;
42
47
println ! ( "cargo:rustc-link-lib=static=hello_cmake" ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ extern "C" {
5
5
fn hello_c ( ) ;
6
6
#[ cfg( feature = "cpp" ) ]
7
7
fn hello_cpp ( ) ;
8
+ #[ cfg( not( no_cmake) ) ]
8
9
fn hello_cmake ( input : std:: os:: raw:: c_int ) -> std:: os:: raw:: c_int ;
9
10
}
10
11
@@ -16,11 +17,14 @@ fn main() {
16
17
#[ cfg( feature = "cpp" ) ]
17
18
hello_cpp ( ) ;
18
19
19
- let input = 4 ;
20
- let output = hello_cmake ( input) ;
21
- assert_eq ! ( output, 8 ) ;
22
- println ! ( "Hello Cmake from Rust!" ) ;
23
- println ! ( "{input} * 2 = {output}" ) ;
20
+ #[ cfg( not( no_cmake) ) ]
21
+ {
22
+ let input = 4 ;
23
+ let output = hello_cmake ( input) ;
24
+ assert_eq ! ( output, 8 ) ;
25
+ println ! ( "Hello Cmake from Rust!" ) ;
26
+ println ! ( "{input} * 2 = {output}" ) ;
27
+ }
24
28
}
25
29
}
26
30
@@ -36,11 +40,14 @@ mod tests {
36
40
#[ cfg( feature = "cpp" ) ]
37
41
hello_cpp ( ) ;
38
42
39
- let input = 4 ;
40
- let output = hello_cmake ( input) ;
41
- assert_eq ! ( output, 8 ) ;
42
- println ! ( "Hello Cmake from Rust!" ) ;
43
- println ! ( "{input} * 2 = {output}" ) ;
43
+ #[ cfg( not( no_cmake) ) ]
44
+ {
45
+ let input = 4 ;
46
+ let output = hello_cmake ( input) ;
47
+ assert_eq ! ( output, 8 ) ;
48
+ println ! ( "Hello Cmake from Rust!" ) ;
49
+ println ! ( "{input} * 2 = {output}" ) ;
50
+ }
44
51
}
45
52
}
46
53
}
You can’t perform that action at this time.
0 commit comments