Skip to content

Commit 3bce2e8

Browse files
committed
Test on/off CRT static
1 parent dd79e15 commit 3bce2e8

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.appveyor.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
environment:
22
matrix:
33
- TARGET: x86_64-pc-windows-msvc
4+
RUSTFLAGS: -C target-feature=-crt-static
5+
- TARGET: x86_64-pc-windows-msvc
6+
RUSTFLAGS: -C target-feature=+crt-static
47
- TARGET: i686-pc-windows-msvc
58
- TARGET: i686-pc-windows-gnu
69
MSYS_BITS: 32

src/lib.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ impl Build {
7272
configure
7373
// No shared objects, we just want static libraries
7474
.arg("no-dso")
75-
.arg("no-shared")
7675

7776
// Should be off by default on OpenSSL 1.1.0, but let's be extra sure
7877
.arg("no-ssl3")
@@ -97,11 +96,20 @@ impl Build {
9796
// On MSVC we need nasm.exe to compile the assembly files, but let's
9897
// just pessimistically assume for now that's not available.
9998
configure.arg("no-asm");
99+
100+
let features = env::var("CARGO_CFG_TARGET_FEATURE")
101+
.unwrap_or(String::new());
102+
if features.contains("crt-static") {
103+
configure.arg("no-shared");
104+
}
100105
} else {
101106
// If we're *not* on MSVC then we can optimize our build a bit by
102107
// avoiding building the CLI tools. Unfortunately though on MSVC if
103108
// we pass this option the build breaks oddly...
104109
configure.arg("no-stdio");
110+
111+
// Never shared on non-MSVC
112+
configure.arg("no-shared");
105113
}
106114

107115
let os = match target {

0 commit comments

Comments
 (0)