summaryrefslogtreecommitdiff
path: root/odb-examples/mapping/buildfile
blob: f7803f43c7a36a885abc9d94ded8397be321dc8a (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
# file      : mapping/buildfile
# license   : GNU GPL v2; see accompanying LICENSE file

import libodb = libodb%lib{odb}

import libs = libodb-$database%lib{odb-$database}

exe{driver}: {hxx cxx}{* -*-odb -*-odb-*} {hxx ixx cxx}{person-odb} testscript

# The metadata library target which we use to extract the poptions variable
# value for specifying the contained options on the ODB compiler command line.
#
libue{person-meta}: $libodb

exe{driver}: libue{person-meta} $libs

<{hxx ixx cxx}{person-odb}>: hxx{person} libue{person-meta} $odb
{{
  pops = $cxx.lib_poptions($<[1])
  depdb hash $pops

  depdb dyndep --dyn-target --target-what 'generated schema' --format lines \
  -- echo ($sqlite ? '' : "$out_base/person.sql")

  $odb --std c++11                            \
       --database $database                   \
       --generate-schema                      \
       --generate-query                       \
       --hxx-prologue '#include "traits.hxx"' \
       --output-dir $out_base                 \
       --table-prefix mapping_                \
       "-I$src_base" $pops                    \
       $path($<[0])
}}

cxx.poptions =+ "-I$out_base" "-I$src_base" -DDATABASE_$ucase($database)

# Testscript's run-time prerequisites.
#
# @@ BUILD2: Eventually we should be able to mark it as test.input once
#    this is supported for testscript tests.
#
exe{driver}: ../alias{database-client}: include = adhoc

testscript@./: schema = person