From 1866947b49889fa1d5296e103bd17feb36c5bc88 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 9 Jul 2018 09:50:53 +0200 Subject: Adjust ODB compilation script for bdep-based setup --- bdep/odb.sh | 41 ++++++++++++++++++++++++++++++++++------- 1 file 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 ' \ @@ -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 ' \ -- cgit v1.1