File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -19,3 +19,13 @@ winapi = {version = "0.3", features = ["minwindef"] }
19
19
20
20
[build-dependencies ]
21
21
cc = " 1.0"
22
+
23
+ [package .metadata .docs .rs ]
24
+ default-target = " x86_64-pc-windows-msvc"
25
+ targets = [" x86_64-pc-windows-msvc" ]
26
+ # Docs.rs does not have a C cross compiler for windows. This cfg is set so that
27
+ # build.rs can know that it is in a docs.rs build and skip C compilation.
28
+ #
29
+ # https://github.com/rust-lang/docs.rs/issues/147#issuecomment-389544407
30
+ rustc-args = [" --cfg" , " memory_module_sys_docs_rs" ]
31
+ rustdoc-args = [" --cfg" , " memory_module_sys_docs_rs" ]
Original file line number Diff line number Diff line change 1
1
fn main ( ) {
2
- println ! ( "cargo:rerun-if-changed=src/memorymodule.c" ) ;
3
- println ! ( "cargo:rerun-if-changed=src/memorymodule.h" ) ;
2
+ // Skip C compilation if building on docs.rs.
3
+ if cfg ! ( not( memory_module_sys_docs_rs) ) {
4
+ println ! ( "cargo:rerun-if-changed=src/memorymodule.c" ) ;
5
+ println ! ( "cargo:rerun-if-changed=src/memorymodule.h" ) ;
4
6
5
- cc:: Build :: new ( )
6
- . file ( "src/memorymodule.c" )
7
- . compile ( "memorymodule" ) ;
7
+ cc:: Build :: new ( )
8
+ . file ( "src/memorymodule.c" )
9
+ . compile ( "memorymodule" ) ;
10
+ }
8
11
}
You can’t perform that action at this time.
0 commit comments