Skip to content

Commit

Permalink
Compile WindowsMMap too on MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-c committed Jun 12, 2017
1 parent ce56daf commit 900ba55
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/libprofiler_builtins/build.rs
Expand Up @@ -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
Expand All @@ -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));
}
Expand Down

0 comments on commit 900ba55

Please sign in to comment.