From 6cfa13f1365c905fbc14e2f39b3d38eae21ee065 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Fri, 15 Mar 2013 14:53:28 +0100 Subject: [PATCH 1/4] Allow precompiled headers to be enabled from command-line --- configure | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure b/configure index 45ecda87..de1a3091 100755 --- a/configure +++ b/configure @@ -271,6 +271,10 @@ for OPT in "$@"; do # special flag; don't set shared/static shared="" ;; + pch) + pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON" + shared="" + ;; # this flag is just for compatibility with the deprecation # flag in DUNE, so we can build without warnings fieldvector-size-is-method) From 5401df41b573224a8c69a7992747e3586eb63051 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Sat, 16 Mar 2013 21:30:41 +0100 Subject: [PATCH 2/4] Use find modules for libraries with extra processing Some libraries require more information than what is present in the xxx-config.cmake file, e.g. the caller must know whether HAVE_TUPLE is available and probably used when compiling dune-common, and put this in its own config.h file. Code to take care of these variables must therefore be in the client configuration, and this is the same code which is used to handle the autotools version, namely the find module, so a practical solution is to just revert to that in both cases. --- cmake/Modules/OpmFind.cmake | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/cmake/Modules/OpmFind.cmake b/cmake/Modules/OpmFind.cmake index 11f4c2b9..8336ae47 100644 --- a/cmake/Modules/OpmFind.cmake +++ b/cmake/Modules/OpmFind.cmake @@ -51,6 +51,14 @@ foreach (name IN LISTS _opm_proj_vars) endif (NOT DEFINED ${CMAKE_PROJECT_NAME}_${name}) endforeach (name) +# these dependencies must always be handled by the find module +set (_opm_proj_exemptions + dune-common + dune-istl + dune-grid + dune-geometry + ) + # insert this boilerplate whenever we are going to find a new package macro (find_and_append_package_to prefix name) # if we have specified a directory, don't revert to searching the @@ -71,6 +79,28 @@ macro (find_and_append_package_to prefix name) set (${name}_DIR "${${NAME}_ROOT}") endif (EXISTS ${${NAME}_ROOT}/${name}-config.cmake OR EXISTS ${${NAME}_ROOT}/${name}Config.cmake) endif (NOT DEFINED ${name}_DIR AND (DEFINED ${name}_ROOT OR DEFINED ${NAME}_ROOT)) + + # these libraries need special handling which is not provided in + # the -config.cmake file, but which must be provided by this project, + # something which is done in our find module + list (FIND _opm_proj_exemptions "${name}" _${name}_exempted) + if ((NOT (_${name}_exempted EQUAL -1)) AND (DEFINED ${name}_DIR)) + # most often we are given the name to the build directory and this + # is a sub-directory of the source tree + if (${name}_DIR MATCHES "build") + get_filename_component (${name}_ROOT "${${name}_DIR}" PATH) + else (${name}_DIR MATCHES "build") + set (${name}_ROOT "${${name}_DIR}") + endif (${name}_DIR MATCHES "build") + # store this for later, in case we reconfigure + set (${name}_ROOT "${${name}_ROOT}" CACHE LOCATION "Path to ${name}") + # clear this to not use config mode + unset (${name}_DIR) + # variables that are given on the command-line is also put in the cache + # removing the local copy only "unshadows" this one + unset (${name}_DIR CACHE) + endif ((NOT (_${name}_exempted EQUAL -1)) AND (DEFINED ${name}_DIR)) + # using config mode is better than using module (aka. find) mode # because then the package has already done all its probes and # stored them in the config file for us From 4d7752b9805b423a16c3f627ae259207ba9552b2 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Sat, 16 Mar 2013 23:40:09 +0100 Subject: [PATCH 3/4] Don't search for source in build directories --- cmake/Modules/OpmPackage.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/OpmPackage.cmake b/cmake/Modules/OpmPackage.cmake index efeec037..5d9b5977 100644 --- a/cmake/Modules/OpmPackage.cmake +++ b/cmake/Modules/OpmPackage.cmake @@ -85,14 +85,16 @@ macro (find_opm_package module deps header lib defs prog conf) string (TOLOWER "${module}" _module_lower) set (_guess "../${module}" - "../${module}-build" "../${_module_lower}" + ) + set (_guess_bin_only + "../${module}-build" "../${_module_lower}-build" "../../${module}/build-cmake" "../../${_module_lower}/build-cmake" ) set (_guess_bin) - foreach (_item IN ITEMS ${_guess}) + foreach (_item IN ITEMS ${_guess} ${_guess_bin_only}) list (APPEND _guess_bin "${PROJECT_BINARY_DIR}/${_item}") endforeach (_item) endif (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT)) From 040b7adb4e14340d15e05a8e8e40133894e4b362 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Sat, 16 Mar 2013 23:47:43 +0100 Subject: [PATCH 4/4] Search for libraries in dunecontrol's default build dir --- cmake/Modules/OpmPackage.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Modules/OpmPackage.cmake b/cmake/Modules/OpmPackage.cmake index 5d9b5977..b35fa920 100644 --- a/cmake/Modules/OpmPackage.cmake +++ b/cmake/Modules/OpmPackage.cmake @@ -118,7 +118,7 @@ macro (find_opm_package module deps header lib defs prog conf) NAMES "${lib}" PATHS ${_guess_bin} HINTS ${${module}_DIR} ${${module}_ROOT} ${${MODULE}_ROOT} ${PkgConf_${module}_LIBRARY_DIRS} - PATH_SUFFIXES "lib" "lib/.libs" ".libs" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" + PATH_SUFFIXES "lib" "lib/.libs" ".libs" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "build-cmake/lib" ) else (NOT "${lib}" STREQUAL "") set (${module}_LIBRARY "")