aboutsummaryrefslogtreecommitdiff
path: root/build2/cc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-04-23 14:25:58 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-04-26 09:38:09 +0200
commitf98262e37f608330fcfce799dcacc6fbacac8f8a (patch)
tree080ef26d80ee6419ef3a2f27434d75136f502cb2 /build2/cc
parentc414abe13450e2b4e204f6368ba83c8916de1ebd (diff)
Implement forwarded configurations and backlinking
Diffstat (limited to 'build2/cc')
-rw-r--r--build2/cc/compile-rule.cxx5
-rw-r--r--build2/cc/link-rule.cxx42
-rw-r--r--build2/cc/pkgconfig.cxx2
-rw-r--r--build2/cc/windows-rpath.cxx9
4 files changed, 42 insertions, 16 deletions
diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx
index d6fea9f..ebcf7b8 100644
--- a/build2/cc/compile-rule.cxx
+++ b/build2/cc/compile-rule.cxx
@@ -3853,7 +3853,10 @@ namespace build2
2); /* verbosity */
}
- ps = &load_project (as->rw () /* lock */, pd, pd);
+ ps = &load_project (as->rw () /* lock */,
+ pd,
+ pd,
+ false /* forwarded */);
}
}
diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx
index 4379362..4d98e5f 100644
--- a/build2/cc/link-rule.cxx
+++ b/build2/cc/link-rule.cxx
@@ -477,6 +477,34 @@ namespace build2
match_recipe (pc, group_recipe); // Set recipe and unlock.
}
+
+ // Add the Windows rpath emulating assembly directory as fsdir{}.
+ //
+ // Currently this is used in the backlinking logic and in the future
+ // could also be used for clean (though there we may want to clean
+ // old assemblies).
+ //
+ if (ot == otype::e && tclass == "windows")
+ {
+ // Note that here we cannot determine whether we will actually
+ // need one (for_install, library timestamps are not available at
+ // this point to call windows_rpath_timestamp()). So we may add
+ // the ad hoc target but actually not produce the assembly. So
+ // whomever relies on this must check if the directory actually
+ // exists (windows_rpath_assembly() does take care to clean it up
+ // if not used).
+ //
+ target_lock dir (
+ add_adhoc_member (
+ a,
+ t,
+ fsdir::static_type,
+ path_cast<dir_path> (t.path () + ".dlls"),
+ t.out,
+ string ()));
+
+ match_recipe (dir, group_recipe); // Set recipe and unlock.
+ }
}
}
@@ -1258,7 +1286,7 @@ namespace build2
// If targeting Windows, take care of the manifest.
//
path manifest; // Manifest itself (msvc) or compiled object file.
- timestamp rpath_timestamp (timestamp_nonexistent); // DLLs timestamp.
+ timestamp rpath_timestamp = timestamp_nonexistent; // DLLs timestamp.
if (lt.executable () && tclass == "windows")
{
@@ -1269,10 +1297,7 @@ namespace build2
if (!for_install)
rpath_timestamp = windows_rpath_timestamp (t, bs, a, li);
- pair<path, bool> p (
- windows_manifest (t,
- rpath_timestamp != timestamp_nonexistent));
-
+ auto p (windows_manifest (t, rpath_timestamp != timestamp_nonexistent));
path& mf (p.first);
bool mf_cf (p.second); // Changed flag (timestamp resolution).
@@ -2032,10 +2057,9 @@ namespace build2
if (tclass == "windows")
{
- // For Windows generate rpath-emulating assembly (unless updating for
- // install).
+ // For Windows generate (or clean up) rpath-emulating assembly.
//
- if (lt.executable () && !for_install)
+ if (lt.executable ())
windows_rpath_assembly (t, bs, a, li,
cast<string> (rs[x_target_cpu]),
rpath_timestamp,
@@ -2052,7 +2076,7 @@ namespace build2
try
{
- if (file_exists (l, false)) // The -f part.
+ if (file_exists (l, false /* follow_symlinks */)) // The -f part.
try_rmfile (l);
mksymlink (f, l);
diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx
index 9d52db9..378be49 100644
--- a/build2/cc/pkgconfig.cxx
+++ b/build2/cc/pkgconfig.cxx
@@ -1005,7 +1005,7 @@ namespace build2
}
{
- mt.vars.assign (*x_symexport) = (se == "true");
+ mt.vars.assign (x_symexport) = (se == "true");
}
tl.second.unlock ();
diff --git a/build2/cc/windows-rpath.cxx b/build2/cc/windows-rpath.cxx
index 8854542..594e3e0 100644
--- a/build2/cc/windows-rpath.cxx
+++ b/build2/cc/windows-rpath.cxx
@@ -215,8 +215,7 @@ namespace build2
const char*
windows_manifest_arch (const string& tcpu); // windows-manifest.cxx
- // The ts argument should be the the DLLs timestamp returned by
- // *_timestamp().
+ // The ts argument should be the DLLs timestamp returned by *_timestamp().
//
// The scratch argument should be true if the DLL set has changed and we
// need to regenerate everything from scratch. Otherwise, we try to avoid
@@ -248,10 +247,10 @@ namespace build2
// signalling that there aren't any DLLs but the assembly manifest
// file exists. This, however, can only happen if we somehow managed
// to transition from the "have DLLs" state to "no DLLs" without going
- // through the "from scratch" update. And this shouldn't happen
- // (famous last words before a core dump).
+ // through the "from scratch" update. Actually this can happen when
+ // switching to update-for-install.
//
- if (ts <= file_mtime (am))
+ if (ts != timestamp_nonexistent && ts <= file_mtime (am))
return;
}