aboutsummaryrefslogtreecommitdiff
path: root/build2/cxx/link.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-22 16:20:21 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-22 16:20:21 +0200
commit77869a0567f4c2e029c679525b29da53433d8d9f (patch)
tree602114470f105f5d90c46477fd3c142f8f25bd03 /build2/cxx/link.cxx
parent77c763542d2effdd6e76a23893c10dbaadfe70ae (diff)
Factor target CPU to VC /MACHINE option translation
Diffstat (limited to 'build2/cxx/link.cxx')
-rw-r--r--build2/cxx/link.cxx32
1 files changed, 13 insertions, 19 deletions
diff --git a/build2/cxx/link.cxx b/build2/cxx/link.cxx
index 34495b0..3ce99c9 100644
--- a/build2/cxx/link.cxx
+++ b/build2/cxx/link.cxx
@@ -1072,6 +1072,9 @@ namespace build2
void
windows_rpath_assembly (file&, timestamp, bool scratch);
+ const char*
+ msvc_machine (const string& cpu); // msvc.cxx
+
target_state link::
perform_update (action a, target& xt)
{
@@ -1252,25 +1255,6 @@ namespace build2
string soname1, soname2;
strings sargs;
- if (cid == "msvc")
- {
- // Translate the compiler target CPU to the /MACHINE option value.
- // This applies to both link.exe and lib.exe.
- //
- const string& tcpu (cast<string> (rs["cxx.target.cpu"]));
-
- const char* m (tcpu == "i386" || tcpu == "i686" ? "/MACHINE:x86" :
- tcpu == "x86_64" ? "/MACHINE:x64" :
- tcpu == "arm" ? "/MACHINE:ARM" :
- tcpu == "arm64" ? "/MACHINE:ARM64" :
- nullptr);
-
- if (m == nullptr)
- fail << "unable to translate CPU " << tcpu << " to /MACHINE";
-
- args.push_back (m);
- }
-
if (lt == otype::a)
{
if (cid == "msvc") ;
@@ -1488,6 +1472,11 @@ namespace build2
if (verb < 3)
args.push_back ("/NOLOGO");
+ // Add /MACHINE.
+ //
+ args.push_back (
+ msvc_machine (cast<string> (rs["cxx.target.cpu"])));
+
out = "/OUT:" + relt.string ();
args.push_back (out.c_str ());
}
@@ -1513,6 +1502,11 @@ namespace build2
if (lt == otype::s)
args.push_back ("/DLL");
+ // Add /MACHINE.
+ //
+ args.push_back (
+ msvc_machine (cast<string> (rs["cxx.target.cpu"])));
+
// Unless explicitly enabled with /INCREMENTAL, disable
// incremental linking (it is implicitly enabled if /DEBUG is
// specified). The reason is the .ilk file: its name cannot be