forked from OPM/opm-polymer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Search for directory containing build scripts
Currently only the source tree is "searched", but the template could be expanded to look in another/more locations (or be specified explicitly on the command-line with a --with-opm-macros= option)
- Loading branch information
Showing
1 changed file
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,35 @@ | ||
#!/bin/sh | ||
# this file is supposed to be located in the source directory | ||
src_dir=$(dirname $0) | ||
|
||
# scan the arguments and set this if build macros could be specified | ||
mod_dir= | ||
for OPT in "$@"; do | ||
case "$OPT" in | ||
--with-opm-macros=*) | ||
# remove everything before equal sign and assign the rest | ||
mod_dir=${OPT#*=} | ||
# tilde expansion; note that doing eval may have side effects | ||
mod_dir=$(eval echo $mod_dir) | ||
# absolute path | ||
[ -d "$mod_dir" ] && mod_dir=$(cd $mod_dir ; pwd) | ||
;; | ||
esac | ||
done | ||
|
||
# if it isn't specified, the look around in other known places | ||
conf_file=cmake/Scripts/configure | ||
if [ -z "$mod_dir" ]; then | ||
if [ -r "$src_dir/$conf_file" ]; then | ||
mod_dir="$src_dir" | ||
fi | ||
fi | ||
|
||
# terminate with error message here if the module directory is not found | ||
if [ ! -r "$mod_dir/$conf_file" ]; then | ||
echo Build macros not located in \"$mod_dir\", use --with-opm-macros= to specify! 1>&2 | ||
exit 1 | ||
fi | ||
|
||
# forward to the corresponding script in the cmake/Scripts/ directory | ||
exec $(dirname $0)/cmake/Scripts/configure "$@" | ||
exec "$mod_dir/$conf_file" --src-dir="$src_dir" "$@" |