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