aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/msvc.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-08-24 15:41:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-08-24 15:41:54 +0200
commit3a8972b42f75e10e9a833bba58d65009e7bed7f3 (patch)
treecb350e533b967b828ece6a59ced5bb2caa932de7 /build2/cc/msvc.cxx
parentfeb55ebfdc536c32de2c173d108df5ee0004da44 (diff)
Handle *.export.libs, distinguish interface and implementation dependencies
A library dependency on another libraries is either "interface" or "implementation". If it is interface, then everyone who links to this library should also link to the interface dependency, explicitly. A good example of an interface dependency is a library API that is called in inline functions. Interface dependencies of a library should be explicitly listed in the *.export.libs (where we can also list target names). So the typical usage will be along these lines: import int_libs = libfoo%lib{foo} import int_libs += ... import imp_libs = libbar%lib{bar} import imp_libs += ... lib{baz}: ... $int_libs $imp_libs lib{baz}: cxx.export.libs = $int_libs
Diffstat (limited to 'build2/cc/msvc.cxx')
-rw-r--r--build2/cc/msvc.cxx22
1 files changed, 13 insertions, 9 deletions
diff --git a/build2/cc/msvc.cxx b/build2/cc/msvc.cxx
index 84f5853..d088c5b 100644
--- a/build2/cc/msvc.cxx
+++ b/build2/cc/msvc.cxx
@@ -219,7 +219,7 @@ namespace build2
msvc_search_library (const char* mod,
const process_path& ld,
const dir_path& d,
- prerequisite& p,
+ const prerequisite_key& p,
otype lt,
const char* pfx,
const char* sfx)
@@ -228,6 +228,9 @@ namespace build2
//
tracer trace (mod, "msvc_search_library");
+ const string* ext (p.tk.ext);
+ const string& name (*p.tk.name);
+
// Assemble the file path.
//
path f (d);
@@ -235,18 +238,18 @@ namespace build2
if (*pfx != '\0')
{
f /= pfx;
- f += p.name;
+ f += name;
}
else
- f /= p.name;
+ f /= name;
if (*sfx != '\0')
f += sfx;
const string& e (
- p.ext == nullptr || p.is_a<lib> () // Only for liba/libs.
+ ext == nullptr || p.is_a<lib> () // Only for liba/libs.
? extension_pool.find ("lib")
- : *p.ext);
+ : *ext);
if (!e.empty ())
{
@@ -262,7 +265,7 @@ namespace build2
{
// Enter the target.
//
- T& t (targets.insert<T> (d, dir_path (), p.name, &e, trace));
+ T& t (targets.insert<T> (d, dir_path (), name, &e, trace));
if (t.path ().empty ())
t.path (move (f));
@@ -277,7 +280,7 @@ namespace build2
liba* link::
msvc_search_static (const process_path& ld,
const dir_path& d,
- prerequisite& p) const
+ const prerequisite_key& p) const
{
liba* r (nullptr);
@@ -304,7 +307,7 @@ namespace build2
libs* link::
msvc_search_shared (const process_path& ld,
const dir_path& d,
- prerequisite& p) const
+ const prerequisite_key& p) const
{
tracer trace (x, "link::msvc_search_shared");
@@ -316,7 +319,8 @@ namespace build2
if (libi* i =
msvc_search_library<libi> (x, ld, d, p, otype::s, pf, sf))
{
- r = &targets.insert<libs> (d, dir_path (), p.name, nullptr, trace);
+ r = &targets.insert<libs> (
+ d, dir_path (), *p.tk.name, nullptr, trace);
if (r->member == nullptr)
{