Skip to content
Snippets Groups Projects
Commit a55dfcbb authored by Markus Blatt's avatar Markus Blatt
Browse files

dunecontrol now supports build modules with CMake. In this branch CMake is the

default if the module supports it. This can be behaviour can be deactivated
using the --use-autoconf switch. Then autoconf is used whereever posible.


[[Imported from SVN: r6891]]
parent 84c39d1e
No related branches found
No related tags found
No related merge requests found
......@@ -221,8 +221,8 @@ COMMANDS="printdeps update autogen configure make all exec status svn"
# help string for the commands
printdeps_HELP="print recursive dependencies of a module"
update_HELP="updated all modules from the repository"
autogen_HELP="run the autogen.sh script for each module"
configure_HELP="run configure for each module"
autogen_HELP="run the autogen.sh script for each module. Does nothing, if CMake is activated"
configure_HELP="run configure or cmake for each module"
make_HELP="run make for each module"
all_HELP="\trun 'autogen', 'configure' and 'make' command for each module"
exec_HELP="execute an arbitrary command in each module directory"
......@@ -342,28 +342,39 @@ run_default_update () {
}
run_default_autogen () {
PARAMS="$CMD_FLAGS"
local M4_PATH=""
if test -f configure.ac && \
( test -d .svn || test -d .git || test -d CVS || test -f stamp-vc ); then
for m in $FOUND_MODULES; do
path=$(eval "echo \$PATH_$m")
MODULE_PATHS="$MODULE_PATHS$path "
done
if test -f autogen.sh; then
eval echo "WARNING: \$NAME_$module contains obsolete autogen.sh," \
>&2
echo " dune-autogen is used instead." >&2
echo "autogen USE_CMAKE=$USE_CMAKE"
if test "x$USE_CMAKE" != "xyes" || test ! -e $(eval "echo \$PATH_$module")/CMakeLists.txt ; then
PARAMS="$CMD_FLAGS"
local M4_PATH=""
if test -f configure.ac && \
( test -d .svn || test -d .git || test -d CVS || test -f stamp-vc ); then
for m in $FOUND_MODULES; do
path=$(eval "echo \$PATH_$m")
MODULE_PATHS="$MODULE_PATHS$path "
done
if test -f autogen.sh; then
eval echo "WARNING: \$NAME_$module contains obsolete autogen.sh," \
>&2
echo " dune-autogen is used instead." >&2
fi
eval "$PREFIX_DIR/bin/dune-autogen" "$MODULE_PATHS" "$PARAMS" || exit 1
else
echo Skipping dune-autogen
fi
eval "$PREFIX_DIR/bin/dune-autogen" "$MODULE_PATHS" "$PARAMS" || exit 1
else
echo Skipping dune-autogen
else
echo Skipping dune-autogen because of CMake
fi
}
run_default_configure () {
PARAMS="$CMD_FLAGS"
if test -x configure; then
if test "x$USE_CMAKE" = "xyes" && test -e $(eval "echo \$PATH_$module")/CMakeLists.txt; then
LOCAL_USE_CMAKE=yes
else
LOCAL_USE_CMAKE=no
fi
echo "LOCAL_USE_CMAKE=$LOCAL_USE_CMAKE $(eval "echo \$PATH_$module")/CMakeLists.txt"
if test -x configure || test "x$LOCAL_USE_CMAKE" = "xyes" ; then
ACLOCAL_FLAGS="-I ."
if test -d "m4"; then
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4"
......@@ -386,20 +397,48 @@ run_default_configure () {
else
PARAMS="$PARAMS \"--with-$name=$path\""
fi
if test -d "$path/cmake/modules/"; then
CMAKE_MODULE_PATH="$CMAKE_MODULE_PATH:$path/cmake/modules/"
fi
if test -d "$path/share/$name/cmake/modules/"; then
CMAKE_MODULE_PATH="$CMAKE_MODULE_PATH:$path/share/$name/cmake/modules/"
fi
echo name="$name"
if test "x$USE_CMAKE" = "xyes"; then
CMAKE_PARAMS="$CMAKE_PARAMS \"-D""$name""_DIR=$path/$BUILDDIR\""
else
echo "Only out of source builds are supported when using CMake" >&2
exit 1
fi
done
CMAKE_MODULE_PATH=`echo $CMAKE_MODULE_PATH| sed "s/^://"`
echo "CMAKE_MODULE_PATH=$CMAKE_MODULE_PATH"
echo "CMAKE_PARAMS=$CMAKE_PARAMS"
if test "x$HAVE_duneweb" == "xyes"; then
PARAMS="$PARAMS \"--with-duneweb=$PATH_duneweb\""
fi
PARAMS="$PARAMS ACLOCAL_AMFLAGS=\"$ACLOCAL_FLAGS\""
echo ./configure "$PARAMS"
# create build directory of requested
if test -n "$BUILDDIR"; then
if test "x$LOCAL_USE_CMAKE" = "xyes"; then
test -d "$BUILDDIR" || mkdir "$BUILDDIR"
SRCDIR="$PWD"
cd "$BUILDDIR"
eval "$SRCDIR/configure" "$PARAMS" || exit 1
pushd "$BUILDDIR"
echo "cmake -DCMAKE_MODULE_PATH=$CMAKE_MODULE_PATH $CMAKE_PARAMS $SRCDIR"
eval cmake "-DCMAKE_MODULE_PATH=$CMAKE_MODULE_PATH $CMAKE_PARAMS $SRCDIR"
popd
else
eval ./configure "$PARAMS" || exit 1
echo ./configure "$PARAMS"
# create build directory of requested
if test -n "$BUILDDIR"; then
test -d "$BUILDDIR" || mkdir "$BUILDDIR"
SRCDIR="$PWD"
cd "$BUILDDIR"
eval "$SRCDIR/configure" "$PARAMS" || exit 1
else
eval ./configure "$PARAMS" || exit 1
fi
fi
else
if test -f configure.in || test -f configure.ac; then
......@@ -456,21 +495,22 @@ usage () {
echo " Dependencies are controlled by the $CONTROL files."
echo ""
echo "OPTIONS:"
echo " -h, --help show this help"
echo " --debug enable debug output of this script"
echo " --module=mod only apply the actions on module mod"
echo " and all modules it depends on"
echo " --only=mod only apply the actions on module mod"
echo " and not the modules it depends on"
echo " --current only apply the actions on the current module,"
echo " the one whose source tree we are standing in"
echo " --resume resume a previous run (only consider the modules"
echo " not built successfully on the previous run)"
echo " --skipfirst skip the first module (use with --resume)"
echo " --opts=FILE load default options from FILE"
echo " (see dune-common/doc/example.opts)"
echo " -h, --help show this help"
echo " --debug enable debug output of this script"
echo " --use-autotools use autotools instead of cmake for building"
echo " --module=mod only apply the actions on module mod"
echo " and all modules it depends on"
echo " --only=mod only apply the actions on module mod"
echo " and not the modules it depends on"
echo " --current only apply the actions on the current module,"
echo " the one whose source tree we are standing in"
echo " --resume resume a previous run (only consider the modules"
echo " not built successfully on the previous run)"
echo " --skipfirst skip the first module (use with --resume)"
echo " --opts=FILE load default options from FILE"
echo " (see dune-common/doc/example.opts)"
echo " --builddir=NAME make out-of-source builds in a subdir NAME."
echo " This directory is created inside each module."
echo " This directory is created inside each module."
echo " --[COMMAND]-opts=opts set options for COMMAND"
echo " (this is mainly useful for the 'all' COMMAND)"
echo "COMMANDS:"
......@@ -549,6 +589,7 @@ export ONLY=""
export RESUME_FLAG=no
export REVERSE_FLAG=no
export SKIPFIRST=no
export USE_CMAKE=yes
# parse commandline parameters
while test $# -gt 0; do
......@@ -657,6 +698,9 @@ while test $# -gt 0; do
--skipfirst)
export SKIPFIRST=yes
;;
--use-autotools)
export USE_CMAKE=no
;;
--debug) true ;; # ignore this option, it is handled right at the beginning
--*)
usage
......@@ -672,6 +716,11 @@ while test $# -gt 0; do
shift
done
if test "x$USE_CMAKE" = "xyes" && test -z "$DUNE_BUILDDIR"; then
echo "No build directory provided. Defaulting to the sub directory cmake-build"
export DUNE_BUILDDIR=cmake-build
fi
echo "USE_CMAKE=$USE_CMAKE DUNE_BUILDDIR=$DUNE_BUILDDIR"
# we assume there should be a command...
if test "x$command" = "x"; then
usage
......
......@@ -350,8 +350,12 @@ AC_DEFUN([DUNE_CHECK_MODULES],[
_dune_cm_LIBS="-L$_DUNE_MODULE[]_LIBDIR -l[]_dune_lib"
],[
_DUNE_MODULE[]_SRCDIR=$_DUNE_MODULE[]_ROOT
# extract src and build path from Makefile, if found
AS_IF([test -f $_DUNE_MODULE[]_ROOT/Makefile],[
echo "testing $_DUNE_MODULE[]_ROOT/CMakeCache.txt"
# extract src and build path from Makefile or CMakeCache.txt, if found
AS_IF([test -f $_DUNE_MODULE[]_ROOT/CMakeCache.txt],[
_DUNE_MODULE[]_SRCDIR="`sed -ne '/^[]_dune_name[]_SOURCE_DIR:STATIC=/{s/^[]_dune_name[]_SOURCE_DIR:STATIC=//; p;}' $_DUNE_MODULE[]_ROOT/CMakeCache.txt`"
echo srcdir=$_DUNE_MODULE[]_SRCDIR
],[test -f $_DUNE_MODULE[]_ROOT/Makefile],[
_DUNE_MODULE[]_SRCDIR="`sed -ne '/^abs_top_srcdir = /{s/^abs_top_srcdir = //; p;}' $_DUNE_MODULE[]_ROOT/Makefile`"
])
_dune_cm_CPPFLAGS="-I$_DUNE_MODULE[]_SRCDIR"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment