summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libprint/.gitignore8
-rw-r--r--libprint/build/.gitignore2
-rw-r--r--libprint/build/bootstrap.build2
-rw-r--r--libprint/build/root.build8
-rw-r--r--libprint/buildfile12
-rw-r--r--libprint/libprint/.gitignore3
-rw-r--r--libprint/libprint/buildfile39
-rw-r--r--libprint/libprint/export.hxx18
-rw-r--r--libprint/libprint/print.cxx9
-rw-r--r--libprint/libprint/print.hxx7
-rw-r--r--libprint/libprint/version.hxx.in33
-rw-r--r--libprint/manifest1
-rw-r--r--libprint/tests/.gitignore7
-rw-r--r--libprint/tests/basics/buildfile3
-rw-r--r--libprint/tests/basics/driver.cxx15
-rw-r--r--libprint/tests/build/.gitignore2
-rw-r--r--libprint/tests/build/bootstrap.build4
-rw-r--r--libprint/tests/build/root.build6
-rw-r--r--libprint/tests/buildfile2
-rw-r--r--libprint/tests/test/buildfile4
-rw-r--r--libprint/tests/test/driver.cxx9
-rw-r--r--libprint/tests/test/test.out1
-rw-r--r--repositories.manifest2
23 files changed, 132 insertions, 65 deletions
diff --git a/libprint/.gitignore b/libprint/.gitignore
index abe2889..c3de2e7 100644
--- a/libprint/.gitignore
+++ b/libprint/.gitignore
@@ -1,6 +1,10 @@
+.bdep/
+
# Compiler/linker output.
#
*.d
+*.t
+*.i
*.ii
*.o
*.obj
@@ -9,9 +13,9 @@
*.a
*.lib
*.exp
+*.pdb
+*.ilk
*.exe
*.exe.dlls/
*.exe.manifest
*.pc
-
-version
diff --git a/libprint/build/.gitignore b/libprint/build/.gitignore
index 225c27f..4a730a3 100644
--- a/libprint/build/.gitignore
+++ b/libprint/build/.gitignore
@@ -1 +1,3 @@
config.build
+root/
+bootstrap/
diff --git a/libprint/build/bootstrap.build b/libprint/build/bootstrap.build
index 1941f1a..83dd313 100644
--- a/libprint/build/bootstrap.build
+++ b/libprint/build/bootstrap.build
@@ -2,6 +2,6 @@ project = libprint
using version
using config
-using dist
using test
+using dist
using install
diff --git a/libprint/build/root.build b/libprint/build/root.build
index 8ceadfa..9c83a8a 100644
--- a/libprint/build/root.build
+++ b/libprint/build/root.build
@@ -1,6 +1,12 @@
-cxx.std = 11
+cxx.std = latest
using cxx
hxx{*}: extension = hxx
+ixx{*}: extension = ixx
+txx{*}: extension = txx
cxx{*}: extension = cxx
+
+# The test target for cross-testing (running tests under Wine, etc).
+#
+test.target = $cxx.target
diff --git a/libprint/buildfile b/libprint/buildfile
index ff9f207..d8caddc 100644
--- a/libprint/buildfile
+++ b/libprint/buildfile
@@ -1,13 +1,5 @@
-./: libprint/ tests/ doc{version} file{manifest}
-
-# The version file is auto-generated (by the version module) from manifest.
-# Include it in distribution and don't remove when cleaning in src (so that
-# clean results in a state identical to distributed).
-#
-doc{version}: file{manifest}
-doc{version}: dist = true
-doc{version}: clean = ($src_root != $out_root)
+./: {*/ -build/} file{manifest}
# Don't install tests.
#
-dir{tests/}: install = false
+tests/: install = false
diff --git a/libprint/libprint/.gitignore b/libprint/libprint/.gitignore
new file mode 100644
index 0000000..0c9102a
--- /dev/null
+++ b/libprint/libprint/.gitignore
@@ -0,0 +1,3 @@
+# Generated version header.
+#
+version.hxx
diff --git a/libprint/libprint/buildfile b/libprint/libprint/buildfile
index 710ec62..ce28971 100644
--- a/libprint/libprint/buildfile
+++ b/libprint/libprint/buildfile
@@ -1,4 +1,27 @@
-lib{print}: {hxx cxx}{print} hxx{export}
+int_libs = # Interface dependencies.
+imp_libs = # Implementation dependencies.
+#import imp_libs += libhello%lib{hello}
+
+lib{print}: {hxx ixx txx cxx}{* -version} hxx{version} $imp_libs $int_libs
+
+# Include the generated version header into the distribution (so that we don't
+# pick up an installed one) and don't remove it when cleaning in src (so that
+# clean results in a state identical to distributed).
+#
+hxx{version}: in{version} $src_root/file{manifest}
+hxx{version}: dist = true
+hxx{version}: clean = ($src_root != $out_root)
+
+cxx.poptions =+ "-I$out_root" "-I$src_root"
+lib{print}: cxx.export.poptions = "-I$out_root" "-I$src_root"
+
+liba{print}: cxx.export.poptions += -DLIBPRINT_STATIC
+libs{print}: cxx.export.poptions += -DLIBPRINT_SHARED
+
+obja{*}: cxx.poptions += -DLIBPRINT_STATIC_BUILD
+objs{*}: cxx.poptions += -DLIBPRINT_SHARED_BUILD
+
+lib{print}: cxx.export.libs = $int_libs
# For pre-releases use the complete version to make sure they cannot be used
# in place of another pre-release or the final version.
@@ -8,14 +31,8 @@ if $version.pre_release
else
lib{print}: bin.lib.version = @"-$version.major.$version.minor"
-cxx.poptions =+ "-I$out_root" "-I$src_root"
-obja{*}: cxx.poptions += -DLIBPRINT_STATIC_BUILD
-objs{*}: cxx.poptions += -DLIBPRINT_SHARED_BUILD
-
-lib{print}: cxx.export.poptions = "-I$out_root" "-I$src_root"
-liba{print}: cxx.export.poptions += -DLIBPRINT_STATIC
-libs{print}: cxx.export.poptions += -DLIBPRINT_SHARED
-
-# Install into the libprint/ subdirectory of, say, /usr/include/.
+# Install into the libprint/ subdirectory of, say, /usr/include/
+# recreating subdirectories.
#
-{hxx ixx txx}{*}: install = include/$project/
+{hxx ixx txx}{*}: install = include/$project/
+{hxx ixx txx}{*}: install.subdirs = true
diff --git a/libprint/libprint/export.hxx b/libprint/libprint/export.hxx
index dedfa65..f4b591e 100644
--- a/libprint/libprint/export.hxx
+++ b/libprint/libprint/export.hxx
@@ -1,30 +1,28 @@
-// file: libprint/export.hxx -*- C++ -*-
-
#pragma once
// Normally we don't export class templates (but do complete specializations),
// inline functions, and classes with only inline member functions. Exporting
// classes that inherit from non-exported/imported bases (e.g., std::string)
// will end up badly. The only known workarounds are to not inherit or to not
-// export. Also, MinGW GCC doesn't like seeing non-exported function being
+// export. Also, MinGW GCC doesn't like seeing non-exported functions being
// used before their inline definition. The workaround is to reorder code. In
// the end it's all trial and error.
#if defined(LIBPRINT_STATIC) // Using static.
-# define LIBPRINT_EXPORT
+# define LIBPRINT_SYMEXPORT
#elif defined(LIBPRINT_STATIC_BUILD) // Building static.
-# define LIBPRINT_EXPORT
+# define LIBPRINT_SYMEXPORT
#elif defined(LIBPRINT_SHARED) // Using shared.
# ifdef _WIN32
-# define LIBPRINT_EXPORT __declspec(dllimport)
+# define LIBPRINT_SYMEXPORT __declspec(dllimport)
# else
-# define LIBPRINT_EXPORT
+# define LIBPRINT_SYMEXPORT
# endif
#elif defined(LIBPRINT_SHARED_BUILD) // Building shared.
# ifdef _WIN32
-# define LIBPRINT_EXPORT __declspec(dllexport)
+# define LIBPRINT_SYMEXPORT __declspec(dllexport)
# else
-# define LIBPRINT_EXPORT
+# define LIBPRINT_SYMEXPORT
# endif
#else
// If none of the above macros are defined, then we assume we are being used
@@ -32,5 +30,5 @@
// type. Note that this fallback works for both static and shared but in case
// of shared will be sub-optimal compared to having dllimport.
//
-# define LIBPRINT_EXPORT // Using static or shared.
+# define LIBPRINT_SYMEXPORT // Using static or shared.
#endif
diff --git a/libprint/libprint/print.cxx b/libprint/libprint/print.cxx
index 7ca5b04..954ba27 100644
--- a/libprint/libprint/print.cxx
+++ b/libprint/libprint/print.cxx
@@ -1,16 +1,13 @@
-// file: libprint/libprint.cxx -*- C++ -*-
-
#include <libprint/print.hxx>
-#include <iostream>
+#include <ostream>
using namespace std;
namespace print
{
- void
- to_stdout (const string& s)
+ void print_hello (ostream& o, const string& h)
{
- cout << s << endl;
+ o << h << endl;
}
}
diff --git a/libprint/libprint/print.hxx b/libprint/libprint/print.hxx
index 7788faa..bbe2558 100644
--- a/libprint/libprint/print.hxx
+++ b/libprint/libprint/print.hxx
@@ -1,13 +1,12 @@
-// file: libprint/print.hxx -*- C++ -*-
-
#pragma once
+#include <iosfwd>
#include <string>
#include <libprint/export.hxx>
namespace print
{
- LIBPRINT_EXPORT void
- to_stdout (const std::string&);
+ LIBPRINT_SYMEXPORT void
+ print_hello (std::ostream&, const std::string& hello);
}
diff --git a/libprint/libprint/version.hxx.in b/libprint/libprint/version.hxx.in
new file mode 100644
index 0000000..edff9d9
--- /dev/null
+++ b/libprint/libprint/version.hxx.in
@@ -0,0 +1,33 @@
+#pragma once
+
+// The numeric version format is AAABBBCCCDDDE where:
+//
+// AAA - major version number
+// BBB - minor version number
+// CCC - bugfix version number
+// DDD - alpha / beta (DDD + 500) version number
+// E - final (0) / snapshot (1)
+//
+// When DDDE is not 0, 1 is subtracted from AAABBBCCC. For example:
+//
+// Version AAABBBCCCDDDE
+//
+// 0.1.0 0000010000000
+// 0.1.2 0000010010000
+// 1.2.3 0010020030000
+// 2.2.0-a.1 0020019990010
+// 3.0.0-b.2 0029999995020
+// 2.2.0-a.1.z 0020019990011
+//
+#define LIBPRINT_VERSION $libprint.version.project_number$ULL
+#define LIBPRINT_VERSION_STR "$libprint.version.project$"
+#define LIBPRINT_VERSION_ID "$libprint.version.project_id$"
+
+#define LIBPRINT_VERSION_MAJOR $libprint.version.major$
+#define LIBPRINT_VERSION_MINOR $libprint.version.minor$
+#define LIBPRINT_VERSION_PATCH $libprint.version.patch$
+
+#define LIBPRINT_PRE_RELEASE $libprint.version.pre_release$
+
+#define LIBPRINT_SNAPSHOT_SN $libprint.version.snapshot_sn$ULL
+#define LIBPRINT_SNAPSHOT_ID "$libprint.version.snapshot_id$"
diff --git a/libprint/manifest b/libprint/manifest
index 5e95a0a..2aeba52 100644
--- a/libprint/manifest
+++ b/libprint/manifest
@@ -11,6 +11,5 @@ url: http://www.example.org/libprint
src-url: https://git.build2.org/cgit/hello/libprint/tree/libprint
email: hello-users@example.org
build-email: builds@build2.org
-requires: c++11
depends: * build2 >= 0.7.0-
depends: * bpkg >= 0.7.0-
diff --git a/libprint/tests/.gitignore b/libprint/tests/.gitignore
index e54525b..662178d 100644
--- a/libprint/tests/.gitignore
+++ b/libprint/tests/.gitignore
@@ -1 +1,8 @@
+# Test executables.
+#
driver
+
+# Testscript output directories (can be symlinks).
+#
+test
+test-*
diff --git a/libprint/tests/basics/buildfile b/libprint/tests/basics/buildfile
new file mode 100644
index 0000000..337d9fa
--- /dev/null
+++ b/libprint/tests/basics/buildfile
@@ -0,0 +1,3 @@
+import libs = libprint%lib{print}
+
+exe{driver}: {hxx ixx txx cxx}{*} $libs
diff --git a/libprint/tests/basics/driver.cxx b/libprint/tests/basics/driver.cxx
new file mode 100644
index 0000000..8252785
--- /dev/null
+++ b/libprint/tests/basics/driver.cxx
@@ -0,0 +1,15 @@
+#include <cassert>
+#include <sstream>
+
+#include <libprint/version.hxx>
+#include <libprint/print.hxx>
+
+using namespace std;
+using namespace print;
+
+int main ()
+{
+ ostringstream o;
+ print_hello (o, "Hello, World!");
+ assert (o.str () == "Hello, World!\n");
+}
diff --git a/libprint/tests/build/.gitignore b/libprint/tests/build/.gitignore
index 225c27f..4a730a3 100644
--- a/libprint/tests/build/.gitignore
+++ b/libprint/tests/build/.gitignore
@@ -1 +1,3 @@
config.build
+root/
+bootstrap/
diff --git a/libprint/tests/build/bootstrap.build b/libprint/tests/build/bootstrap.build
index 2c2de24..a07b5ea 100644
--- a/libprint/tests/build/bootstrap.build
+++ b/libprint/tests/build/bootstrap.build
@@ -1,5 +1,5 @@
-project = # Unnamed subproject.
+project = # Unnamed tests subproject.
using config
-using dist
using test
+using dist
diff --git a/libprint/tests/build/root.build b/libprint/tests/build/root.build
index a2ee38a..a67b2fe 100644
--- a/libprint/tests/build/root.build
+++ b/libprint/tests/build/root.build
@@ -1,14 +1,16 @@
-cxx.std = 11
+cxx.std = latest
using cxx
hxx{*}: extension = hxx
+ixx{*}: extension = ixx
+txx{*}: extension = txx
cxx{*}: extension = cxx
# Every exe{} in this subproject is by default a test.
#
exe{*}: test = true
-# Specify the test target for cross-testing.
+# The test target for cross-testing (running tests under Wine, etc).
#
test.target = $cxx.target
diff --git a/libprint/tests/buildfile b/libprint/tests/buildfile
index 1a8bcc9..aeeab15 100644
--- a/libprint/tests/buildfile
+++ b/libprint/tests/buildfile
@@ -1 +1 @@
-./: test/
+./: {*/ -build/}
diff --git a/libprint/tests/test/buildfile b/libprint/tests/test/buildfile
deleted file mode 100644
index ab17ea9..0000000
--- a/libprint/tests/test/buildfile
+++ /dev/null
@@ -1,4 +0,0 @@
-import libs = libprint%lib{print}
-
-exe{driver}: cxx{driver} $libs
-exe{driver}: file{test.out}: test.stdout = true
diff --git a/libprint/tests/test/driver.cxx b/libprint/tests/test/driver.cxx
deleted file mode 100644
index 9b69a90..0000000
--- a/libprint/tests/test/driver.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-// file: tests/test/driver.cxx -*- C++ -*-
-
-#include <libprint/print.hxx>
-
-int
-main ()
-{
- print::to_stdout ("Hello, World!");
-}
diff --git a/libprint/tests/test/test.out b/libprint/tests/test/test.out
deleted file mode 100644
index 8ab686e..0000000
--- a/libprint/tests/test/test.out
+++ /dev/null
@@ -1 +0,0 @@
-Hello, World!
diff --git a/repositories.manifest b/repositories.manifest
new file mode 100644
index 0000000..8b1b142
--- /dev/null
+++ b/repositories.manifest
@@ -0,0 +1,2 @@
+: 1
+summary: libprint project repository