aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-03-02 11:23:35 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-03-02 14:03:55 +0200
commite45345eeee4db91644a58842267393ff2df19fe2 (patch)
tree2579753e5e63da815cfceeb3c9b559935b7cdd36
parent705e806eb94b743ba962080c4b397d9b32af4a50 (diff)
Fix unit test code generation
-rw-r--r--build2/buildfile8
-rw-r--r--build2/cc/compile.cxx9
-rw-r--r--build2/dummy.cxx8
-rw-r--r--unit-tests/function/buildfile4
-rw-r--r--unit-tests/lexer/buildfile4
-rw-r--r--unit-tests/scheduler/buildfile5
-rw-r--r--unit-tests/test/script/lexer/buildfile4
-rw-r--r--unit-tests/test/script/parser/buildfile4
-rw-r--r--unit-tests/test/script/regex/buildfile2
9 files changed, 25 insertions, 23 deletions
diff --git a/build2/buildfile b/build2/buildfile
index a809a8b..a946bc7 100644
--- a/build2/buildfile
+++ b/build2/buildfile
@@ -93,7 +93,13 @@ test/script/{hxx ixx cxx}{ regex } \
test/script/{hxx cxx}{ runner } \
test/script/{hxx ixx cxx}{ script } \
test/script/{hxx cxx}{ token } \
- $libs
+ liba{b} $libs
+
+# Fake utility library (without it code generation does not work).
+#
+liba{b}: {cxx}{ dummy }
+liba{b}: cxx.export.poptions = "-I$out_root" "-I$src_root"
+liba{b}: install = false
# Pass our compiler target to be used as build2 host.
#
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx
index f202ba1..6493c61 100644
--- a/build2/cc/compile.cxx
+++ b/build2/cc/compile.cxx
@@ -516,9 +516,9 @@ namespace build2
{
tracer trace (x, "compile::append_prefixes");
- // If this target does not belong to any project (e.g, an
- // "imported as installed" library), then it can't possibly
- // generate any headers for us.
+ // If this target does not belong to any project (e.g, an "imported as
+ // installed" library), then it can't possibly generate any headers for
+ // us.
//
const scope* rs (t.base_scope ().root_scope ());
if (rs == nullptr)
@@ -554,8 +554,7 @@ namespace build2
l6 ([&]{trace << "-I '" << d << "'";});
- // If we are relative or not inside our project root, then
- // ignore.
+ // If we are relative or not inside our project root, then ignore.
//
if (d.relative () || !d.sub (out_root))
continue;
diff --git a/build2/dummy.cxx b/build2/dummy.cxx
new file mode 100644
index 0000000..bdea9a9
--- /dev/null
+++ b/build2/dummy.cxx
@@ -0,0 +1,8 @@
+// file : build2/dummy.cxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+namespace build2
+{
+ void dummy () {}
+}
diff --git a/unit-tests/function/buildfile b/unit-tests/function/buildfile
index 4d2862c..0f40dd4 100644
--- a/unit-tests/function/buildfile
+++ b/unit-tests/function/buildfile
@@ -4,8 +4,6 @@
#@@ Temporary until we get utility library support.
#
-if ($cxx.target.class != "windows")
- cxx.libs += -lpthread
import libs = libbutl%lib{butl}
src = token lexer diagnostics utility variable name b-options types-parsers \
context scope parser target operation rule prerequisite file module function \
@@ -13,6 +11,6 @@ functions-builtin functions-path functions-process-path functions-string \
functions-target-triplet algorithm search dump filesystem scheduler \
config/{utility init operation}
-exe{driver}: cxx{driver} ../../build2/cxx{$src} $libs test{call syntax}
+exe{driver}: cxx{driver} ../../build2/cxx{$src} ../../build2/liba{b} $libs test{call syntax}
include ../../build2/
diff --git a/unit-tests/lexer/buildfile b/unit-tests/lexer/buildfile
index f37c7cf..520d17c 100644
--- a/unit-tests/lexer/buildfile
+++ b/unit-tests/lexer/buildfile
@@ -4,8 +4,6 @@
#@@ Temporary until we get utility library support.
#
-if ($cxx.target.class != "windows")
- cxx.libs += -lpthread
import libs = libbutl%lib{butl}
src = token lexer diagnostics utility variable name b-options types-parsers \
context scope parser target operation rule prerequisite file module function \
@@ -13,7 +11,7 @@ functions-builtin functions-path functions-process-path functions-string \
functions-target-triplet algorithm search dump filesystem scheduler \
config/{utility init operation}
-exe{driver}: cxx{driver} ../../build2/cxx{$src} $libs \
+exe{driver}: cxx{driver} ../../build2/cxx{$src} ../../build2/liba{b} $libs \
test{comment eval quoting}
include ../../build2/
diff --git a/unit-tests/scheduler/buildfile b/unit-tests/scheduler/buildfile
index 056930e..5854c31 100644
--- a/unit-tests/scheduler/buildfile
+++ b/unit-tests/scheduler/buildfile
@@ -4,8 +4,6 @@
#@@ Temporary until we get utility library support.
#
-if ($cxx.target.class != "windows")
- cxx.libs += -lpthread
import libs = libbutl%lib{butl}
src = token lexer diagnostics utility variable name b-options types-parsers \
context scope parser target operation rule prerequisite file module function \
@@ -13,7 +11,6 @@ functions-builtin functions-path functions-process-path functions-string \
functions-target-triplet algorithm search dump filesystem scheduler \
config/{utility init operation}
-
-exe{driver}: cxx{driver} ../../build2/cxx{$src} $libs
+exe{driver}: cxx{driver} ../../build2/cxx{$src} ../../build2/liba{b} $libs
include ../../build2/
diff --git a/unit-tests/test/script/lexer/buildfile b/unit-tests/test/script/lexer/buildfile
index aaeadc9..eb42935 100644
--- a/unit-tests/test/script/lexer/buildfile
+++ b/unit-tests/test/script/lexer/buildfile
@@ -4,8 +4,6 @@
#@@ Temporary until we get utility library support.
#
-if ($cxx.target.class != "windows")
- cxx.libs += -lpthread
import libs = libbutl%lib{butl}
src = token lexer diagnostics utility variable name b-options types-parsers \
context scope parser target operation rule prerequisite file module function \
@@ -13,7 +11,7 @@ functions-builtin functions-path functions-process-path functions-string \
functions-target-triplet algorithm search dump filesystem scheduler \
config/{utility init operation} test/script/{token lexer}
-exe{driver}: cxx{driver} ../../../../build2/cxx{$src} $libs \
+exe{driver}: cxx{driver} ../../../../build2/cxx{$src} ../../../../build2/liba{b} $libs \
test{command-line first-token second-token command-expansion variable-line \
description-line variable}
diff --git a/unit-tests/test/script/parser/buildfile b/unit-tests/test/script/parser/buildfile
index d25d9bf..85668c9 100644
--- a/unit-tests/test/script/parser/buildfile
+++ b/unit-tests/test/script/parser/buildfile
@@ -4,8 +4,6 @@
#@@ Temporary until we get utility library support.
#
-if ($cxx.target.class != "windows")
- cxx.libs += -lpthread
import libs = libbutl%lib{butl}
src = token lexer parser diagnostics utility variable name context target \
scope prerequisite file module operation rule b-options algorithm search \
@@ -14,7 +12,7 @@ functions-string functions-target-triplet config/{utility init operation} \
dump types-parsers test/{target script/{token lexer parser regex script}} \
scheduler
-exe{driver}: cxx{driver} ../../../../build2/cxx{$src} $libs \
+exe{driver}: cxx{driver} ../../../../build2/cxx{$src} ../../../../build2/liba{b} $libs \
test{cleanup command-if command-re-parse description directive exit \
expansion here-document here-string include pipe-expr pre-parse \
redirect regex scope scope-if setup-teardown}
diff --git a/unit-tests/test/script/regex/buildfile b/unit-tests/test/script/regex/buildfile
index 2a01c38..89f1bc5 100644
--- a/unit-tests/test/script/regex/buildfile
+++ b/unit-tests/test/script/regex/buildfile
@@ -7,6 +7,6 @@
import libs = libbutl%lib{butl}
src = test/script/regex
-exe{driver}: cxx{driver} ../../../../build2/cxx{$src} $libs
+exe{driver}: cxx{driver} ../../../../build2/cxx{$src} ../../../../build2/liba{b} $libs
include ../../../../build2/