aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-07-09 09:50:53 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-07-09 09:50:53 +0200
commit1866947b49889fa1d5296e103bd17feb36c5bc88 (patch)
tree829263fec8505b6a67a3d83f01c71726edac24d3
parenta39366a5658d0b41095c62b3ef91f86b24d8ba3a (diff)
Adjust ODB compilation script for bdep-based setup
-rwxr-xr-xbdep/odb.sh41
1 files changed, 34 insertions, 7 deletions
diff --git a/bdep/odb.sh b/bdep/odb.sh
index a2596e3..4cf87c7 100755
--- a/bdep/odb.sh
+++ b/bdep/odb.sh
@@ -3,13 +3,40 @@
trap 'exit 1' ERR
odb=odb
-lib="\
--I$HOME/work/odb/builds/default/libodb-sqlite-default \
--I$HOME/work/odb/libodb-sqlite \
--I$HOME/work/odb/builds/default/libodb-default \
--I$HOME/work/odb/libodb"
+inc=()
-$odb $lib -I.. -I../../libbpkg -I../../libbutl \
+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-sqlite-[1-9]*/)")
+
+ inc+=("-I$cfg/libbutl")
+ inc+=("-I../../libbutl")
+
+ inc+=("-I$cfg/libbpkg")
+ inc+=("-I../../libbpkg")
+
+ inc+=("-I$cfg/bdep")
+ inc+=("-I..")
+
+else
+
+ inc+=("-I$HOME/work/odb/builds/default/libodb-sqlite-default")
+ inc+=("-I$HOME/work/odb/libodb-sqlite")
+
+ inc+=("-I$HOME/work/odb/builds/default/libodb-default")
+ inc+=("-I$HOME/work/odb/libodb")
+
+ inc+=(-I.. -I../../libbpkg -I../../libbutl)
+
+fi
+
+$odb "${inc[@]}" \
-DLIBODB_BUILD2 -DLIBODB_SQLITE_BUILD2 --generate-schema \
-d sqlite --std c++14 --generate-query \
--odb-epilogue '#include <bdep/wrapper-traits.hxx>' \
@@ -18,7 +45,7 @@ $odb $lib -I.. -I../../libbpkg -I../../libbutl \
--include-with-brackets --include-prefix bdep --guard-prefix BDEP \
--sqlite-override-null project.hxx
-$odb $lib -I.. -I../../libbpkg -I../../libbutl \
+$odb "${inc[@]}" \
-DLIBODB_BUILD2 -DLIBODB_SQLITE_BUILD2 \
-d sqlite --std c++14 --generate-query \
--odb-epilogue '#include <bdep/wrapper-traits.hxx>' \