From 2364f5cb43fa7c14f95304c432b6e215e158c224 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 18 Feb 2019 13:02:02 +0200 Subject: Add support for building with build2 --- odb/boost/buildfile | 81 +++++++++++++++++++++++++++++++ odb/boost/details/build2/config-stub.h | 6 +++ odb/boost/details/build2/config-vc-stub.h | 6 +++ odb/boost/details/build2/config-vc.h | 16 ++++++ odb/boost/details/build2/config.h | 18 +++++++ odb/boost/details/config-vc.h | 6 +++ odb/boost/details/config.hxx | 11 +++-- odb/boost/details/export.hxx | 39 +++++++++++++++ odb/boost/makefile | 2 +- odb/boost/version-build2-stub.hxx | 5 ++ odb/boost/version-build2.hxx | 0 odb/boost/version-build2.hxx.in | 44 +++++++++++++++++ odb/boost/version.hxx | 11 +++++ 13 files changed, 240 insertions(+), 5 deletions(-) create mode 100644 odb/boost/buildfile create mode 100644 odb/boost/details/build2/config-stub.h create mode 100644 odb/boost/details/build2/config-vc-stub.h create mode 100644 odb/boost/details/build2/config-vc.h create mode 100644 odb/boost/details/build2/config.h create mode 100644 odb/boost/details/config-vc.h create mode 100644 odb/boost/version-build2-stub.hxx create mode 100644 odb/boost/version-build2.hxx create mode 100644 odb/boost/version-build2.hxx.in (limited to 'odb/boost') diff --git a/odb/boost/buildfile b/odb/boost/buildfile new file mode 100644 index 0000000..c33b743 --- /dev/null +++ b/odb/boost/buildfile @@ -0,0 +1,81 @@ +# file : odb/boost/buildfile +# copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +../ +{ + define options: file + options{*}: extension = options + + # Install into the odb/boost/ subdirectory of, say, /usr/include/ recreating + # subdirectories. + # + {hxx ixx txx options}{*}: install = include/odb/ + {hxx ixx txx options}{*}: install.subdirs = true + + boost/ + { + import int_libs = libodb%lib{odb} + imp_libs = + + lib{odb-boost}: {hxx ixx txx cxx}{** -version-build2} {hxx}{version-build2} \ + details/build2/{h}{*} \ + options{**} ../options{boost} \ + $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-build2}: in{version-build2} $src_root/manifest + hxx{version-build2}: dist = true + hxx{version-build2}: clean = ($src_root != $out_root) + + # 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{odb-boost}: bin.lib.version = @"-$version.project_id" + else + lib{odb-boost}: bin.lib.version = @"-$version.major.$version.minor" + + cxx.poptions =+ "-I$out_root" "-I$src_root" -DLIBODB_BOOST_BUILD2 + obja{*}: cxx.poptions += -DLIBODB_BOOST_STATIC_BUILD + objs{*}: cxx.poptions += -DLIBODB_BOOST_SHARED_BUILD + + lib{odb-boost}: cxx.export.poptions = "-I$out_root" "-I$src_root" \ + -DLIBODB_BOOST_BUILD2 + + liba{odb-boost}: cxx.export.poptions += -DLIBODB_BOOST_STATIC + libs{odb-boost}: cxx.export.poptions += -DLIBODB_BOOST_SHARED + + lib{odb-boost}: cxx.export.libs = $int_libs + + # Installation tweaks. + # + install_include = [dir_path] include/odb/boost/ + + # We want these to be picked up whether LIBODB_BOOST_BUILD2 is defined or + # not. + # + hxx{version}@./: install = false + hxx{version-build2}: install = $install_include/version.hxx + hxx{version-build2-stub}@./: install = $install_include/version-build2.hxx + + details/build2/ + { + h{*}: install = false + + if ($cxx.class == 'msvc') + { + h{config-vc}@./: install = $install_include/details/ + h{config-vc-stub}@./: install = $install_include/details/build2/config-vc.h + } + else + { + h{config}@./: install = $install_include/details/ + h{config-stub}@./: install = $install_include/details/build2/config.h + } + } + } +} diff --git a/odb/boost/details/build2/config-stub.h b/odb/boost/details/build2/config-stub.h new file mode 100644 index 0000000..0b03d9b --- /dev/null +++ b/odb/boost/details/build2/config-stub.h @@ -0,0 +1,6 @@ +/* file : odb/boost/details/build2/config-stub.h + * copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC + * license : GNU GPL v2; see accompanying LICENSE file + */ + +#include diff --git a/odb/boost/details/build2/config-vc-stub.h b/odb/boost/details/build2/config-vc-stub.h new file mode 100644 index 0000000..541cfba --- /dev/null +++ b/odb/boost/details/build2/config-vc-stub.h @@ -0,0 +1,6 @@ +/* file : odb/boost/details/build2/config-vc-stub.h + * copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC + * license : GNU GPL v2; see accompanying LICENSE file + */ + +#include diff --git a/odb/boost/details/build2/config-vc.h b/odb/boost/details/build2/config-vc.h new file mode 100644 index 0000000..568c517 --- /dev/null +++ b/odb/boost/details/build2/config-vc.h @@ -0,0 +1,16 @@ +/* file : odb/boost/details/build2/config-vc.h + * copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC + * license : GNU GPL v2; see accompanying LICENSE file + */ + +/* Configuration file for Windows/VC++ for the build2 build. */ + +#ifndef ODB_BOOST_DETAILS_CONFIG_VC_H +#define ODB_BOOST_DETAILS_CONFIG_VC_H + +/* Define LIBODB_BOOST_BUILD2 for the installed case. */ +#ifndef LIBODB_BOOST_BUILD2 +# define LIBODB_BOOST_BUILD2 +#endif + +#endif /* ODB_BOOST_DETAILS_CONFIG_VC_H */ diff --git a/odb/boost/details/build2/config.h b/odb/boost/details/build2/config.h new file mode 100644 index 0000000..7de8128 --- /dev/null +++ b/odb/boost/details/build2/config.h @@ -0,0 +1,18 @@ +/* file : odb/boost/details/build2/config.h + * copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC + * license : GNU GPL v2; see accompanying LICENSE file + */ + +/* Static configuration file for the build2 build. The installed case + (when LIBODB_BOOST_BUILD2 is not necessarily defined) is the only + reason we have it. */ + +#ifndef ODB_BOOST_DETAILS_CONFIG_H +#define ODB_BOOST_DETAILS_CONFIG_H + +/* Define LIBODB_BOOST_BUILD2 for the installed case. */ +#ifndef LIBODB_BOOST_BUILD2 +# define LIBODB_BOOST_BUILD2 +#endif + +#endif /* ODB_BOOST_DETAILS_CONFIG_H */ diff --git a/odb/boost/details/config-vc.h b/odb/boost/details/config-vc.h new file mode 100644 index 0000000..4212314 --- /dev/null +++ b/odb/boost/details/config-vc.h @@ -0,0 +1,6 @@ +/* file : odb/boost/details/config-vc.h + * copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC + * license : GNU GPL v2; see accompanying LICENSE file + */ + +/* Dummy configuration file for Windows/VC++. */ diff --git a/odb/boost/details/config.hxx b/odb/boost/details/config.hxx index bc9db32..a637f44 100644 --- a/odb/boost/details/config.hxx +++ b/odb/boost/details/config.hxx @@ -7,11 +7,14 @@ // no pre -#ifdef _MSC_VER -#elif defined(ODB_COMPILER) +#ifdef ODB_COMPILER # define LIBODB_BOOST_STATIC_LIB -#else -# include +#elif !defined(LIBODB_BOOST_BUILD2) +# ifdef _MSC_VER +# include +# else +# include +# endif #endif // no post diff --git a/odb/boost/details/export.hxx b/odb/boost/details/export.hxx index b5d4282..9b96a30 100644 --- a/odb/boost/details/export.hxx +++ b/odb/boost/details/export.hxx @@ -9,6 +9,43 @@ #include +// 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 +// used before their inline definition. The workaround is to reorder code. In +// the end it's all trial and error. + +#ifdef LIBODB_BOOST_BUILD2 + +#if defined(LIBODB_BOOST_STATIC) // Using static. +# define LIBODB_BOOST_EXPORT +#elif defined(LIBODB_BOOST_STATIC_BUILD) // Building static. +# define LIBODB_BOOST_EXPORT +#elif defined(LIBODB_BOOST_SHARED) // Using shared. +# ifdef _WIN32 +# define LIBODB_BOOST_EXPORT __declspec(dllimport) +# else +# define LIBODB_BOOST_EXPORT +# endif +#elif defined(LIBODB_BOOST_SHARED_BUILD) // Building shared. +# ifdef _WIN32 +# define LIBODB_BOOST_EXPORT __declspec(dllexport) +# else +# define LIBODB_BOOST_EXPORT +# endif +#else +// If none of the above macros are defined, then we assume we are being used +// by some third-party build system that cannot/doesn't signal the library +// 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 LIBODB_BOOST_EXPORT // Using static or shared. +#endif + +#else // LIBODB_BOOST_BUILD2 + #ifdef LIBODB_BOOST_STATIC_LIB # define LIBODB_BOOST_EXPORT #else @@ -35,6 +72,8 @@ # endif #endif +#endif // LIBODB_BOOST_BUILD2 + #include #endif // ODB_BOOST_DETAILS_EXPORT_HXX diff --git a/odb/boost/makefile b/odb/boost/makefile index de96ae6..f6f7227 100644 --- a/odb/boost/makefile +++ b/odb/boost/makefile @@ -63,7 +63,7 @@ $(dist): export interface_version = $(shell sed -e \ 's/^\([0-9]*\.[0-9]*\).*/\1/' $(src_root)/version) $(dist): - $(call dist-data,$(sources) $(headers) $(options) details/config.h.in) + $(call dist-data,$(sources) $(headers) $(options) details/config.h.in details/config-vc.h) $(call meta-vc8proj,$(src_base)/libodb-boost-vc8.vcproj) $(call meta-vc9proj,$(src_base)/libodb-boost-vc9.vcproj) $(call meta-vc10proj,$(src_base)/libodb-boost-vc10.vcxproj) diff --git a/odb/boost/version-build2-stub.hxx b/odb/boost/version-build2-stub.hxx new file mode 100644 index 0000000..ee73abc --- /dev/null +++ b/odb/boost/version-build2-stub.hxx @@ -0,0 +1,5 @@ +// file : odb/boost/version-build2-stub.hxx +// copyright : Copyright (c) 2005-2019 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#include diff --git a/odb/boost/version-build2.hxx b/odb/boost/version-build2.hxx new file mode 100644 index 0000000..e69de29 diff --git a/odb/boost/version-build2.hxx.in b/odb/boost/version-build2.hxx.in new file mode 100644 index 0000000..de844f9 --- /dev/null +++ b/odb/boost/version-build2.hxx.in @@ -0,0 +1,44 @@ +// file : odb/boost/version-build2.hxx.in +// copyright : Copyright (c) 2005-2019 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef LIBODB_BOOST_VERSION // Note: using the version macro itself. + +// Note: using build2 standard versioning scheme. 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 LIBODB_BOOST_VERSION $libodb_boost.version.project_number$ULL +#define LIBODB_BOOST_VERSION_STR "$libodb_boost.version.project$" +#define LIBODB_BOOST_VERSION_ID "$libodb_boost.version.project_id$" + +#define LIBODB_BOOST_VERSION_MAJOR $libodb_boost.version.major$ +#define LIBODB_BOOST_VERSION_MINOR $libodb_boost.version.minor$ +#define LIBODB_BOOST_VERSION_PATCH $libodb_boost.version.patch$ + +#define LIBODB_BOOST_PRE_RELEASE $libodb_boost.version.pre_release$ + +#define LIBODB_BOOST_SNAPSHOT $libodb_boost.version.snapshot_sn$ULL +#define LIBODB_BOOST_SNAPSHOT_ID "$libodb_boost.version.snapshot_id$" + +#include + +$libodb.check(LIBODB_VERSION, LIBODB_SNAPSHOT)$ + +#endif // LIBODB_BOOST_VERSION diff --git a/odb/boost/version.hxx b/odb/boost/version.hxx index 648fb44..988fae7 100644 --- a/odb/boost/version.hxx +++ b/odb/boost/version.hxx @@ -2,6 +2,16 @@ // copyright : Copyright (c) 2005-2019 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file +#ifdef LIBODB_BOOST_BUILD2 +# include + +// @@ TODO: need to derive automatically (it is also hardcoded in *.options). +// +#define ODB_BOOST_VERSION 2046000 +#define ODB_BOOST_VERSION_STR "2.5.0-b.10" + +#else + #ifndef ODB_BOOST_VERSION_HXX #define ODB_BOOST_VERSION_HXX @@ -49,3 +59,4 @@ #include #endif // ODB_BOOST_VERSION_HXX +#endif // LIBODB_BOOST_BUILD2 -- cgit v1.1