diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-06-06 23:35:13 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-06-18 14:28:42 +0300 |
commit | 369fe1eba31f3e7a6f5424002eae88bfcb280efa (patch) | |
tree | 8ed97a28d17953ef956199d7f6c7cb5c7c9459cf | |
parent | e3c608545cedcd5202abb155bb94d17f7174451b (diff) |
Add support for build2 build
31 files changed, 428 insertions, 7 deletions
@@ -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 @@ -2,7 +2,7 @@ Prerequisites ============= - libodb http://www.codesynthesis.com/products/odb/ - - oci http://www.oracle.com/technetwork/database/features/instant-client/index-100365.html + - oci http://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html The OCI library can be obtained in two ways: as part of the Oracle database installation or as a separate distribution called Instant Client. diff --git a/README-GIT b/README-GIT new file mode 100644 index 0000000..5506448 --- /dev/null +++ b/README-GIT @@ -0,0 +1,5 @@ +The checked out odb/oracle/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/oracle/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..dddb65d --- /dev/null +++ b/build/bootstrap.build @@ -0,0 +1,11 @@ +# file : build/bootstrap.build +# copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC +# license : ODB NCUEL; see accompanying LICENSE file + +project = libodb-oracle + +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..d4f913d --- /dev/null +++ b/build/export.build @@ -0,0 +1,10 @@ +# file : build/export.build +# copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC +# license : ODB NCUEL; see accompanying LICENSE file + +$out_root/ +{ + include odb/oracle/ +} + +export $out_root/odb/oracle/lib{odb-oracle} diff --git a/build/root.build b/build/root.build new file mode 100644 index 0000000..34b68db --- /dev/null +++ b/build/root.build @@ -0,0 +1,20 @@ +# file : build/root.build +# copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC +# license : ODB NCUEL; 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..ca52402 --- /dev/null +++ b/buildfile @@ -0,0 +1,10 @@ +# file : buildfile +# copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC +# license : ODB NCUEL; see accompanying LICENSE file + +./: {*/ -build/ -m4/} doc{NCUEL INSTALL LICENSE NEWS README} manifest + +# Don't install tests or the INSTALL file. +# +tests/: install = false +doc{INSTALL}@./: install = false diff --git a/manifest b/manifest new file mode 100644 index 0000000..36f5a64 --- /dev/null +++ b/manifest @@ -0,0 +1,20 @@ +: 1 +name: libodb-oracle +version: 2.5.0-b.8.z +summary: Oracle ODB runtime library +license: ODB NCUEL; Non-Commercial Use and Evaluation License +license: proprietary +tags: c++, orm, oracle, 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-oracle/ +email: odb-users@codesynthesis.com +build-email: odb-builds@codesynthesis.com +build-exclude: *; Requires proprietary Oracle Call Interface library +requires: c++11 +requires: oci; Oracle Call Interface library +depends: * build2 >= 0.7.0- +depends: * bpkg >= 0.7.0- +depends: libodb [2.5.0-b.8.1 2.5.0-b.9) diff --git a/odb/oracle/buildfile b/odb/oracle/buildfile new file mode 100644 index 0000000..6d45d95 --- /dev/null +++ b/odb/oracle/buildfile @@ -0,0 +1,100 @@ +# file : odb/oracle/buildfile +# copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC +# license : ODB NCUEL; see accompanying LICENSE file + +import int_libs = libodb%lib{odb} + +# Note: to build with MinGW rename oci.lib to liboci.dll.a. +# +if ($cc.target.class != 'windows') + import imp_libs = liboci%lib{clntsh} +else + import imp_libs = liboci%lib{oci} + +lib{odb-oracle}: {hxx ixx txx cxx}{* -version-build2} {hxx}{version-build2} \ + details/{hxx ixx txx cxx}{* -options} details/{hxx ixx cxx}{options} \ + details/build2/{h}{*} \ + $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-oracle}: bin.lib.version = @"-$version.project_id" +else + lib{odb-oracle}: bin.lib.version = @"-$version.major.$version.minor" + +cxx.poptions =+ "-I$out_root" "-I$src_root" -DLIBODB_ORACLE_BUILD2 +obja{*}: cxx.poptions += -DLIBODB_ORACLE_STATIC_BUILD +objs{*}: cxx.poptions += -DLIBODB_ORACLE_SHARED_BUILD + +lib{odb-oracle}: cxx.export.poptions = "-I$out_root" "-I$src_root" \ + -DLIBODB_ORACLE_BUILD2 + +liba{odb-oracle}: cxx.export.poptions += -DLIBODB_ORACLE_STATIC +libs{odb-oracle}: cxx.export.poptions += -DLIBODB_ORACLE_SHARED + +lib{odb-oracle}: cxx.export.libs = $int_libs + +details/ +{ + if $cli.configured + { + cli.cxx{options}: cli{options} + + cli.options += --include-with-brackets --include-prefix odb/oracle/details \ +--guard-prefix LIBODB_ORACLE_DETAILS --generate-file-scanner \ +--cli-namespace odb::oracle::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/oracle/ subdirectory of, say, /usr/include/ recreating +# subdirectories. +# +install_include = [dir_path] include/odb/oracle/ + +{hxx ixx txx}{*}: install = $install_include +{hxx ixx txx}{*}: install.subdirs = true + +# We want these to be picked up whether LIBODB_ORACLE_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/oracle/details/.gitignore b/odb/oracle/details/.gitignore new file mode 100644 index 0000000..c6e608b --- /dev/null +++ b/odb/oracle/details/.gitignore @@ -0,0 +1 @@ +options.?xx diff --git a/odb/oracle/details/build2/config-stub.h b/odb/oracle/details/build2/config-stub.h new file mode 100644 index 0000000..514b2f6 --- /dev/null +++ b/odb/oracle/details/build2/config-stub.h @@ -0,0 +1,6 @@ +/* file : odb/oracle/details/build2/config-stub.h + * copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC + * license : ODB NCUEL; see accompanying LICENSE file + */ + +#include <odb/oracle/details/config.h> diff --git a/odb/oracle/details/build2/config-vc-stub.h b/odb/oracle/details/build2/config-vc-stub.h new file mode 100644 index 0000000..fa8e914 --- /dev/null +++ b/odb/oracle/details/build2/config-vc-stub.h @@ -0,0 +1,6 @@ +/* file : odb/oracle/details/build2/config-vc-stub.h + * copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC + * license : ODB NCUEL; see accompanying LICENSE file + */ + +#include <odb/oracle/details/config-vc.h> diff --git a/odb/oracle/details/build2/config-vc.h b/odb/oracle/details/build2/config-vc.h new file mode 100644 index 0000000..1e06225 --- /dev/null +++ b/odb/oracle/details/build2/config-vc.h @@ -0,0 +1,16 @@ +/* file : odb/oracle/details/build2/config-vc.h + * copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC + * license : ODB NCUEL; see accompanying LICENSE file + */ + +/* Configuration file for Windows/VC++ for the build2 build. */ + +#ifndef ODB_ORACLE_DETAILS_CONFIG_VC_H +#define ODB_ORACLE_DETAILS_CONFIG_VC_H + +/* Define LIBODB_ORACLE_BUILD2 for the installed case. */ +#ifndef LIBODB_ORACLE_BUILD2 +# define LIBODB_ORACLE_BUILD2 +#endif + +#endif /* ODB_ORACLE_DETAILS_CONFIG_VC_H */ diff --git a/odb/oracle/details/build2/config.h b/odb/oracle/details/build2/config.h new file mode 100644 index 0000000..615210b --- /dev/null +++ b/odb/oracle/details/build2/config.h @@ -0,0 +1,18 @@ +/* file : odb/oracle/details/build2/config.h + * copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC + * license : ODB NCUEL; see accompanying LICENSE file + */ + +/* Static configuration file for the build2 build. The installed case + (when LIBODB_ORACLE_BUILD2 is not necessarily defined) is the only + reason we have it. */ + +#ifndef ODB_ORACLE_DETAILS_CONFIG_H +#define ODB_ORACLE_DETAILS_CONFIG_H + +/* Define LIBODB_ORACLE_BUILD2 for the installed case. */ +#ifndef LIBODB_ORACLE_BUILD2 +# define LIBODB_ORACLE_BUILD2 +#endif + +#endif /* ODB_ORACLE_DETAILS_CONFIG_H */ diff --git a/odb/oracle/details/config-vc.h b/odb/oracle/details/config-vc.h new file mode 100644 index 0000000..8d5b65b --- /dev/null +++ b/odb/oracle/details/config-vc.h @@ -0,0 +1,6 @@ +/* file : odb/oracle/details/config-vc.h + * copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC + * license : ODB NCUEL; see accompanying LICENSE file + */ + +/* Dummy configuration file for Windows/VC++. */ diff --git a/odb/oracle/details/config.hxx b/odb/oracle/details/config.hxx index 47e17d5..444f0f4 100644 --- a/odb/oracle/details/config.hxx +++ b/odb/oracle/details/config.hxx @@ -7,11 +7,14 @@ // no pre -#ifdef _MSC_VER -#elif defined(ODB_COMPILER) +#ifdef ODB_COMPILER # error libodb-oracle header included in odb-compiled header -#else -# include <odb/oracle/details/config.h> +#elif !defined(LIBODB_ORACLE_BUILD2) +# ifdef _MSC_VER +# include <odb/oracle/details/config-vc.h> +# else +# include <odb/oracle/details/config.h> +# endif #endif // no post diff --git a/odb/oracle/details/export.hxx b/odb/oracle/details/export.hxx index bce6195..ff819dc 100644 --- a/odb/oracle/details/export.hxx +++ b/odb/oracle/details/export.hxx @@ -9,6 +9,43 @@ #include <odb/oracle/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_ORACLE_BUILD2 + +#if defined(LIBODB_ORACLE_STATIC) // Using static. +# define LIBODB_ORACLE_EXPORT +#elif defined(LIBODB_ORACLE_STATIC_BUILD) // Building static. +# define LIBODB_ORACLE_EXPORT +#elif defined(LIBODB_ORACLE_SHARED) // Using shared. +# ifdef _WIN32 +# define LIBODB_ORACLE_EXPORT __declspec(dllimport) +# else +# define LIBODB_ORACLE_EXPORT +# endif +#elif defined(LIBODB_ORACLE_SHARED_BUILD) // Building shared. +# ifdef _WIN32 +# define LIBODB_ORACLE_EXPORT __declspec(dllexport) +# else +# define LIBODB_ORACLE_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_ORACLE_EXPORT // Using static or shared. +#endif + +#else // LIBODB_ORACLE_BUILD2 + #ifdef LIBODB_ORACLE_STATIC_LIB # define LIBODB_ORACLE_EXPORT #else @@ -35,6 +72,8 @@ # endif #endif +#endif // LIBODB_ORACLE_BUILD2 + #include <odb/post.hxx> #endif // ODB_ORACLE_DETAILS_EXPORT_HXX diff --git a/odb/oracle/makefile b/odb/oracle/makefile index 6963297..29ea950 100644 --- a/odb/oracle/makefile +++ b/odb/oracle/makefile @@ -104,7 +104,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-oracle-vc8.vcproj libodb-oracle-vc9.vcproj \ libodb-oracle-vc10.vcxproj libodb-oracle-vc10.vcxproj.filters \ diff --git a/odb/oracle/version-build2-stub.hxx b/odb/oracle/version-build2-stub.hxx new file mode 100644 index 0000000..6d8f242 --- /dev/null +++ b/odb/oracle/version-build2-stub.hxx @@ -0,0 +1,5 @@ +// file : odb/oracle/version-build2-stub.hxx +// copyright : Copyright (c) 2005-2018 Code Synthesis Tools CC +// license : ODB NCUEL; see accompanying LICENSE file + +#include <odb/oracle/version.hxx> diff --git a/odb/oracle/version-build2.hxx b/odb/oracle/version-build2.hxx new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/odb/oracle/version-build2.hxx diff --git a/odb/oracle/version-build2.hxx.in b/odb/oracle/version-build2.hxx.in new file mode 100644 index 0000000..c7678f4 --- /dev/null +++ b/odb/oracle/version-build2.hxx.in @@ -0,0 +1,44 @@ +// file : odb/oracle/version-build2.hxx.in +// copyright : Copyright (c) 2005-2018 Code Synthesis Tools CC +// license : ODB NCUEL; see accompanying LICENSE file + +#ifndef LIBODB_ORACLE_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_ORACLE_VERSION $libodb-oracle.version.project_number$ULL +#define LIBODB_ORACLE_VERSION_STR "$libodb-oracle.version.project$" +#define LIBODB_ORACLE_VERSION_ID "$libodb-oracle.version.project_id$" + +#define LIBODB_ORACLE_VERSION_MAJOR $libodb-oracle.version.major$ +#define LIBODB_ORACLE_VERSION_MINOR $libodb-oracle.version.minor$ +#define LIBODB_ORACLE_VERSION_PATCH $libodb-oracle.version.patch$ + +#define LIBODB_ORACLE_PRE_RELEASE $libodb-oracle.version.pre_release$ + +#define LIBODB_ORACLE_SNAPSHOT $libodb-oracle.version.snapshot_sn$ULL +#define LIBODB_ORACLE_SNAPSHOT_ID "$libodb-oracle.version.snapshot_id$" + +#include <odb/version.hxx> + +$libodb.check(LIBODB_VERSION, LIBODB_SNAPSHOT)$ + +#endif // LIBODB_ORACLE_VERSION diff --git a/odb/oracle/version.hxx b/odb/oracle/version.hxx index a8dec7c..55f4d94 100644 --- a/odb/oracle/version.hxx +++ b/odb/oracle/version.hxx @@ -2,6 +2,10 @@ // copyright : Copyright (c) 2005-2018 Code Synthesis Tools CC // license : ODB NCUEL; see accompanying LICENSE file +#ifdef LIBODB_ORACLE_BUILD2 +# include <odb/oracle/version-build2.hxx> +#else + #ifndef ODB_ORACLE_VERSION_HXX #define ODB_ORACLE_VERSION_HXX @@ -42,3 +46,4 @@ #include <odb/post.hxx> #endif // ODB_ORACLE_VERSION_HXX +#endif // LIBODB_ORACLE_BUILD2 diff --git a/repositories.manifest b/repositories.manifest new file mode 100644 index 0000000..fe2ba91 --- /dev/null +++ b/repositories.manifest @@ -0,0 +1,6 @@ +: 1 +summary: Oracle ODB runtime library repository + +: +role: prerequisite +location: ../libodb.git##HEAD 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..4c6b67a --- /dev/null +++ b/tests/basics/buildfile @@ -0,0 +1,7 @@ +# file : tests/basics/buildfile +# copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC +# license : ODB NCUEL; see accompanying LICENSE file + +import libs = libodb-oracle%lib{odb-oracle} + +exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/basics/driver.cxx b/tests/basics/driver.cxx new file mode 100644 index 0000000..c49b0b1 --- /dev/null +++ b/tests/basics/driver.cxx @@ -0,0 +1,38 @@ +// file : tests/basics/driver.cxx +// copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC +// license : ODB NCUEL; 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/oracle/database.hxx> +#include <odb/oracle/exceptions.hxx> +#include <odb/oracle/transaction.hxx> + +using namespace odb::oracle; + +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..cc1f8f2 --- /dev/null +++ b/tests/build/bootstrap.build @@ -0,0 +1,9 @@ +# file : tests/build/bootstrap.build +# copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC +# license : ODB NCUEL; 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..a55d412 --- /dev/null +++ b/tests/build/root.build @@ -0,0 +1,18 @@ +# file : tests/build/root.build +# copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC +# license : ODB NCUEL; 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..6bf7425 --- /dev/null +++ b/tests/buildfile @@ -0,0 +1,5 @@ +# file : tests/buildfile +# copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC +# license : ODB NCUEL; see accompanying LICENSE file + +./: {*/ -build/} |