From 13e9e236ec3e0cd30bc26223430c8ff55026c08b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 4 May 2018 15:34:34 +0200 Subject: Regenerate libprint using bdep-new --- libprint/libprint/.gitignore | 3 +++ libprint/libprint/buildfile | 39 ++++++++++++++++++++++++++++----------- libprint/libprint/export.hxx | 18 ++++++++---------- libprint/libprint/print.cxx | 9 +++------ libprint/libprint/print.hxx | 7 +++---- libprint/libprint/version.hxx.in | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 78 insertions(+), 31 deletions(-) create mode 100644 libprint/libprint/.gitignore create mode 100644 libprint/libprint/version.hxx.in (limited to 'libprint/libprint') 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 -#include +#include 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 #include #include 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$" -- cgit v1.1