aboutsummaryrefslogtreecommitdiff
path: root/libbrep/odb.sh
blob: d4e6604e87f4f632a2c4ea399e60c85615e0487f (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
#! /usr/bin/env bash

trap 'exit 1' ERR

odb=odb
inc=()

if test -d ../.bdep; then

  # Use default configuration for headers.
  #
  cfg="$(bdep config list -d .. | \
sed -r -ne 's#^(@[^ ]+ )?([^ ]+)/ .*default.*$#\2#p')"

  inc+=("-I$(echo "$cfg"/libodb-[1-9]*/)")
  inc+=("-I$(echo "$cfg"/libodb-pgsql-[1-9]*/)")

  inc+=("-I$cfg/libbutl")
  inc+=("-I../../libbutl")

  inc+=("-I$cfg/libbpkg")
  inc+=("-I../../libbpkg")

  inc+=("-I$cfg/libbbot")
  inc+=("-I../../libbbot")

  inc+=("-I$cfg/brep")
  inc+=("-I..")

else

  inc+=("-I$HOME/work/odb/builds/default/libodb-pgsql-default")
  inc+=("-I$HOME/work/odb/libodb-pgsql")

  inc+=("-I$HOME/work/odb/builds/default/libodb-default")
  inc+=("-I$HOME/work/odb/libodb")

  inc+=(-I.. -I../../libbbot -I../../libbpkg -I../../libbutl)

fi

$odb "${inc[@]}" -d pgsql --std c++14 --generate-query       \
    --odb-epilogue '#include <libbrep/wrapper-traits.hxx>'   \
    --hxx-prologue '#include <libbrep/wrapper-traits.hxx>'   \
    --hxx-prologue '#include <libbrep/common-traits.hxx>'    \
    -DLIBODB_BUILD2 -DLIBODB_PGSQL_BUILD2                    \
    --include-with-brackets --include-prefix libbrep         \
    --guard-prefix LIBBREP \
    common.hxx

$odb "${inc[@]}" -d pgsql --std c++14 --generate-query --generate-schema \
    --schema-format sql --schema-format embedded --schema-name package   \
    --odb-epilogue '#include <libbrep/wrapper-traits.hxx>'               \
    --hxx-prologue '#include <libbrep/package-traits.hxx>'               \
    --generate-prepared -DLIBODB_BUILD2 -DLIBODB_PGSQL_BUILD2            \
    --include-with-brackets --include-prefix libbrep                     \
    --guard-prefix LIBBREP                                               \
    package.hxx

xxd -i <package-extra.sql >package-extra.hxx

$odb "${inc[@]}" -d pgsql --std c++14 --generate-query --generate-schema \
    --schema-format sql --schema-format embedded --schema-name build     \
    --odb-epilogue '#include <libbrep/wrapper-traits.hxx>'               \
    --generate-prepared -DLIBODB_BUILD2 -DLIBODB_PGSQL_BUILD2            \
    --include-with-brackets --include-prefix libbrep                     \
    --guard-prefix LIBBREP \
    build.hxx

$odb "${inc[@]}" -d pgsql --std c++14 --generate-query        \
    --odb-epilogue '#include <libbrep/wrapper-traits.hxx>'    \
    --generate-prepared -DLIBODB_BUILD2 -DLIBODB_PGSQL_BUILD2 \
    --include-with-brackets --include-prefix libbrep          \
    --guard-prefix LIBBREP                                    \
    build-package.hxx

xxd -i <build-extra.sql >build-extra.hxx