aboutsummaryrefslogtreecommitdiff
path: root/build2/cxx/compile.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-19 11:10:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-19 11:10:27 +0200
commit3ec07c196c9ab86db09c77bff7eb11cd5a5a9b1e (patch)
tree64fa1a8ec1e0152898843bb82a775c4ba1f194e0 /build2/cxx/compile.cxx
parent1470c64377bfd29d434261208cd91b001b17c3f4 (diff)
Add support for building DLLs with VC
Diffstat (limited to 'build2/cxx/compile.cxx')
-rw-r--r--build2/cxx/compile.cxx26
1 files changed, 15 insertions, 11 deletions
diff --git a/build2/cxx/compile.cxx b/build2/cxx/compile.cxx
index 085f6b4..9efa0b6 100644
--- a/build2/cxx/compile.cxx
+++ b/build2/cxx/compile.cxx
@@ -340,22 +340,24 @@ namespace build2
for (auto i (v.begin ()), e (v.end ()); i != e; ++i)
{
- // -I can either be in the "-Ifoo" or "-I foo" form.
- //
- // @@ VC: should we also handle /I?
+ // -I can either be in the "-Ifoo" or "-I foo" form. For VC it can
+ // also be /I.
//
+ const string& o (*i);
+
+ if (o.size () < 2 || (o[0] != '-' && o[0] != '/') || o[1] != 'I')
+ continue;
+
dir_path d;
- if (*i == "-I")
+ if (o.size () == 2)
{
if (++i == e)
break; // Let the compiler complain.
d = dir_path (*i);
}
- else if (i->compare (0, 2, "-I") == 0)
- d = dir_path (*i, 2, string::npos);
else
- continue;
+ d = dir_path (*i, 2, string::npos);
l6 ([&]{trace << "-I '" << d << "'";});
@@ -1298,8 +1300,8 @@ namespace build2
// create a .pdb per object file.
//
// Note that this also changes the name of the .idb file (used for
- // minimal rebuild and incremental compilation) by taking /Fd value
- // replacing the .pdb extension to .idb.
+ // minimal rebuild and incremental compilation): cl.exe take the /Fd
+ // value and replaces the .pdb extension with .idb.
//
// Note also that what we are doing here appears to be incompatible
// with PCH (/Y* options) and /Gm (minimal rebuild).
@@ -1361,6 +1363,8 @@ namespace build2
// @@ VC prints file name being compiled to stdout as the first
// line, would be good to weed it out (but check if it is
// always printed, for example if the file does not exist).
+ // Seems always. The same story with link.exe when creating
+ // the DLL.
//
// VC++ cl.exe sends diagnostics to stdout. To fix this (and any other
@@ -1407,9 +1411,9 @@ namespace build2
initializer_list<const char*> e;
if (cid == "msvc")
- e = {"+.d", "+.idb", "+.pdb"};
+ e = {".d", ".idb", ".pdb"};
else
- e = {"+.d"};
+ e = {".d"};
return clean_extra (a, t, e);
}