diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-11-27 23:59:42 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-11-29 17:11:38 +0300 |
commit | 6586a59e63d089f38503656949d7aa8734ca8924 (patch) | |
tree | 5733850890635be94a18626b8acc710f89e63b01 /odb/mysql/details | |
parent | 619d3ff17c0d2c7eb910285792329491f5438268 (diff) |
Add support for build2 build
Diffstat (limited to 'odb/mysql/details')
-rw-r--r-- | odb/mysql/details/build2/config-stub.h | 6 | ||||
-rw-r--r-- | odb/mysql/details/build2/config-vc-stub.h | 6 | ||||
-rw-r--r-- | odb/mysql/details/build2/config-vc.h | 16 | ||||
-rw-r--r-- | odb/mysql/details/build2/config.h | 18 | ||||
-rw-r--r-- | odb/mysql/details/config-vc.h | 13 | ||||
-rw-r--r-- | odb/mysql/details/config.hxx | 25 | ||||
-rw-r--r-- | odb/mysql/details/export.hxx | 39 |
7 files changed, 116 insertions, 7 deletions
diff --git a/odb/mysql/details/build2/config-stub.h b/odb/mysql/details/build2/config-stub.h new file mode 100644 index 0000000..1ea3607 --- /dev/null +++ b/odb/mysql/details/build2/config-stub.h @@ -0,0 +1,6 @@ +/* file : odb/mysql/details/build2/config-stub.h + * copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC + * license : GNU GPL v2; see accompanying LICENSE file + */ + +#include <odb/mysql/details/config.h> diff --git a/odb/mysql/details/build2/config-vc-stub.h b/odb/mysql/details/build2/config-vc-stub.h new file mode 100644 index 0000000..f6f1e21 --- /dev/null +++ b/odb/mysql/details/build2/config-vc-stub.h @@ -0,0 +1,6 @@ +/* file : odb/mysql/details/build2/config-vc-stub.h + * copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC + * license : GNU GPL v2; see accompanying LICENSE file + */ + +#include <odb/mysql/details/config-vc.h> diff --git a/odb/mysql/details/build2/config-vc.h b/odb/mysql/details/build2/config-vc.h new file mode 100644 index 0000000..bf6f84e --- /dev/null +++ b/odb/mysql/details/build2/config-vc.h @@ -0,0 +1,16 @@ +/* file : odb/mysql/details/build2/config-vc.h + * copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC + * license : GNU GPL v2; see accompanying LICENSE file + */ + +/* Configuration file for Windows/VC++ for the build2 build. */ + +#ifndef ODB_MYSQL_DETAILS_CONFIG_VC_H +#define ODB_MYSQL_DETAILS_CONFIG_VC_H + +/* Define LIBODB_MYSQL_BUILD2 for the installed case. */ +#ifndef LIBODB_MYSQL_BUILD2 +# define LIBODB_MYSQL_BUILD2 +#endif + +#endif /* ODB_MYSQL_DETAILS_CONFIG_VC_H */ diff --git a/odb/mysql/details/build2/config.h b/odb/mysql/details/build2/config.h new file mode 100644 index 0000000..c88e476 --- /dev/null +++ b/odb/mysql/details/build2/config.h @@ -0,0 +1,18 @@ +/* file : odb/mysql/details/build2/config.h + * copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC + * license : GNU GPL v2; see accompanying LICENSE file + */ + +/* Static configuration file for the build2 build. The installed case + (when LIBODB_MYSQL_BUILD2 is not necessarily defined) is the only + reason we have it. */ + +#ifndef ODB_MYSQL_DETAILS_CONFIG_H +#define ODB_MYSQL_DETAILS_CONFIG_H + +/* Define LIBODB_MYSQL_BUILD2 for the installed case. */ +#ifndef LIBODB_MYSQL_BUILD2 +# define LIBODB_MYSQL_BUILD2 +#endif + +#endif /* ODB_MYSQL_DETAILS_CONFIG_H */ diff --git a/odb/mysql/details/config-vc.h b/odb/mysql/details/config-vc.h new file mode 100644 index 0000000..c480f67 --- /dev/null +++ b/odb/mysql/details/config-vc.h @@ -0,0 +1,13 @@ +/* file : odb/mysql/details/config-vc.h + * copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC + * license : GNU GPL v2; see accompanying LICENSE file + */ + +#ifndef ODB_MYSQL_DETAILS_CONFIG_VC_H +#define ODB_MYSQL_DETAILS_CONFIG_VC_H + +#if !defined(LIBODB_MYSQL_INCLUDE_SHORT) && !defined (LIBODB_MYSQL_INCLUDE_LONG) +# define LIBODB_MYSQL_INCLUDE_SHORT 1 +#endif + +#endif /* ODB_MYSQL_DETAILS_CONFIG_VC_H */ diff --git a/odb/mysql/details/config.hxx b/odb/mysql/details/config.hxx index d29e9a5..f05044c 100644 --- a/odb/mysql/details/config.hxx +++ b/odb/mysql/details/config.hxx @@ -7,14 +7,25 @@ // no pre -#ifdef _MSC_VER -# if !defined(LIBODB_MYSQL_INCLUDE_SHORT) && !defined (LIBODB_MYSQL_INCLUDE_LONG) -# define LIBODB_MYSQL_INCLUDE_SHORT 1 -# endif -#elif defined(ODB_COMPILER) +#ifdef ODB_COMPILER # error libodb-mysql header included in odb-compiled header -#else -# include <odb/mysql/details/config.h> +#elif !defined(LIBODB_MYSQL_BUILD2) +# ifdef _MSC_VER +# include <odb/mysql/details/config-vc.h> +# else +# include <odb/mysql/details/config.h> +# endif +#endif + +// LIBODB_MYSQL_BUILD2 macro can be defined either by the buildfile or by the +// included odb/mysql/details/config*.h (see above). +// +#ifdef LIBODB_MYSQL_BUILD2 +# ifdef LIBODB_MYSQL_INCLUDE_SHORT +# error mysql headers must be included with mysql/ prefix +# elif !defined(LIBODB_MYSQL_INCLUDE_LONG) +# define LIBODB_MYSQL_INCLUDE_LONG 1 +# endif #endif // no post diff --git a/odb/mysql/details/export.hxx b/odb/mysql/details/export.hxx index eeccf07..337ea99 100644 --- a/odb/mysql/details/export.hxx +++ b/odb/mysql/details/export.hxx @@ -9,6 +9,43 @@ #include <odb/mysql/details/config.hxx> +// 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_MYSQL_BUILD2 + +#if defined(LIBODB_MYSQL_STATIC) // Using static. +# define LIBODB_MYSQL_EXPORT +#elif defined(LIBODB_MYSQL_STATIC_BUILD) // Building static. +# define LIBODB_MYSQL_EXPORT +#elif defined(LIBODB_MYSQL_SHARED) // Using shared. +# ifdef _WIN32 +# define LIBODB_MYSQL_EXPORT __declspec(dllimport) +# else +# define LIBODB_MYSQL_EXPORT +# endif +#elif defined(LIBODB_MYSQL_SHARED_BUILD) // Building shared. +# ifdef _WIN32 +# define LIBODB_MYSQL_EXPORT __declspec(dllexport) +# else +# define LIBODB_MYSQL_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_MYSQL_EXPORT // Using static or shared. +#endif + +#else // LIBODB_MYSQL_BUILD2 + #ifdef LIBODB_MYSQL_STATIC_LIB # define LIBODB_MYSQL_EXPORT #else @@ -35,6 +72,8 @@ # endif #endif +#endif // LIBODB_MYSQL_BUILD2 + #include <odb/post.hxx> #endif // ODB_MYSQL_DETAILS_EXPORT_HXX |