aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-10-08 10:16:49 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-10-08 10:16:49 +0200
commit1ec2e86ecf694f28ceedbfad5eca8d821a844418 (patch)
tree9105bc6440f583718f133b4be52a8230761e22dd /libbuild2
parentd730f40440e213bc08cce4587439960c80ad9aa5 (diff)
Pass MSVC and Platform SDK bin\ directories as binutils search paths
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/cc/guess.cxx55
1 files changed, 39 insertions, 16 deletions
diff --git a/libbuild2/cc/guess.cxx b/libbuild2/cc/guess.cxx
index e218539..b5b791c 100644
--- a/libbuild2/cc/guess.cxx
+++ b/libbuild2/cc/guess.cxx
@@ -1476,7 +1476,8 @@ namespace build2
// For Clang on Windows targeting MSVC we remap the target to match
// MSVC's.
//
- optional<dir_paths> sys_lib_dirs;
+ optional<dir_paths> lib_dirs;
+ string bin_pat;
if (tt.system == "windows-msvc")
{
@@ -1511,28 +1512,50 @@ namespace build2
gr.signature += " MSVC version ";
gr.signature += mi.msvc_ver;
+ const char* cpu (msvc_cpu (tt.cpu));
+
// Come up with the system library search paths. Ideally we would want
// to extract this from Clang and -print-search-paths would have been
// the natural way for Clang to report it. But no luck.
//
- dir_paths ds;
- const char* cpu (msvc_cpu (tt.cpu));
+ {
+ dir_paths ds;
- ds.push_back ((dir_path (mi.msvc_dir) /= "lib") /= cpu);
+ ds.push_back ((dir_path (mi.msvc_dir) /= "lib") /= cpu);
- // This path structure only appeared in Platform SDK 10 (if anyone
- // wants to use anything older, they will just have to use the MSVC
- // command prompt).
- //
- if (!mi.psdk_ver.empty ())
- {
- dir_path d ((dir_path (mi.psdk_dir) /= "Lib") /= mi.psdk_ver);
+ // This path structure only appeared in Platform SDK 10 (if anyone
+ // wants to use anything older, they will just have to use the MSVC
+ // command prompt).
+ //
+ if (!mi.psdk_ver.empty ())
+ {
+ dir_path d ((dir_path (mi.psdk_dir) /= "Lib") /= mi.psdk_ver);
- ds.push_back ((dir_path (d) /= "ucrt") /= cpu);
- ds.push_back ((dir_path (d) /= "um" ) /= cpu);
+ ds.push_back ((dir_path (d) /= "ucrt") /= cpu);
+ ds.push_back ((dir_path (d) /= "um" ) /= cpu);
+ }
+
+ lib_dirs = move (ds);
}
- sys_lib_dirs = move (ds);
+ // Binutils search paths.
+ //
+ // We shouldn't need them if we are running from the command prompt
+ // and omitting them in this case would also result in tidier command
+ // lines. However, reliably detecting this and making sure the result
+ // matches Clang's is complex. So let's keep it simple for now.
+ //
+ // Seeing that we only do 64-bit on Windows, let's always use 64-bit
+ // MSVC tools (link.exe, etc). In case of the Platform SDK, it's
+ // unclear what the CPU signifies (host, target, both).
+ //
+ bin_pat = (((dir_path (mi.msvc_dir) /= "bin") /= "Hostx64") /= cpu).
+ representation ();
+
+ bin_pat += path::traits_type::path_separator;
+
+ bin_pat += (((dir_path (mi.psdk_dir) /= "bin") /= mi.psdk_ver) /= cpu).
+ representation ();
}
// Derive the toolchain pattern. Try clang/clang++, the gcc/g++ alias,
@@ -1624,11 +1647,11 @@ namespace build2
move (t),
move (ot),
move (pat),
- "",
+ move (bin_pat),
move (rt),
move (csl),
move (xsl),
- move (sys_lib_dirs),
+ move (lib_dirs),
nullopt};
}