aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-11-27 23:59:42 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-11-29 17:11:38 +0300
commit6586a59e63d089f38503656949d7aa8734ca8924 (patch)
tree5733850890635be94a18626b8acc710f89e63b01
parent619d3ff17c0d2c7eb910285792329491f5438268 (diff)
Add support for build2 build
-rw-r--r--.gitignore12
-rw-r--r--README-GIT5
-rw-r--r--build/.gitignore1
-rw-r--r--build/bootstrap.build11
-rw-r--r--build/export.build10
-rw-r--r--build/root.build20
-rw-r--r--buildfile11
-rw-r--r--manifest19
-rw-r--r--odb/mysql/buildfile108
-rw-r--r--odb/mysql/details/build2/config-stub.h6
-rw-r--r--odb/mysql/details/build2/config-vc-stub.h6
-rw-r--r--odb/mysql/details/build2/config-vc.h16
-rw-r--r--odb/mysql/details/build2/config.h18
-rw-r--r--odb/mysql/details/config-vc.h13
-rw-r--r--odb/mysql/details/config.hxx25
-rw-r--r--odb/mysql/details/export.hxx39
-rw-r--r--odb/mysql/makefile2
-rw-r--r--odb/mysql/mysql-types.hxx14
-rw-r--r--odb/mysql/version-build2-stub.hxx5
-rw-r--r--odb/mysql/version-build2.hxx0
-rw-r--r--odb/mysql/version-build2.hxx.in64
-rw-r--r--odb/mysql/version.hxx5
-rw-r--r--tests/.gitignore1
-rw-r--r--tests/basics/buildfile7
-rw-r--r--tests/basics/driver.cxx38
-rw-r--r--tests/build/.gitignore1
-rw-r--r--tests/build/bootstrap.build9
-rw-r--r--tests/build/root.build18
-rw-r--r--tests/buildfile5
29 files changed, 477 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 3b9998d..a06aa4b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,19 @@
# Compiler/linker output.
#
+*.d
+*.ii
*.o
-*.o.d
+*.obj
*.so
+*.dll
*.a
+*.lib
+*.exp
+*.exe
+*.exe.dlls/
+*.exe.manifest
+*.pc
+
*.l
*.l.cpp-options
diff --git a/README-GIT b/README-GIT
new file mode 100644
index 0000000..d855df1
--- /dev/null
+++ b/README-GIT
@@ -0,0 +1,5 @@
+The checked out odb/mysql/version-build2.hxx will be overwritten during the
+build process but these changes should be ignored. To do this automatically,
+run:
+
+git update-index --assume-unchanged odb/mysql/version-build2.hxx
diff --git a/build/.gitignore b/build/.gitignore
new file mode 100644
index 0000000..225c27f
--- /dev/null
+++ b/build/.gitignore
@@ -0,0 +1 @@
+config.build
diff --git a/build/bootstrap.build b/build/bootstrap.build
new file mode 100644
index 0000000..56168b8
--- /dev/null
+++ b/build/bootstrap.build
@@ -0,0 +1,11 @@
+# file : build/bootstrap.build
+# copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+project = libodb-mysql
+
+using version
+using config
+using dist
+using test
+using install
diff --git a/build/export.build b/build/export.build
new file mode 100644
index 0000000..faffac8
--- /dev/null
+++ b/build/export.build
@@ -0,0 +1,10 @@
+# file : build/export.build
+# copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$out_root/:
+{
+ include odb/mysql/
+}
+
+export $out_root/odb/mysql/lib{odb-mysql}
diff --git a/build/root.build b/build/root.build
new file mode 100644
index 0000000..595d66e
--- /dev/null
+++ b/build/root.build
@@ -0,0 +1,20 @@
+# file : build/root.build
+# copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+cxx.std = 11
+
+using cxx
+
+hxx{*}: extension = hxx
+ixx{*}: extension = ixx
+txx{*}: extension = txx
+cxx{*}: extension = cxx
+
+# Load the cli module but only if it's available. This way a distribution
+# that includes pre-generated files can be built without installing cli.
+# This is also the reason why we need to explicitly spell out individual
+# source file prerequisites instead of using the cli.cxx{} group (it won't
+# be there unless the module is configured).
+#
+using? cli
diff --git a/buildfile b/buildfile
new file mode 100644
index 0000000..637aaba
--- /dev/null
+++ b/buildfile
@@ -0,0 +1,11 @@
+# file : buildfile
+# copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+./: {*/ -build/ -m4/} doc{GPLv2 INSTALL LICENSE NEWS README version} \
+ file{manifest}
+
+# Don't install tests or the INSTALL file.
+#
+dir{tests/}: install = false
+doc{INSTALL}@./: install = false
diff --git a/manifest b/manifest
new file mode 100644
index 0000000..faa4baf
--- /dev/null
+++ b/manifest
@@ -0,0 +1,19 @@
+: 1
+name: libodb-mysql
+version: 2.5.0-b.6.z
+summary: MySQL ODB runtime library
+license: GPLv2
+license: proprietary
+tags: c++, orm, mysql, database, relational, object, persistence, sql
+description-file: README
+changes-file: NEWS
+url: https://www.codesynthesis.com/products/odb/
+doc-url: https://www.codesynthesis.com/products/odb/doc/manual.xhtml
+src-url: https://git.codesynthesis.com/cgit/odb/libodb-mysql/
+email: odb-users@codesynthesis.com
+build-email: odb-builds@codesynthesis.com
+requires: c++11
+depends: * build2 >= 0.7.0-
+depends: * bpkg >= 0.7.0-
+depends: libmysqlclient >= 5.0.3 # | libmariadb >= 10.2.2
+depends: libodb [2.5.0-b.6.1 2.5.0-b.7)
diff --git a/odb/mysql/buildfile b/odb/mysql/buildfile
new file mode 100644
index 0000000..9fb2275
--- /dev/null
+++ b/odb/mysql/buildfile
@@ -0,0 +1,108 @@
+# file : odb/mysql/buildfile
+# copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+client_lib = 'mysql'
+#client_lib = 'mariadb'
+
+import int_libs = libodb%lib{odb}
+
+if ($client_lib == 'mysql')
+ import int_libs += libmysqlclient%lib{mysqlclient}
+else
+ import int_libs += libmariadb%lib{mariadb}
+
+lib{odb-mysql}: {hxx ixx txx cxx}{* -version-build2} {hxx}{version-build2} \
+ details/{hxx ixx txx cxx}{* -options} details/{hxx ixx cxx}{options} \
+ details/build2/{h}{*} \
+ $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/file{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-mysql}: bin.lib.version = @"-$version.project_id"
+else
+ lib{odb-mysql}: bin.lib.version = @"-$version.major.$version.minor"
+
+cxx.poptions =+ "-I$out_root" "-I$src_root" -DLIBODB_MYSQL_BUILD2
+
+if ($client_lib == 'mariadb')
+ cxx.poptions += -DLIBODB_MYSQL_MARIADB
+
+obja{*}: cxx.poptions += -DLIBODB_MYSQL_STATIC_BUILD
+objs{*}: cxx.poptions += -DLIBODB_MYSQL_SHARED_BUILD
+
+lib{odb-mysql}: cxx.export.poptions = "-I$out_root" "-I$src_root" \
+ -DLIBODB_MYSQL_BUILD2
+
+if ($client_lib == 'mariadb')
+ lib{odb-mysql}: cxx.export.poptions += -DLIBODB_MYSQL_MARIADB
+
+liba{odb-mysql}: cxx.export.poptions += -DLIBODB_MYSQL_STATIC
+libs{odb-mysql}: cxx.export.poptions += -DLIBODB_MYSQL_SHARED
+
+lib{odb-mysql}: cxx.export.libs = $int_libs
+
+details/:
+{
+ if $cli.configured
+ {
+ cli.cxx{options}: cli{options}
+
+ cli.options += --include-with-brackets --include-prefix odb/mysql/details \
+--guard-prefix LIBODB_MYSQL_DETAILS --generate-file-scanner \
+--cli-namespace odb::mysql::details::cli --long-usage --generate-specifier
+
+ # Include generated cli files into the distribution and don't remove them
+ # when cleaning in src (so that clean results in a state identical to
+ # distributed). But don't install their headers since they are only used
+ # internally in the database implementation.
+ #
+ cli.cxx{*}: dist = true
+ cli.cxx{*}: clean = ($src_root != $out_root)
+ cli.cxx{*}: install = false
+ }
+ else
+ # No install for the pre-generated case.
+ #
+ hxx{options}@./ ixx{options}@./: install = false
+}
+
+# Install into the odb/mysql/ subdirectory of, say, /usr/include/ recreating
+# subdirectories.
+#
+install_include = [dir_path] include/odb/mysql/
+
+{hxx ixx txx}{*}: install = $install_include
+{hxx ixx txx}{*}: install.subdirs = true
+
+# We want these to be picked up whether LIBODB_MYSQL_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.id == '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/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
diff --git a/odb/mysql/makefile b/odb/mysql/makefile
index 0d274ef..60e76dc 100644
--- a/odb/mysql/makefile
+++ b/odb/mysql/makefile
@@ -106,7 +106,7 @@ $(dist): headers_dist = $(subst $(src_base)/,,$(shell find $(src_base) \
$(dist): gen_headers := $(cli_tun:.cli=.hxx) $(cli_tun:.cli=.ixx)
$(dist): export headers = $(sort $(headers_dist) $(gen_headers))
$(dist): gen_dist := $(gen)
-$(dist): data_dist := $(cli_tun) details/config.h.in
+$(dist): data_dist := $(cli_tun) details/config.h.in details/config-vc.h
$(dist): export extra_dist := $(data_dist) \
libodb-mysql-vc8.vcproj libodb-mysql-vc9.vcproj \
libodb-mysql-vc10.vcxproj libodb-mysql-vc10.vcxproj.filters \
diff --git a/odb/mysql/mysql-types.hxx b/odb/mysql/mysql-types.hxx
index cd92d41..362d618 100644
--- a/odb/mysql/mysql-types.hxx
+++ b/odb/mysql/mysql-types.hxx
@@ -10,10 +10,18 @@
typedef char my_bool;
typedef struct st_mysql_bind MYSQL_BIND;
-#ifdef LIBODB_MYSQL_INCLUDE_SHORT
-# include <mysql_time.h>
+// MariaDB defines time types directly in mysql.h. Note that MariaDB is only
+// supported by the build2 build so we include the header as <mysql/mysql.h>
+// unconditionally.
+//
+#ifdef LIBODB_MYSQL_MARIADB
+# include <mysql/mysql.h>
#else
-# include <mysql/mysql_time.h>
+# ifdef LIBODB_MYSQL_INCLUDE_SHORT
+# include <mysql_time.h>
+# else
+# include <mysql/mysql_time.h>
+# endif
#endif
#endif // ODB_MYSQL_MYSQL_TYPES_HXX
diff --git a/odb/mysql/version-build2-stub.hxx b/odb/mysql/version-build2-stub.hxx
new file mode 100644
index 0000000..57ff4d9
--- /dev/null
+++ b/odb/mysql/version-build2-stub.hxx
@@ -0,0 +1,5 @@
+// file : odb/mysql/version-build2-stub.hxx
+// copyright : Copyright (c) 2005-2017 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#include <odb/mysql/version.hxx>
diff --git a/odb/mysql/version-build2.hxx b/odb/mysql/version-build2.hxx
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/odb/mysql/version-build2.hxx
diff --git a/odb/mysql/version-build2.hxx.in b/odb/mysql/version-build2.hxx.in
new file mode 100644
index 0000000..56aba98
--- /dev/null
+++ b/odb/mysql/version-build2.hxx.in
@@ -0,0 +1,64 @@
+// file : odb/mysql/version-build2.hxx.in
+// copyright : Copyright (c) 2005-2017 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef LIBODB_MYSQL_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_MYSQL_VERSION $libodb-mysql.version.project_number$ULL
+#define LIBODB_MYSQL_VERSION_STR "$libodb-mysql.version.project$"
+#define LIBODB_MYSQL_VERSION_ID "$libodb-mysql.version.project_id$"
+
+#define LIBODB_MYSQL_VERSION_MAJOR $libodb-mysql.version.major$
+#define LIBODB_MYSQL_VERSION_MINOR $libodb-mysql.version.minor$
+#define LIBODB_MYSQL_VERSION_PATCH $libodb-mysql.version.patch$
+
+#define LIBODB_MYSQL_PRE_RELEASE $libodb-mysql.version.pre_release$
+
+#define LIBODB_MYSQL_SNAPSHOT $libodb-mysql.version.snapshot_sn$ULL
+#define LIBODB_MYSQL_SNAPSHOT_ID "$libodb-mysql.version.snapshot_id$"
+
+#ifdef LIBODB_MYSQL_MARIADB
+# include <mysql/mariadb_version.h>
+
+// We support MariaDB starting from 10.2.2 when the library started to be
+// named as as mariadb, rather than mysqlclient. Before that we just don't
+// distinguish it from the MySQL client library.
+//
+# if !defined(MYSQL_VERSION_ID) || MYSQL_VERSION_ID < 100202
+# error unexpected MariaDB version detected
+# endif
+#else
+# include <mysql/mysql_version.h>
+
+// Check that we have a compatible MySQL version (5.0.3 or later).
+//
+# if !defined(MYSQL_VERSION_ID) || MYSQL_VERSION_ID < 50003
+# error incompatible MySQL version detected
+# endif
+#endif
+
+#include <odb/version.hxx>
+
+$libodb.check(LIBODB_VERSION, LIBODB_SNAPSHOT)$
+
+#endif // LIBODB_MYSQL_VERSION
diff --git a/odb/mysql/version.hxx b/odb/mysql/version.hxx
index 70f760f..232c215 100644
--- a/odb/mysql/version.hxx
+++ b/odb/mysql/version.hxx
@@ -2,6 +2,10 @@
// copyright : Copyright (c) 2005-2017 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
+#ifdef LIBODB_MYSQL_BUILD2
+# include <odb/mysql/version-build2.hxx>
+#else
+
#ifndef ODB_MYSQL_VERSION_HXX
#define ODB_MYSQL_VERSION_HXX
@@ -55,3 +59,4 @@
#include <odb/post.hxx>
#endif // ODB_MYSQL_VERSION_HXX
+#endif // LIBODB_MYSQL_BUILD2
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000..e54525b
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1 @@
+driver
diff --git a/tests/basics/buildfile b/tests/basics/buildfile
new file mode 100644
index 0000000..7c6a464
--- /dev/null
+++ b/tests/basics/buildfile
@@ -0,0 +1,7 @@
+# file : tests/basics/buildfile
+# copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libs = libodb-mysql%lib{odb-mysql}
+
+exe{driver}: {hxx cxx}{*} $libs
diff --git a/tests/basics/driver.cxx b/tests/basics/driver.cxx
new file mode 100644
index 0000000..81ab938
--- /dev/null
+++ b/tests/basics/driver.cxx
@@ -0,0 +1,38 @@
+// file : tests/basics/driver.cxx
+// copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Basic test to make sure the library is usable. Functionality testing
+// is done in the odb-tests package.
+
+#include <cassert>
+#include <sstream>
+
+#include <odb/mysql/database.hxx>
+#include <odb/mysql/exceptions.hxx>
+#include <odb/mysql/transaction.hxx>
+
+using namespace odb::mysql;
+
+int
+main ()
+{
+ {
+ std::ostringstream os;
+ database::print_usage (os);
+ assert (!os.str ().empty ());
+ }
+
+ // We can't really do much here since that would require a database. We can
+ // create a fake database object as long as we don't expect to get a valid
+ // connection.
+ //
+ database db ("john", "secret", "dummy whammy");
+
+ try
+ {
+ transaction t (db.begin ());
+ assert (false);
+ }
+ catch (const database_exception&) {}
+}
diff --git a/tests/build/.gitignore b/tests/build/.gitignore
new file mode 100644
index 0000000..225c27f
--- /dev/null
+++ b/tests/build/.gitignore
@@ -0,0 +1 @@
+config.build
diff --git a/tests/build/bootstrap.build b/tests/build/bootstrap.build
new file mode 100644
index 0000000..f573687
--- /dev/null
+++ b/tests/build/bootstrap.build
@@ -0,0 +1,9 @@
+# file : tests/build/bootstrap.build
+# copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+project = # Unnamed subproject.
+
+using config
+using dist
+using test
diff --git a/tests/build/root.build b/tests/build/root.build
new file mode 100644
index 0000000..1f471b6
--- /dev/null
+++ b/tests/build/root.build
@@ -0,0 +1,18 @@
+# file : tests/build/root.build
+# copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+cxx.std = 11
+
+using cxx
+
+hxx{*}: extension = hxx
+cxx{*}: extension = cxx
+
+# Every exe{} in this subproject is by default a test.
+#
+exe{*}: test = true
+
+# Specify the test target for cross-testing.
+#
+test.target = $cxx.target
diff --git a/tests/buildfile b/tests/buildfile
new file mode 100644
index 0000000..545984d
--- /dev/null
+++ b/tests/buildfile
@@ -0,0 +1,5 @@
+# file : tests/buildfile
+# copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+./: {*/ -build/}