aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbuild2/cc/compile-rule.cxx10
-rw-r--r--libbuild2/cc/compile-rule.hxx3
-rw-r--r--libbuild2/cc/functions.cxx20
3 files changed, 22 insertions, 11 deletions
diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx
index 7059f15..1b8a5a8 100644
--- a/libbuild2/cc/compile-rule.cxx
+++ b/libbuild2/cc/compile-rule.cxx
@@ -690,12 +690,12 @@ namespace build2
const scope& bs,
action a, const file& l, bool la,
linfo li,
- bool common) const
+ bool common,
+ bool original) const
{
- // @@ Is this a good idea? We don't know which tool will be using
- // these...
- //
- const scope* is (isystem (*this) ? effective_iscope (bs) : nullptr);
+ const scope* is (!original && isystem (*this)
+ ? effective_iscope (bs)
+ : nullptr);
append_library_options (ls, args, bs, is, a, l, la, li, common, nullptr);
}
diff --git a/libbuild2/cc/compile-rule.hxx b/libbuild2/cc/compile-rule.hxx
index f3e4a9b..95734e0 100644
--- a/libbuild2/cc/compile-rule.hxx
+++ b/libbuild2/cc/compile-rule.hxx
@@ -66,7 +66,8 @@ namespace build2
void
append_library_options (appended_libraries&, strings&,
const scope&,
- action, const file&, bool, linfo, bool) const;
+ action, const file&, bool, linfo,
+ bool, bool) const;
optional<path>
find_system_header (const path&) const;
diff --git a/libbuild2/cc/functions.cxx b/libbuild2/cc/functions.cxx
index a0a0b4f..e7deb80 100644
--- a/libbuild2/cc/functions.cxx
+++ b/libbuild2/cc/functions.cxx
@@ -99,6 +99,9 @@ namespace build2
// For the second signature, targets can only be utility libraries
// (including the libul{} group).
//
+ // If <otype> in the first signature is NULL, then it is treated as
+ // the second signature.
+ //
struct lib_thunk_data
{
const char* x;
@@ -137,7 +140,7 @@ namespace build2
names& ts_ns (vs[0].as<names> ()); // <targets>
optional<linfo> li;
- if (vs.size () > 1)
+ if (vs.size () > 1 && !vs[1].null)
{
names& ot_ns (vs[1].as<names> ()); // <otype>
@@ -228,7 +231,7 @@ namespace build2
void compile_rule::
functions (function_family& f, const char* x)
{
- // $<module>.lib_poptions(<lib-targets>[, <otype>])
+ // $<module>.lib_poptions(<lib-targets>[, <otype>[, <original>]])
//
// Return the preprocessor options that should be passed when compiling
// sources that depend on the specified libraries. The second argument
@@ -240,6 +243,12 @@ namespace build2
// obtaining poptions to be passed to tools other than C/C++ compilers
// (for example, Qt moc).
//
+ // If <portable> is true, then return the original -I options without
+ // performing any translation (for example, to -isystem or /external:I).
+ // This is the default if <otype> is omitted. To get the translation for
+ // the common interface options, pass [null] for <otype> and true for
+ // <original>.
+ //
// Note that passing multiple targets at once is not a mere convenience:
// this also allows for more effective duplicate suppression.
//
@@ -251,12 +260,12 @@ namespace build2
// Note that this function is not pure.
//
f.insert (".lib_poptions", false).
- insert<lib_thunk_data, names, optional<names>> (
+ insert<lib_thunk_data, names, optional<names*>, optional<names>> (
&lib_thunk<appended_libraries>,
lib_thunk_data {
x,
[] (void* ls, strings& r,
- const vector_view<value>&, const module& m, const scope& bs,
+ const vector_view<value>& vs, const module& m, const scope& bs,
action a, const target& l, bool la, optional<linfo> li)
{
// If this is libul{}, get the matched member (see bin::libul_rule
@@ -269,13 +278,14 @@ namespace build2
l.prerequisite_targets[a].back ().target->as<file> ()));
bool common (!li);
+ bool original (vs.size () > 2 ? convert<bool> (vs[2]) : !li);
if (!li)
li = link_info (bs, link_type (f).type);
m.append_library_options (
*static_cast<appended_libraries*> (ls), r,
- bs, a, f, la, *li, common);
+ bs, a, f, la, *li, common, original);
}});
// $<module>.find_system_header(<name>)