aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-06-20 08:19:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-06-20 08:19:59 +0200
commitbbba599fc28e9121d99e27105ad045c8e25c51a4 (patch)
tree9e259c074c93702d8a1b8c66276f963b65ad7404
parent290aea0990897ed2aae5ef0579cbfdd04d0dca93 (diff)
Various build improvements
-rw-r--r--build/root.build13
-rw-r--r--manifest4
-rw-r--r--odb/buildfile28
3 files changed, 34 insertions, 11 deletions
diff --git a/build/root.build b/build/root.build
index 66eb8b0..ed295ce 100644
--- a/build/root.build
+++ b/build/root.build
@@ -6,6 +6,19 @@ cxx.std = 11
using cxx
+if ($cxx.id != 'gcc')
+ fail 'ODB compiler can only be built with GCC'
+
+# Determine the GCC plugin directory.
+#
+# If plugin support is disabled, then -print-file-name will print the name we
+# have passed (the real plugin directory will always be absolute).
+#
+plugin_dir = [dir_path] $process.run($cxx.path -print-file-name=plugin)
+
+if ("$plugin_dir" == plugin)
+ fail "$recall($cxx.path) does not support plugins"
+
hxx{*}: extension = hxx
ixx{*}: extension = ixx
txx{*}: extension = txx
diff --git a/manifest b/manifest
index 360d244..d99caa0 100644
--- a/manifest
+++ b/manifest
@@ -12,7 +12,7 @@ src-url: https://git.codesynthesis.com/cgit/odb/odb/
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: * build2 >= 0.8.0-
+depends: * bpkg >= 0.8.0-
depends: libstudxml ^1.1.0-
depends: libcutl ^1.11.0-
diff --git a/odb/buildfile b/odb/buildfile
index c43f364..9e1d6bc 100644
--- a/odb/buildfile
+++ b/odb/buildfile
@@ -2,21 +2,31 @@
# copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC
# license : GNU GPL v3; see accompanying LICENSE file
-plugin_dir = $config.odb.plugin_dir
-
define plugin: libs
plugin{*}: bin.lib.prefix = # No lib prefix.
plugin{*}: backlink = true # Backlink in forwarded configs (next to exe).
-# On Windows we want the plugin (odb.dll) to go into bin/ (default), next to
-# the driver (odb.exe) since failed that we won't be able to find libraries we
+# By default install the plugin next to the driver.
+#
+# On Windows this is the only sane option where we want the plugin (odb.dll)
+# to go into bin/ since failed that we won't be able to find libraries we
# depend on.
#
-# @@ It feels like we should also -DODB_GCC_PLUGIN_DIR when updating for
-# install (but again not for Windows).
+# On other platforms another option is to install into the GCC's plugin
+# directory. This way the same driver can be used with multiple GCC versions
+# and is something that distributions packagers sometimes want to do.
+#
+# So at some point we should also make it configurable, including support for
+# installing into GCC's plugin directory.
+#
+# NOTE: see ODB_GCC_PLUGIN_DIR when adding this support.
+#
+plugin{*}: install = bin/
+
+# Unless cross-compiling, pass the C++ compiler's recall path as g++ name. At
+# some point we should also make it configurable.
#
-if ($cxx.target.system != 'mingw32')
- plugin{*}: install = $plugin_dir
+gxx_name = ($cxx.target != $build.host ? g++ : $recall($cxx.path))
import libs = libcutl%lib{cutl}
import libs += libstudxml%lib{studxml}
@@ -33,7 +43,7 @@ if ($cxx.target.system == 'mingw32')
libus{odb}: {hxx ixx txx cxx}{** -odb -options} {hxx ixx cxx}{options} $libs
-cxx.poptions += "-I$plugin_dir/include"
+cxx.poptions += "-I$plugin_dir/include" "-DODB_GXX_NAME=\"$gxx_name\""
cxx.poptions += -DODB_BUILD2 # @@ TMP while supporting other build systems.
# Don't install any of the plugin's headers.