summaryrefslogtreecommitdiff
path: root/libformat/libformat
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-05-04 15:35:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-05-04 15:35:08 +0200
commit8728018f93a73b08a68ab1cea502a5f6b4a2a79e (patch)
tree9e70e77ce7d1c31cce8f1b29103e2dfdb7583603 /libformat/libformat
parentf26b449f825c0641328597b48cacf0d827a63147 (diff)
Regenerate libformat using bdep-new
Diffstat (limited to 'libformat/libformat')
-rw-r--r--libformat/libformat/.gitignore3
-rw-r--r--libformat/libformat/buildfile39
-rw-r--r--libformat/libformat/export.hxx18
-rw-r--r--libformat/libformat/format.cxx4
-rw-r--r--libformat/libformat/format.hxx6
-rw-r--r--libformat/libformat/version.hxx.in33
6 files changed, 75 insertions, 28 deletions
diff --git a/libformat/libformat/.gitignore b/libformat/libformat/.gitignore
new file mode 100644
index 0000000..0c9102a
--- /dev/null
+++ b/libformat/libformat/.gitignore
@@ -0,0 +1,3 @@
+# Generated version header.
+#
+version.hxx
diff --git a/libformat/libformat/buildfile b/libformat/libformat/buildfile
index fc342d4..96f7133 100644
--- a/libformat/libformat/buildfile
+++ b/libformat/libformat/buildfile
@@ -1,4 +1,27 @@
-lib{format}: {hxx cxx}{format} hxx{export}
+int_libs = # Interface dependencies.
+imp_libs = # Implementation dependencies.
+#import imp_libs += libhello%lib{hello}
+
+lib{format}: {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{format}: cxx.export.poptions = "-I$out_root" "-I$src_root"
+
+liba{format}: cxx.export.poptions += -DLIBFORMAT_STATIC
+libs{format}: cxx.export.poptions += -DLIBFORMAT_SHARED
+
+obja{*}: cxx.poptions += -DLIBFORMAT_STATIC_BUILD
+objs{*}: cxx.poptions += -DLIBFORMAT_SHARED_BUILD
+
+lib{format}: 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{format}: bin.lib.version = @"-$version.major.$version.minor"
-cxx.poptions =+ "-I$out_root" "-I$src_root"
-obja{*}: cxx.poptions += -DLIBFORMAT_STATIC_BUILD
-objs{*}: cxx.poptions += -DLIBFORMAT_SHARED_BUILD
-
-lib{format}: cxx.export.poptions = "-I$out_root" "-I$src_root"
-liba{format}: cxx.export.poptions += -DLIBFORMAT_STATIC
-libs{format}: cxx.export.poptions += -DLIBFORMAT_SHARED
-
-# Install into the libformat/ subdirectory of, say, /usr/include/.
+# Install into the libformat/ 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/libformat/libformat/export.hxx b/libformat/libformat/export.hxx
index 125c9df..1691181 100644
--- a/libformat/libformat/export.hxx
+++ b/libformat/libformat/export.hxx
@@ -1,30 +1,28 @@
-// file: libformat/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(LIBFORMAT_STATIC) // Using static.
-# define LIBFORMAT_EXPORT
+# define LIBFORMAT_SYMEXPORT
#elif defined(LIBFORMAT_STATIC_BUILD) // Building static.
-# define LIBFORMAT_EXPORT
+# define LIBFORMAT_SYMEXPORT
#elif defined(LIBFORMAT_SHARED) // Using shared.
# ifdef _WIN32
-# define LIBFORMAT_EXPORT __declspec(dllimport)
+# define LIBFORMAT_SYMEXPORT __declspec(dllimport)
# else
-# define LIBFORMAT_EXPORT
+# define LIBFORMAT_SYMEXPORT
# endif
#elif defined(LIBFORMAT_SHARED_BUILD) // Building shared.
# ifdef _WIN32
-# define LIBFORMAT_EXPORT __declspec(dllexport)
+# define LIBFORMAT_SYMEXPORT __declspec(dllexport)
# else
-# define LIBFORMAT_EXPORT
+# define LIBFORMAT_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 LIBFORMAT_EXPORT // Using static or shared.
+# define LIBFORMAT_SYMEXPORT // Using static or shared.
#endif
diff --git a/libformat/libformat/format.cxx b/libformat/libformat/format.cxx
index 493f13c..de8a782 100644
--- a/libformat/libformat/format.cxx
+++ b/libformat/libformat/format.cxx
@@ -1,5 +1,3 @@
-// file: libformat/format.cxx -*- C++ -*-
-
#include <libformat/format.hxx>
#include <cctype> // to{upper,lower}()
@@ -10,7 +8,7 @@ using namespace std;
namespace format
{
string
- message (const string& g, const string& n, volume v)
+ format_hello (const string& g, const string& n, volume v)
{
string r (g);
diff --git a/libformat/libformat/format.hxx b/libformat/libformat/format.hxx
index c711c16..3641b67 100644
--- a/libformat/libformat/format.hxx
+++ b/libformat/libformat/format.hxx
@@ -1,5 +1,3 @@
-// file: libformat/format.hxx -*- C++ -*-
-
#pragma once
#include <string>
@@ -10,6 +8,6 @@ namespace format
{
enum class volume {quiet, normal, loud};
- LIBFORMAT_EXPORT std::string
- message (const std::string& greeting, const std::string& name, volume);
+ LIBFORMAT_SYMEXPORT std::string
+ format_hello (const std::string& greeting, const std::string& name, volume);
}
diff --git a/libformat/libformat/version.hxx.in b/libformat/libformat/version.hxx.in
new file mode 100644
index 0000000..eee04b1
--- /dev/null
+++ b/libformat/libformat/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 LIBFORMAT_VERSION $libformat.version.project_number$ULL
+#define LIBFORMAT_VERSION_STR "$libformat.version.project$"
+#define LIBFORMAT_VERSION_ID "$libformat.version.project_id$"
+
+#define LIBFORMAT_VERSION_MAJOR $libformat.version.major$
+#define LIBFORMAT_VERSION_MINOR $libformat.version.minor$
+#define LIBFORMAT_VERSION_PATCH $libformat.version.patch$
+
+#define LIBFORMAT_PRE_RELEASE $libformat.version.pre_release$
+
+#define LIBFORMAT_SNAPSHOT_SN $libformat.version.snapshot_sn$ULL
+#define LIBFORMAT_SNAPSHOT_ID "$libformat.version.snapshot_id$"