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

[bugfix,duneproject] Makes duneproject work again with installed modules.

duneproject failed miserably when run with only installed modules. With
this patch we correctly setup the pkg-config and dunecontrol path to
handle this situation. In addition we fixed various issues with the newly
created modules and they now build as exspected.
parent d1011bfe
No related branches found
No related tags found
No related merge requests found
......@@ -147,8 +147,9 @@ echo
. "$(canonicalpath $0)/../lib/dunemodules.lib"
# create PKG_CONFIG_PATH for installed dune modules
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:\"$(canonicalpath $0)/../lib/pkgconfig\""
export PREFIX_DIR="`canonicalpath "$0"`/.."
extract_multiarch_pkg_config_path
# search for modules, both installed and src modules
find_modules_in_path
......@@ -340,7 +341,7 @@ AC_CONFIG_FILES([
Makefile
src/Makefile
cmake/Makefile
cmake/pkg/Makefile
cmake/modules/Makefile
doc/Makefile
doc/doxygen/Makefile
doc/doxygen/Doxyfile
......@@ -466,7 +467,7 @@ include \$(top_srcdir)/am/global-rules
# Generate package configuration files for finding
# installed modules with CMake
include $(top_srcdir)/am/cmake-pkg-config
include \$(top_srcdir)/am/cmake-pkg-config
M_DELIM
......@@ -497,6 +498,7 @@ add_subdirectory("src")
add_subdirectory("m4")
add_subdirectory("dune")
add_subdirectory("doc")
add_subdirectory("cmake/modules")
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
......@@ -696,7 +698,7 @@ CC_DELIM
echo "- $PROJECT/m4/CMakeLists.txt"
cat> "$PROJECT/m4/CMakeLists.txt" << CC_DELIM
install(PROGRAMS $MODULE.m4 DESTINATION share/dune/aclocal)
install(PROGRAMS $MODULE.m4 DESTINATION \${CMAKE_INSTALL_DATAROOTDIR}/dune/aclocal)
CC_DELIM
......@@ -880,7 +882,7 @@ cat> "$PROJECT/doc/doxygen/CMakeLists.txt" << CC_DELIM
add_doxygen_target()
CC_DELIM
#########################################################
############### The cmake subdirectory ##################
#########################################################
......@@ -890,11 +892,51 @@ mkdir "$PROJECT/cmake"
echo "- $PROJECT/cmake/Makefile.am"
cat> "$PROJECT/cmake/Makefile.am" <<EOF
SUBDIRS = pkg
SUBDIRS = modules
include \$(top_srcdir)/am/global-rules
EOF
############### The cmake subdirectory ##################
#########################################################
mkdir "$PROJECT/cmake/modules"
################# cmake/modules/Makefile.am #####################
macroname=""
for i in $(echo $PROJECT| sed 's/-/ /g'); do
firstchar=$(echo $i | sed 's/\(.\).*/\1/')
macroname=$macroname$(echo $firstchar | tr '[a-z]' '[A-Z]')$(echo $i | sed 's/.\(.*\)/\1/')
done
macroname="$macroname""Macros.cmake"
echo "- $PROJECT/cmake/modules/Makefile.am"
cat> "$PROJECT/cmake/modules/Makefile.am" <<EOF
MODULES = $macroname
modulesdir = $(datadir)/dune/cmake/modules
dist_modules_DATA = \${MODULES}
include \$(top_srcdir)/am/global-rules
EXTRA_DIST = CMakeLists.txt
EOF
################# cmake/modules/Makefile.am #####################
echo "- $PROJECT/cmake/modules/CMakeLists.txt"
cat> "$PROJECT/cmake/modules/CMakeLists.txt" <<EOF
set(modules "$macroname")
install(FILES \${modules} DESTINATION \${DUNE_INSTALL_MODULEDIR})
EOF
################# cmake/modules/$macroname #####################
echo "- $PROJECT/cmake/modules/$macroname"
cat> "$PROJECT/cmake/modules/$macroname" <<EOF
# File for module specific CMake tests.
EOF
################# stamp-regenerate-config-h #####################
echo "- $PROJECT/stamp-regenerate-config-h"
......
......@@ -161,6 +161,38 @@ parse_control() {
fi
}
# Uses the current compiler to extract information about the
# multiarch triplets and sets the export variable MULTIARCH_LIBDIR
# according to it.
# If not compiler is specified then cc or gcc is used.
extract_multiarch_pkg_config_path(){
local my_cxx_compiler
if test "x$MULTIARCH_LIBDIR" != "x"; then
return
fi
set +e #error in the multiarch detection should not be fatal.
$(which cc &>/dev/null)
if test $? -eq "0"; then
my_cxx_compiler=cc
else
my_cxx_compiler=gcc
fi
multiarch=$($my_cxx_compiler --print-multiarch 2>/dev/null)
if test $? -gt 0; then
multiarch=$($my_cxx_compiler -v 2>&1| $GREP target | sed "s/.*target=\([a-z0-9_-]\+\)/\1/")
fi
set -e # set to old value.
export MULTIARCH_LIBDIR="lib/$multiarch"
# create PKG_CONFIG_PATH for installed dune modules
for i in $MULTIARCH_LIBDIR lib64 lib32 lib; do
if test -d "$PREFIX_DIR/$i/pkgconfig"; then
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PREFIX_DIR/$i/pkgconfig"
fi
done
}
#
# try to setup the control path
#
......@@ -180,6 +212,8 @@ setup_control_path() {
DUNE_CONTROL_PATH=$DUNE_CONTROL_PATH:"$i/../dunecontrol"
fi
done
else
DUNE_CONTROL_PATH=$DUNE_CONTROL_PATH:$(pkg-config dune-common --variable=prefix)/lib/dunecontrol
fi
fi
# try to read DUNE_CONTROL_PATH from OPTS file
......
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