aboutsummaryrefslogtreecommitdiff
path: root/odb/buildfile
blob: fd7701a1d7a3d34ea9e3bfb6c576dd7d2c7105d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# file      : odb/buildfile
# copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC
# license   : GNU GPL v3; see accompanying LICENSE file

define plugin: libs
plugin{*}: bin.lib.prefix = # No lib prefix.
plugin{*}: backlink = true  # Backlink in forwarded configs (next to exe).

# 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.
#
# 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.
#
gxx_name = ($cxx.target != $build.host ? g++ : $recall($cxx.path))
gxx_name = $regex.replace($gxx_name, '\\', '\\\\') # Escape back slashes.

import libs  = libcutl%lib{cutl}
import libs += libstudxml%lib{studxml}

./: exe{odb} plugin{odb}

exe{odb}: cxx{odb}
exe{odb}: libus{odb}: bin.whole = false

plugin{odb}: libus{odb}

if ($cxx.target.system == 'mingw32')
  plugin{odb}: cxx.libs += $plugin_dir/cc1plus.exe.a

libus{odb}: {hxx ixx txx cxx}{** -odb -options} {hxx ixx cxx}{options} $libs

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.
#
{hxx ixx txx}{*}: install = false

# Generated options parser.
#
# @@ TMP: currently generated code is committed to allow building from git.
#
if $cli.configured
{
  cli.cxx{options}: cli{options}

  cli.options += --include-with-brackets --include-prefix odb \
--guard-prefix ODB --generate-file-scanner --generate-specifier \
--generate-modifier --generate-description --suppress-undocumented \
--cxx-prologue '#include <odb/option-parsers.hxx>'

  # Include the 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).
  #
  cli.cxx{*}: dist  = true
  cli.cxx{*}: clean = ($src_root != $out_root)

  # We keep the generated code in the repository so copy it back to src in
  # case of a forwarded configuration.
  #
  cli.cxx{*}: backlink = overwrite
}