aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbpkg/odb.sh39
1 files changed, 33 insertions, 6 deletions
diff --git a/bpkg/odb.sh b/bpkg/odb.sh
index 0149930..913ca6e 100755
--- a/bpkg/odb.sh
+++ b/bpkg/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/bpkg")
+ 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 <bpkg/wrapper-traits.hxx>' \