From 900ba559b637b6d99bc95e6f0d270543713096fd Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Mon, 12 Jun 2017 23:08:08 +0100 Subject: [PATCH] Compile WindowsMMap too on MSVC --- src/libprofiler_builtins/build.rs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/libprofiler_builtins/build.rs b/src/libprofiler_builtins/build.rs index a9685ca7e1aa..4397d2ebb21e 100644 --- a/src/libprofiler_builtins/build.rs +++ b/src/libprofiler_builtins/build.rs @@ -21,9 +21,24 @@ fn main() { let target = env::var("TARGET").expect("TARGET was not set"); let cfg = &mut gcc::Config::new(); + let mut profile_sources = vec!["GCDAProfiling.c", + "InstrProfiling.c", + "InstrProfilingBuffer.c", + "InstrProfilingFile.c", + "InstrProfilingMerge.c", + "InstrProfilingMergeFile.c", + "InstrProfilingPlatformDarwin.c", + "InstrProfilingPlatformLinux.c", + "InstrProfilingPlatformOther.c", + "InstrProfilingRuntime.cc", + "InstrProfilingUtil.c", + "InstrProfilingValue.c", + "InstrProfilingWriter.c"]; + if target.contains("msvc") { // Don't pull in extra libraries on MSVC cfg.flag("/Zl"); + profile_sources.push("WindowsMMap.c"); } else { // Turn off various features of gcc and such, mostly copying // compiler-rt's build system already @@ -34,20 +49,6 @@ fn main() { cfg.define("VISIBILITY_HIDDEN", None); } - let profile_sources = &["GCDAProfiling.c", - "InstrProfiling.c", - "InstrProfilingBuffer.c", - "InstrProfilingFile.c", - "InstrProfilingMerge.c", - "InstrProfilingMergeFile.c", - "InstrProfilingPlatformDarwin.c", - "InstrProfilingPlatformLinux.c", - "InstrProfilingPlatformOther.c", - "InstrProfilingRuntime.cc", - "InstrProfilingUtil.c", - "InstrProfilingValue.c", - "InstrProfilingWriter.c"]; - for src in profile_sources { cfg.file(Path::new("../compiler-rt/lib/profile").join(src)); }