aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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>' \