From 4429bd6724a4668464e8a7920e3c77860b127678 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 4 May 2018 16:16:41 +0200 Subject: Regenerate libhello using bdep-new --- libhello/libhello/.gitignore | 3 +++ libhello/libhello/buildfile | 39 +++++++++++++++++++++++++-------------- libhello/libhello/export.hxx | 18 ++++++++---------- libhello/libhello/hello.cxx | 6 ++---- libhello/libhello/hello.hxx | 22 ++++++++++++---------- libhello/libhello/version.hxx.in | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 83 insertions(+), 38 deletions(-) create mode 100644 libhello/libhello/.gitignore create mode 100644 libhello/libhello/version.hxx.in (limited to 'libhello/libhello') diff --git a/libhello/libhello/.gitignore b/libhello/libhello/.gitignore new file mode 100644 index 0000000..0c9102a --- /dev/null +++ b/libhello/libhello/.gitignore @@ -0,0 +1,3 @@ +# Generated version header. +# +version.hxx diff --git a/libhello/libhello/buildfile b/libhello/libhello/buildfile index 4b3ab81..4322117 100644 --- a/libhello/libhello/buildfile +++ b/libhello/libhello/buildfile @@ -1,26 +1,37 @@ -import int_libs = libformat%lib{format} -import imp_libs = libprint%lib{print} +import int_libs = libformat%lib{format} # Interface dependency. +import imp_libs = libprint%lib{print} # Implementation dependency. -lib{hello}: {hxx cxx}{hello} hxx{export} $imp_libs $int_libs +lib{hello}: {hxx ixx txx cxx}{* -version} hxx{version} $imp_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. +# 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). # -if $version.pre_release - lib{hello}: bin.lib.version = @"-$version.project_id" -else - lib{hello}: bin.lib.version = @"-$version.major.$version.minor" +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" -obja{*}: cxx.poptions += -DLIBHELLO_STATIC_BUILD -objs{*}: cxx.poptions += -DLIBHELLO_SHARED_BUILD - lib{hello}: cxx.export.poptions = "-I$out_root" "-I$src_root" + liba{hello}: cxx.export.poptions += -DLIBHELLO_STATIC libs{hello}: cxx.export.poptions += -DLIBHELLO_SHARED +obja{*}: cxx.poptions += -DLIBHELLO_STATIC_BUILD +objs{*}: cxx.poptions += -DLIBHELLO_SHARED_BUILD + lib{hello}: cxx.export.libs = $int_libs -# Install into the libhello/ subdirectory of, say, /usr/include/. +# For pre-releases use the complete version to make sure they cannot be used +# in place of another pre-release or the final version. +# +if $version.pre_release + lib{hello}: bin.lib.version = @"-$version.project_id" +else + lib{hello}: bin.lib.version = @"-$version.major.$version.minor" + +# Install into the libhello/ 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/libhello/libhello/export.hxx b/libhello/libhello/export.hxx index e6c723e..576543d 100644 --- a/libhello/libhello/export.hxx +++ b/libhello/libhello/export.hxx @@ -1,30 +1,28 @@ -// file: libhello/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(LIBHELLO_STATIC) // Using static. -# define LIBHELLO_EXPORT +# define LIBHELLO_SYMEXPORT #elif defined(LIBHELLO_STATIC_BUILD) // Building static. -# define LIBHELLO_EXPORT +# define LIBHELLO_SYMEXPORT #elif defined(LIBHELLO_SHARED) // Using shared. # ifdef _WIN32 -# define LIBHELLO_EXPORT __declspec(dllimport) +# define LIBHELLO_SYMEXPORT __declspec(dllimport) # else -# define LIBHELLO_EXPORT +# define LIBHELLO_SYMEXPORT # endif #elif defined(LIBHELLO_SHARED_BUILD) // Building shared. # ifdef _WIN32 -# define LIBHELLO_EXPORT __declspec(dllexport) +# define LIBHELLO_SYMEXPORT __declspec(dllexport) # else -# define LIBHELLO_EXPORT +# define LIBHELLO_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 LIBHELLO_EXPORT // Using static or shared. +# define LIBHELLO_SYMEXPORT // Using static or shared. #endif diff --git a/libhello/libhello/hello.cxx b/libhello/libhello/hello.cxx index ee5c555..f9e60bd 100644 --- a/libhello/libhello/hello.cxx +++ b/libhello/libhello/hello.cxx @@ -1,5 +1,3 @@ -// file: libhello/hello.cxx -*- C++ -*- - #include #include @@ -9,8 +7,8 @@ using namespace std; namespace hello { void - say_formatted (const string& m) + say_hello_formatted (ostream& o, const string& h) { - print::to_stdout (m); + print::print_hello (o, h); } } diff --git a/libhello/libhello/hello.hxx b/libhello/libhello/hello.hxx index d9e41d9..f0fc49e 100644 --- a/libhello/libhello/hello.hxx +++ b/libhello/libhello/hello.hxx @@ -1,7 +1,6 @@ -// file: libhello/hello.hxx -*- C++ -*- - #pragma once +#include #include #include @@ -12,18 +11,21 @@ namespace hello { // If you compare this interface to version 1.0, then you will notice that // while it is API/source-compatible (the call via the old signature of - // say() is still valid) it is not ABI/binary-compatible (say() now has an - // extra argument and is inline). + // say_hello() is still valid) it is not ABI/binary-compatible (say_hello() + // now has an extra argument and is inline). // - // Notice also that inline say() now uses a type and calls a function from - // format which means libformat is an "interface dependency" of libhello. + // Notice also that say_hello() now uses a type and calls (from its inline + // implementation) a function from format which means libformat is an + // "interface dependency" of libhello. - LIBHELLO_EXPORT void - say_formatted (const std::string& message); + LIBHELLO_SYMEXPORT void + say_hello_formatted (std::ostream&, const std::string& hello); inline void - say (const std::string& name, format::volume v = format::volume::normal) + say_hello (std::ostream& o, + const std::string& name, + format::volume v = format::volume::normal) { - say_formatted (format::message ("Hello", name, v)); + say_hello_formatted (o, format::format_hello ("Hello", name, v)); } } diff --git a/libhello/libhello/version.hxx.in b/libhello/libhello/version.hxx.in new file mode 100644 index 0000000..b94c05a --- /dev/null +++ b/libhello/libhello/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 LIBHELLO_VERSION $libhello.version.project_number$ULL +#define LIBHELLO_VERSION_STR "$libhello.version.project$" +#define LIBHELLO_VERSION_ID "$libhello.version.project_id$" + +#define LIBHELLO_VERSION_MAJOR $libhello.version.major$ +#define LIBHELLO_VERSION_MINOR $libhello.version.minor$ +#define LIBHELLO_VERSION_PATCH $libhello.version.patch$ + +#define LIBHELLO_PRE_RELEASE $libhello.version.pre_release$ + +#define LIBHELLO_SNAPSHOT_SN $libhello.version.snapshot_sn$ULL +#define LIBHELLO_SNAPSHOT_ID "$libhello.version.snapshot_id$" -- cgit v1.1