diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..5bcabb3 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,281 @@ +# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*- +# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap: + +# key information about the library +set (project "opm-core") +set (${project}_NAME "${project}") +set (${project}_DESCRIPTION "Open Porous Media Initiative Core Library") +set (${project}_DIR "opm") +set (${project}_VERSION_MAJOR 1) +set (${project}_VERSION_MINOR 0) +set (doxy_dir "Documentation") + +# defines that must be present in config.h for our headers +set (${project}_CONFIG_VAR + HAVE_AGMG + HAVE_DUNE_ISTL + HAVE_DYNAMIC_BOOST_TEST + HAVE_ERT + HAVE_SUITESPARSE_UMFPACK_H + HAVE_NULLPTR + HAVE_STATIC_ASSERT + ) + +# dependencies +set (${project}_DEPS + # compile with C99 support if available + "C99" + # compile with C++0x/11 support if available + "CXX11Features" + # various runtime library enhancements + "Boost 1.39.0 + COMPONENTS date_time filesystem system unit_test_framework REQUIRED" + # matrix library + "BLAS REQUIRED" + "LAPACK REQUIRED" + # Tim Davis' SuiteSparse archive + "SuiteSparse COMPONENTS umfpack" + # solver + "SUPERLU" + # xml processing (for config parsing) + "TinyXML" + # Ensembles-based Reservoir Tools (ERT) + "ERT" + # DUNE dependency + "dune-istl" + ) + +# C++ project +cmake_minimum_required (VERSION 2.8) +project (${${project}_NAME}) +enable_language (C) +enable_language (CXX) + +# additional search modules +set (${project}_MODULE_DIR "${PROJECT_SOURCE_DIR}/cmake/Modules") +list (APPEND CMAKE_MODULE_PATH ${${project}_MODULE_DIR}) + +# print system information to better pinpoint issues from log alone +include (UseSystemInfo) +system_info () + +# very early try to print repo id (to pinpoint version if something goes wrong) +include (UseVCSInfo) +vcs_info () + +# include special +if (CMAKE_VERSION VERSION_LESS "2.8.7") + message (STATUS "Enabling backward compatibility modules for CMake ${CMAKE_VERSION}") + list (APPEND CMAKE_MODULE_PATH "${${project}_MODULE_DIR}/compat-2.8.7") +endif (CMAKE_VERSION VERSION_LESS "2.8.7") + +# default settings: build static debug library +include (OpmDefaults) +opm_defaults (${project}) +message (STATUS "Build type: ${CMAKE_BUILD_TYPE}") + +# use tricks to do faster builds +include (UseFastBuilds) + +# precompiled headers +include (UsePrecompHeaders) + +# macro to set standard variables (INCLUDE_DIRS, LIBRARIES etc.) +include (OpmFind) +find_and_append_package_list_to (${project} ${${project}_DEPS}) + +# remove the dependency on the testing framework from the main library; +# it is not possible to query for Boost twice with different components. +list (REMOVE_ITEM ${project}_LIBRARIES ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + +# don't import more libraries than we need to +include (UseOnlyNeeded) + +# put debug information into every executable +include (UseDebugSymbols) + +# optimize full if we're not doing a debug build +include (UseOptimization) + +# turn on all warnings +include (UseWarnings) + +# detect if Boost is in a shared library +include (UseDynamicBoost) + +# needed for Debian installation scheme +include (UseMultiArch) + +# this module contains code to figure out which files is where +include (OpmFiles) +opm_auto_dirs () + +# put libraries in lib/ +opm_out_dirs () + +# identify the compilation units in the library +opm_sources (${project}) + +# enumerate all testing programs in test/ directory +opm_find_tests () + +# tutorial programs are found in the tutorials/ directory +opm_find_tutorials () + +# example programs are found in the examples/ directory +opm_find_examples () + +### --- begin AGMG specific --- ### +# Algebraic Multigrid must be compiled together with our program; +# if it is not available, then remove our corresponding component +find_package (AGMG) +if (AGMG_FOUND) + list (APPEND ${project}_SOURCES ${AGMG_SOURCES}) +endif (AGMG_FOUND) +### --- end AGMG specific --- ### + +### --- begin opm-core specific --- ### +# these solvers are only compiled in if their dependency is found +if (NOT AGMG_FOUND) + list (REMOVE_ITEM opm-core_SOURCES + ${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/linalg/LinearSolverAGMG.cpp + ) +endif (NOT AGMG_FOUND) +if (NOT dune-istl_FOUND) + list (REMOVE_ITEM opm-core_SOURCES + ${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/linalg/LinearSolverIstl.cpp + ) +endif (NOT dune-istl_FOUND) +if (NOT SuiteSparse_FOUND) + list (REMOVE_ITEM opm-core_SOURCES + ${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/linalg/call_umfpack.c + ${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/linalg/LinearSolverUmfpack.cpp + ) + list (REMOVE_ITEM tutorial_SOURCES + ${PROJECT_SOURCE_DIR}/${tutorial_DIR}/tutorial2.cpp + ${PROJECT_SOURCE_DIR}/${tutorial_DIR}/tutorial3.cpp + ${PROJECT_SOURCE_DIR}/${tutorial_DIR}/tutorial4.cpp + ) + list (REMOVE_ITEM examples_SOURCES + ${PROJECT_SOURCE_DIR}/${examples_DIR}/spu_2p.cpp + ) +endif (NOT SuiteSparse_FOUND) + +# these files are provided in source control, but can only compile with Matlab +# available; we are not supposed to include the TinyXML test prog. regardless +list (REMOVE_ITEM opm-core_SOURCES + ${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/grid/cpgpreprocess/mxgrdecl.c + ${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/grid/cpgpreprocess/processgrid.c + ${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/utility/parameters/tinyxml/xmltest.cpp + ) + +# remove inline TinyXML if a system version was found +if (TinyXML_FOUND) + file (GLOB_RECURSE _inline_tinyxml "${opm-core_DIR}/core/utility/parameters/tinyxml/*") + foreach (_file IN LISTS _inline_tinyxml) + list (REMOVE_ITEM opm-core_SOURCES ${_file}) + endforeach (_file) +endif (TinyXML_FOUND) + +# anyhow remove it from the header list (so it doesn't get installed) +list (REMOVE_ITEM opm-core_HEADERS "${opm-core_DIR}/core/utility/parameters/tinyxml/tinystr.h") +list (REMOVE_ITEM opm-core_HEADERS "${opm-core_DIR}/core/utility/parameters/tinyxml/tinyxml.h") + +# HAVE_ERT is used as an #ifdef, not as an #if in the source code, if it +# is not true, then it should be unset altogether +if (NOT HAVE_ERT) + set (HAVE_ERT) + list (REMOVE_ITEM examples_SOURCES + ${PROJECT_SOURCE_DIR}/examples/import_rewrite.cpp + ) +endif (NOT HAVE_ERT) +### --- end opm-core specific --- ### + +# create configuration header which describes available features +# necessary to compile this library. singular version is the names that +# is required by this project alone, plural version transitively +# includes the necessary defines by the dependencies +include (ConfigVars) +list (APPEND ${project}_CONFIG_VARS ${${project}_CONFIG_VAR}) +set (CONFIG_H "${PROJECT_BINARY_DIR}/config.h") +configure_vars ( + FILE CXX ${CONFIG_H} + WRITE ${${project}_CONFIG_VARS} + ) + +include (UseFortranWrappers) +define_fc_func ( + APPEND ${CONFIG_H} + IF HAVE_AGMG # HAVE_BLAS HAVE_LAPACK + ) + +# compile main library; pull in all required includes and libraries +include (OpmCompile) +opm_compile (${project}) + +# installation target: copy the library together with debug and +# configuration files to system directories +include (OpmInstall) +opm_install (${project}) +message (STATUS "This build defaults to installing in ${CMAKE_INSTALL_PREFIX}") + +# installation of CMake modules to help user programs locate the library +include (OpmProject) +opm_cmake_config (${project}) + +# routines to build satellites such as tests, tutorials and samples +include (OpmSatellites) + +# tutorial programs are found in the tutorials/ directory +opm_compile_satellites (${project} tutorial "" "") +opm_compile_satellites (${project} examples "" "") + +# infrastructure for testing +enable_testing () +include (CTest) + +### --- begin opm-core specific --- ### +# conditionally disable tests when features aren't available +macro (cond_disable_test name) + if ((NOT DEFINED HAVE_${name}) OR (NOT HAVE_${name})) + message (STATUS "${name} test disabled, since ${name} is not found.") + string (TOLOWER "${name}" name_lower) + get_filename_component (test_${name}_FILE "tests/test_${name_lower}.cpp" ABSOLUTE) + list (REMOVE_ITEM tests_SOURCES "${test_${name}_FILE}") + endif ((NOT DEFINED HAVE_${name}) OR (NOT HAVE_${name})) +endmacro (cond_disable_test name) +cond_disable_test ("AGMG") +cond_disable_test ("ERT") +### --- end opm-core specific --- ### + +# make datafiles necessary for tests available in output directory +opm_data (tests datafiles "${tests_DIR}" "*.xml") +opm_compile_satellites (${project} tests "" "${tests_REGEXP}") + +# use this target to run all tests +add_custom_target (check + COMMAND ${CMAKE_CTEST_COMMAND} + DEPENDS tests + COMMENT "Checking if library is functional" + VERBATIM + ) + +# generate documentation from source code with Doxygen; +# setup install target for this documentation +include (OpmDoc) +opm_doc (${project} ${doxy_dir}) + +# provide compatibility with using this build in dunecontrol +include (DuneCompat) +include (LibtoolArchives) +configure_la (${project} ${${project}_TARGET} ${project}_LIBTOOL_ARCHIVE) + +### clean in-source builds ### +include (OpmDistClean) +opm_dist_clean (${project}) + +# smart wrapper that auto-parallelizes builds +file (COPY + GNUmakefile + DESTINATION ${PROJECT_BINARY_DIR} + ) diff --git a/CTestConfig.cmake b/CTestConfig.cmake new file mode 100644 index 0000000..3755a10 --- /dev/null +++ b/CTestConfig.cmake @@ -0,0 +1,7 @@ +# this is included after opm-core_NAME is set +set(CTEST_PROJECT_NAME "${${project}_NAME}") +set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "opm-project.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=${${project}_NAME}") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..63889ab --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,43 @@ +# GNUmakefile is processed before Makefile, which is why we arrive here +# first; when we call the other makefile, then we must specify its real +# name with the -f parameter + +# figure out the number of processors from the system, add one and round +# to nearest integer. this is the maximum number of processes we want running +# at the same time (one for each core and one stuck on I/O) +# if we are running this is a VM, then /proc won't be mounted and we revert +# to single CPU processing +CPUINFO:=/proc/cpuinfo +NUM_CPUS:=$(shell test -r $(CPUINFO) && grep -P -c '^processor\t:' $(CPUINFO) || echo 0) +PROCS:=$(shell echo "("$(NUM_CPUS)+1")"/1 | bc) + +# use these utilities if they are available +IONICE:=$(shell test -x "$$(which ionice)" && echo ionice -c2 -n7) +NICE:=$(shell test -x "$$(which nice)" && echo nice) + +# we do dependency management the right way; don't attempt to cache +export CCACHE_DISABLE:=1 + +# ignore that there may be files with these names, we are going to call +# the other make regardless +.PHONY: __everything $(MAKECMDGOALS) + +# outsource the processing to the real makefile, running in parallel and +# in a nice environment so that it doesn't hog our workstation. if there +# is nothing else happening on the box, then it will run just as fast +# the leading plus makes us run this regardless of options, see +# http://www.gnu.org/software/make/manual/make.html#Instead-of-Execution +__everything: +# only put on a parallel flag if there isn't already one; otherwise we +# get the warning "-jN forced in submake: disabling jobserver mode". +# this have to happen inside the rule, because -j option is removed from +# MAKEFLAGS outside + +@$(IONICE) $(NICE) $(MAKE) --no-print-directory -f Makefile $(if $(findstring -j,$(MAKEFLAGS)),,-j $(PROCS)) $(MAKECMDGOALS) + +# automatically generate all the goals we are asked to make and delegate +# processing of them to the real makefile through the dependency (since +# everything depends on the same thing, then we only call the other make +# once). the dummy command is just there to make sure that make doesn't +# show the "Nothing to do for `foo'" message after processing +$(MAKECMDGOALS): __everything + @true diff --git a/cmake/Modules/AddOptions.cmake b/cmake/Modules/AddOptions.cmake new file mode 100644 index 0000000..e1238fc --- /dev/null +++ b/cmake/Modules/AddOptions.cmake @@ -0,0 +1,59 @@ +# - Add options without repeating them on the command line +# +# Synopsis: +# +# add_options (lang build opts) +# +# where: +# +# lang Name of the language whose compiler should receive the +# options, e.g. CXX. If a comma-separated list is received +# then the option is added for all those languages. Use the +# special value ALL_LANGUAGES for these languages: CXX, C +# and Fortran +# +# build Kind of build to which this options should apply, +# such as DEBUG and RELEASE. This can also be a comma- +# separated list. Use the special value ALL_BUILDS to apply +# to all builds. +# +# opts List of options to add. Each should be quoted. +# +# Example: +# +# add_options (CXX RELEASE "-O3" "-DNDEBUG" "-Wall") + +function (add_options langs builds) + # special handling of empty language specification + if ("${langs}" STREQUAL "ALL_LANGUAGES") + set (langs CXX C Fortran) + endif ("${langs}" STREQUAL "ALL_LANGUAGES") + foreach (lang IN LISTS langs) + # prepend underscore if necessary + foreach (build IN LISTS builds) + if (NOT ("${build}" STREQUAL "ALL_BUILDS")) + set (_bld "_${build}") + string (TOUPPER "${_bld}" _bld) + else (NOT ("${build}" STREQUAL "ALL_BUILDS")) + set (_bld "") + endif (NOT ("${build}" STREQUAL "ALL_BUILDS")) + foreach (_opt IN LISTS ARGN) + set (_var "CMAKE_${lang}_FLAGS${_bld}") + #message (STATUS "Adding \"${_opt}\" to \${${_var}}") + # remove it first + string (REPLACE "${_opt}" "" _without "${${_var}}") + string (STRIP "${_without}" _without) + # if it wasn't there, then add it at the end + if ("${_without}" STREQUAL "${${_var}}") + # don't add any extra spaces if no options yet are set + if (NOT ${${_var}} STREQUAL "") + set (${_var} "${${_var}} ${_opt}") + else (NOT ${${_var}} STREQUAL "") + set (${_var} "${_opt}") + endif (NOT ${${_var}} STREQUAL "") + set (${_var} "${${_var}}" PARENT_SCOPE) + endif ("${_without}" STREQUAL "${${_var}}") + endforeach (_opt) + endforeach (build) + endforeach (lang) +endfunction (add_options lang build) diff --git a/cmake/Modules/ConfigVars.cmake b/cmake/Modules/ConfigVars.cmake new file mode 100644 index 0000000..072d2b7 --- /dev/null +++ b/cmake/Modules/ConfigVars.cmake @@ -0,0 +1,110 @@ +# - Create config.h based on a list of variables +# +# Synopsis: +# configure_vars (FILE syntax filename verb varlist) +# where +# syntax CXX or CMAKE, depending on target +# filename Full path (including name) of config.h +# verb WRITE or APPEND if truncating or not +# varlist List of variable names that has been defined +# +# In addition, this function will define HAVE_CONFIG_H for the +# following compilations, (only) if the filename is "config.h". +# +# Example: +# list (APPEND FOO_CONFIG_VARS +# "/* bar library */" +# "HAVE_BAR" +# "HAVE_BAR_VERSION_2" +# ) +# configure_vars ( +# FILE CXX ${PROJECT_BINARY_DIR}/config.h +# WRITE ${FOO_CONFIG_VARS} +# ) + +# Copyright (C) 2012 Uni Research AS +# This file is licensed under the GNU General Public License v3.0 + +function (configure_vars obj syntax filename verb) + # this is just to make the syntax look like the build-in commands + message (STATUS "Writing config file \"${filename}\"...") + if (NOT ("${obj}" STREQUAL "FILE" AND + (("${verb}" STREQUAL "WRITE") OR ("${verb}" STREQUAL "APPEND")))) + message (FATAL_ERROR "Syntax error in argument list") + endif (NOT ("${obj}" STREQUAL "FILE" AND + (("${verb}" STREQUAL "WRITE") OR ("${verb}" STREQUAL "APPEND")))) + if (NOT (("${syntax}" STREQUAL "CXX") OR ("${syntax}" STREQUAL "CMAKE"))) + message (FATAL_ERROR "Invalid target syntax \"${syntax}\"") + endif (NOT (("${syntax}" STREQUAL "CXX") OR ("${syntax}" STREQUAL "CMAKE"))) + + # truncate the file if the verb was "WRITE" + if (verb STREQUAL "WRITE") + file (WRITE "${filename}" "") + endif (verb STREQUAL "WRITE") + + # whenever we use this, we also signal to the header files that we + # have "config.h". add this before any other files (known till now) + # to avoid confusion from other configuration files. + get_filename_component (_config_path "${filename}" PATH) + get_filename_component (_config_file "${filename}" NAME) + if ("${_config_file}" STREQUAL "config.h") + add_definitions (-DHAVE_CONFIG_H=1) + include_directories (BEFORE "${_config_path}") + endif ("${_config_file}" STREQUAL "config.h") + + # only write the current value of each variable once + set (_args ${ARGN}) + if (_args) + list (REMOVE_DUPLICATES _args) + endif (_args) + + # process each variable + set (_prev_verbatim TRUE) + foreach (_var IN LISTS _args) + + # massage the name to remove source code formatting + string (REGEX REPLACE "^[\\n\\t\\ ]+" "" _var "${_var}") + string (REGEX REPLACE "[\\n\\t\\ ]+$" "" _var "${_var}") + + # if the name of a variable has the syntax of a comments, write it + # verbatim to the file; this can be used to create headings + if ("${_var}" MATCHES "^/[/*]") + if (NOT _prev_verbatim) + file (APPEND "${filename}" "\n") + endif (NOT _prev_verbatim) + file (APPEND "${filename}" "${_var}\n") + set (_prev_verbatim TRUE) + + else ("${_var}" MATCHES "^/[/*]") + + # check for empty variable; variables that are explicitly set to false + # is not included in this clause + if ((NOT DEFINED ${_var}) OR ("${${_var}}" STREQUAL "")) + if ("${syntax}" STREQUAL "CMAKE") + file (APPEND "${filename}" "set (${_var})\n") + else ("${syntax}" STREQUAL "CMAKE") + file (APPEND "${filename}" "/* #undef ${_var} */\n") + endif ("${syntax}" STREQUAL "CMAKE") + else ((NOT DEFINED ${_var}) OR ("${${_var}}" STREQUAL "")) + + # integer variables (specifically 0 and 1) are written as they are, + # whereas everything else (including version numbers, which could + # be interpreted as floats) are quoted as strings + if (${_var} MATCHES "[0-9]+") + set (_quoted "${${_var}}") + else (${_var} MATCHES "[0-9]+") + set (_quoted "\"${${_var}}\"") + endif (${_var} MATCHES "[0-9]+") + + # write to file using the correct syntax + if ("${syntax}" STREQUAL "CMAKE") + file (APPEND "${filename}" "set (${_var} ${_quoted})\n") + else ("${syntax}" STREQUAL "CMAKE") + file (APPEND "${filename}" "#define ${_var} ${_quoted}\n") + endif ("${syntax}" STREQUAL "CMAKE") + + endif ((NOT DEFINED ${_var}) OR ("${${_var}}" STREQUAL "")) + set (_prev_verbatim FALSE) + endif ("${_var}" MATCHES "^/[/*]") + endforeach(_var) +endfunction (configure_vars obj syntax filename verb) diff --git a/cmake/Modules/DuneCompat.cmake b/cmake/Modules/DuneCompat.cmake new file mode 100644 index 0000000..baec5eb --- /dev/null +++ b/cmake/Modules/DuneCompat.cmake @@ -0,0 +1,23 @@ +# - Dunecontrol compatibility +# +# Enables this build to be a part of a dunecontrol chain. The +# DUNE_CHECK_MODULES macro greps the top-level Makefile for the +# presence of the abs_top_srcdir variable (!) and uses that as +# the include directory of a module. Also, the contents are not +# checked so if the variable is not present, it generates an +# invalid command line (-I without argument) which causes the +# autoconf probe to fail. This module patches our Makefile (!!) +# so the necessary string will be there; in itself this string +# has no use for us, it is solemnly to satisfy the M4 scripts. + +if (CMAKE_GENERATOR MATCHES "Unix Makefiles") + # we need an up-to-date, patched Makefile. this is always checked when + # the makefile is run, thus the need for a marker file to keep a + # timestamp to see when it was last patched (by us) + # amazingly, nothing depends on the generated Makefile, so this can be + # run whenever in the build without trigging a compile of e.g. config.h + add_custom_target (dune-compat ALL + COMMAND ${CMAKE_COMMAND} -DCMAKE_HOME_DIRECTORY=${CMAKE_HOME_DIRECTORY} -P ${PROJECT_SOURCE_DIR}/cmake/Scripts/DuneCompat2.cmake + COMMENT "Patching Makefile to be DUNE compatible" + ) +endif (CMAKE_GENERATOR MATCHES "Unix Makefiles") diff --git a/cmake/Modules/FindAGMG.cmake b/cmake/Modules/FindAGMG.cmake new file mode 100644 index 0000000..5c16c8a --- /dev/null +++ b/cmake/Modules/FindAGMG.cmake @@ -0,0 +1,44 @@ +# - Find Notay's Algebraic Multigrid Solver +# +# Set the path to the source directory of AGMG in the cache variable +# AGMG_ROOT. +# +# Note the difference between AGMG_DIR and AGMG_ROOT. The former will +# cause find_package to switch to config mode and search for a file +# named agmg-config.cmake, thereby bypassing this module altogether, +# whereas the latter communicates the location of the library to this +# module. +# +# When found, add the contents of AGMG_SOURCES to your own list of +# sources to compile and link for the target. +# +# Use define_fc_func from UseFortranWrappers to write FC_FUNC to your +# own config.h, and declare the function dagmg using this macro. + +find_file (AGMG_SOURCES + dagmg.f90 + PATHS ${AGMG_ROOT} + PATH_SUFFIXES SRC + DOC "Yvan Notay's Algebraic Multigrid Solver, Double Precision version" + NO_DEFAULT_PATH + ) + +# make sure that we can compile Fortran code +if (AGMG_SOURCES) + enable_language (Fortran) +endif (AGMG_SOURCES) + +# set value for config.h +if (AGMG_SOURCES) + set (HAVE_AGMG 1) +else (AGMG_SOURCES) + set (HAVE_AGMG 0) +endif (AGMG_SOURCES) + +# handle REQUIRED and QUIET standard options +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (AGMG + DEFAULT_MSG + AGMG_SOURCES + CMAKE_Fortran_COMPILER_SUPPORTS_F90 + ) diff --git a/cmake/Modules/FindC99.cmake b/cmake/Modules/FindC99.cmake new file mode 100644 index 0000000..1dcbe1e --- /dev/null +++ b/cmake/Modules/FindC99.cmake @@ -0,0 +1,25 @@ +# - Module that checks for supported C99 features. + +# macro to only add option once +include (AddOptions) + +# try to use compiler flag -std=c99 +set (C_STD99_FLAGS "-std=c99") + +# incidently, the C++ test is so simple that it can be used to compile C as well +include (CheckCCompilerFlag) +check_c_compiler_flag (${C_STD99_FLAGS} HAVE_C99) + +# add option if we are capable +if (HAVE_C99) + add_options (C ALL_BUILDS "${C_STD99_FLAGS}") +else (HAVE_C99) + set (C_STD99_FLAGS) +endif (HAVE_C99) + +# handle quiet and required +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (C99 + DEFAULT_MSG + C_STD99_FLAGS + ) diff --git a/cmake/Modules/FindCXX11Features.cmake b/cmake/Modules/FindCXX11Features.cmake new file mode 100644 index 0000000..119e304 --- /dev/null +++ b/cmake/Modules/FindCXX11Features.cmake @@ -0,0 +1,260 @@ +# +# Module that checks for supported C++11 (former C++0x) features. +# +# Sets the follwing variable: +# +# HAVE_NULLPTR True if nullptr is available +# HAVE_ARRAY True if header and fill() are available +# HAVE_ATTRIBUTE_ALWAYS_INLINE True if attribute always inline is supported +# HAS_ATTRIBUTE_UNUSED True if attribute unused is supported +# HAS_ATTRIBUTE_DEPRECATED True if attribute deprecated is supported +# HAS_ATTRIBUTE_DEPRECATED_MSG True if attribute deprecated("msg") is supported +# HAVE_INTEGRAL_CONSTANT True if compiler supports integral_constant +# HAVE_STATIC_ASSERT True if static_assert is available +# HAVE_VARIADIC_TEMPLATES True if variadic templates are supprt +# HAVE_VARIADIC_CONSTRUCTOR_SFINAE True if variadic constructor sfinae is supported +# HAVE_RVALUE_REFERENCES True if rvalue references are supported + +# test for C++11 flags +include(TestCXXAcceptsFlag) + +# macro to only add option once +include(AddOptions) + +# try to use compiler flag -std=c++11 +CHECK_CXX_ACCEPTS_FLAG("-std=c++11" CXX_FLAG_CXX11) +if(CXX_FLAG_CXX11) + add_options (CXX ALL_BUILDS "-std=c++11") + set(CXX_STD0X_FLAGS "-std=c++11") +else() + # try to use compiler flag -std=c++0x for older compilers + CHECK_CXX_ACCEPTS_FLAG("-std=c++0x" CXX_FLAG_CXX0X) + if(CXX_FLAG_CXX0X) + add_options (CXX ALL_BUILDS "-std=c++0x") + set(CXX_STD0X_FLAGS "-std=c++0x") + endif(CXX_FLAG_CXX0X) +endif(CXX_FLAG_CXX11) + +# perform tests +include(CheckCXXSourceCompiles) + +# nullptr +CHECK_CXX_SOURCE_COMPILES(" + int main(void) + { + char* ch = nullptr; + return 0; + } +" HAVE_NULLPTR +) + +# array and fill +CHECK_CXX_SOURCE_COMPILES(" + #include + + int main(void) + { + std::array a; + a.fill(9); + return 0; + } +" HAVE_ARRAY +) + +# Check whether if std::integral_constant< T, v > is supported and casts into T +CHECK_CXX_SOURCE_COMPILES(" + #include + void f( int ){} + + int main(void){ + f( std::integral_constant< int, 42 >() ); + } +" HAVE_INTEGRAL_CONSTANT +) + +# __attribute__((always_inline)) +CHECK_CXX_SOURCE_COMPILES(" + void __attribute__((always_inline)) foo(void) {} + int main(void) + { + foo(); + return 0; + }; +" HAVE_ATTRIBUTE_ALWAYS_INLINE +) + +# __attribute__((unused)) +CHECK_CXX_SOURCE_COMPILES(" + int main(void) + { + int __attribute__((unused)) foo; + return 0; + }; +" HAS_ATTRIBUTE_UNUSED +) + +# __attribute__((deprecated)) +CHECK_CXX_SOURCE_COMPILES(" +#define DEP __attribute__((deprecated)) + class bar + { + bar() DEP; + }; + + class peng { } DEP; + + template + class t_bar + { + t_bar() DEP; + }; + + template + class t_peng { + t_peng() {}; + } DEP; + + void foo() DEP; + + void foo() {}; + + int main(void) + { + return 0; + }; +" HAS_ATTRIBUTE_DEPRECATED +) + +# __attribute__((deprecated("msg"))) +CHECK_CXX_SOURCE_COMPILES(" +#define DEP __attribute__((deprecated(\"message\"))) + class bar { + bar() DEP; + }; + + class peng { } DEP; + + template + class t_bar + { + t_bar() DEP; + }; + + template + class t_peng + { + t_peng() {}; + } DEP; + + void foo() DEP; + + void foo() {}; + + int main(void) + { + return 0; + }; +" HAS_ATTRIBUTE_DEPRECATED_MSG +) + +# static assert +CHECK_CXX_SOURCE_COMPILES(" + int main(void) + { + static_assert(true,\"MSG\"); + return 0; + } +" HAVE_STATIC_ASSERT +) + +# variadic template support +CHECK_CXX_SOURCE_COMPILES(" + #include + + template + int addints(T... x); + + int add_ints() + { + return 0; + } + + template + int add_ints(T1 t1, T... t) + { + return t1 + add_ints(t...); + } + + int main(void) + { + assert( 5 == add_ints(9,3,-5,-2) ); + return 0; + } +" HAVE_VARIADIC_TEMPLATES +) + +# SFINAE on variadic template constructors within template classes +CHECK_CXX_SOURCE_COMPILES(" + #include + + template + struct A + { + template::type + > + A(T... t) + : i(1) + {} + + template= 2)>::type, + typename = void + > + A(T... t) + : i(-1) + {} + + A() + : i(1) + {} + + int i; + }; + + int main(void) + { + return (A().i + A(2).i + A(\"foo\",3.4).i + A(8,'a',A()).i == 0 ? 0 : 1); + } +" HAVE_VARIADIC_CONSTRUCTOR_SFINAE +) + +# rvalue references +CHECK_CXX_SOURCE_COMPILES(" + #include + #include + int foo(int&& x) { return 1; } + int foo(const int& x) { return -1; } + + template + int forward(T&& x) + { + return foo(std::forward(x)); + } + + int main(void) + { + int i = 0; + assert( forward(i) + forward(int(2)) == 0); + return 0; + } +" HAVE_RVALUE_REFERENCES +) +include(CheckIncludeFile) +include(CheckIncludeFileCXX) +# Search for some tr1 headers +foreach(_HEADER tuple tr1/tuple type_traits tr1/type_traits) + string(REPLACE "/" "_" _HEADER_VAR ${_HEADER}) + string(TOUPPER ${_HEADER_VAR} _HEADER_VAR ) + check_include_file_cxx(${_HEADER} "HAVE_${_HEADER_VAR}") +endforeach(_HEADER tuple tr1/tuple tr1/type_traits) diff --git a/cmake/Modules/FindERT.cmake b/cmake/Modules/FindERT.cmake new file mode 100644 index 0000000..8e789ac --- /dev/null +++ b/cmake/Modules/FindERT.cmake @@ -0,0 +1,209 @@ +# - Find the Ensemble-based Reservoir Tool (ERT) +# +# Set the cache variable ERT_ROOT to the install location of the ERT +# libraries and header files. +# +# If found, it sets these variables: +# +# ERT_INCLUDE_DIRS Header file directories +# ERT_LIBRARIES Archives and shared objects +# ERT_CONFIG_VARS Definitions that goes in config.h +# ERT_LINKER_FLAGS Options that must be passed to linker +# +# It will also add to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS if necessary to +# link with the ERT libraries. + +# variables to pass on to other packages +if (FIND_QUIETLY) + set (ERT_QUIET "QUIET") +else (FIND_QUIETLY) + set (ERT_QUIET "") +endif (FIND_QUIETLY) + +# ERT doesn't have any config-mode file, so we need to specify the root +# directory in its own variable +find_path (ERT_ECL_INCLUDE_DIR + NAMES "ert/ecl/ecl_util.h" + HINTS "${ERT_ROOT}" + PATHS "../ert" + PATH_SUFFIXES "devel/libecl/include/" "include" + DOC "Path to ERT Eclipse library header files" + ) +find_path (ERT_UTIL_INCLUDE_DIR + NAMES "ert/util/stringlist.h" + HINTS "${ERT_ROOT}" + PATHS "../ert" + PATH_SUFFIXES "devel/libert_util/include/" "include" + DOC "Path to ERT Eclipse library header files" + ) +find_path (ERT_GEN_INCLUDE_DIR + NAMES "ert/util/int_vector.h" + HINTS "${ERT_ROOT}" + PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build" + "${PROJECT_BINARY_DIR}/../ert/devel" + PATH_SUFFIXES "libert_util/include/" "include" + DOC "Path to ERT generated library header files" + ) + +# need all of these libraries +find_library (ERT_LIBRARY_ECL + NAMES "ecl" + HINTS "${ERT_ROOT}" + PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build" + "${PROJECT_BINARY_DIR}/../ert/devel" + PATH_SUFFIXES "lib" "lib64" "lib32" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" + DOC "Path to ERT Eclipse library archive/shared object files" + ) +find_library (ERT_LIBRARY_GEOMETRY + NAMES "ert_geometry" + HINTS "${ERT_ROOT}" + PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build" + "${PROJECT_BINARY_DIR}/../ert/devel" + PATH_SUFFIXES "lib" "lib64" "lib32" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" + DOC "Path to ERT Geometry library archive/shared object files" + ) +find_library (ERT_LIBRARY_UTIL + NAMES "ert_util" + HINTS "${ERT_ROOT}" + PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build" + "${PROJECT_BINARY_DIR}/../ert/devel" + PATH_SUFFIXES "lib" "lib64" "lib32" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" + DOC "Path to ERT Utilities library archive/shared object files" + ) +# the "library" found here is actually a list of several files +list (APPEND ERT_INCLUDE_DIR + ${ERT_ECL_INCLUDE_DIR} + ${ERT_UTIL_INCLUDE_DIR} + ${ERT_GEN_INCLUDE_DIR} + ) +list (APPEND ERT_LIBRARY + ${ERT_LIBRARY_ECL} + ${ERT_LIBRARY_GEOMETRY} + ${ERT_LIBRARY_UTIL} + ) +list (APPEND ERT_LIBRARIES ${ERT_LIBRARY}) +list (APPEND ERT_INCLUDE_DIRS ${ERT_INCLUDE_DIR}) + +# these system variables are probed for, and used in HEADER files (sic) +list (APPEND ERT_CONFIG_VARS + HAVE_ISFINITE + HAVE_GLOB + HAVE_FORK + HAVE_GETUID + HAVE_LOCKF + HAVE_OPENDIR + HAVE_PROC + HAVE_READLINKAT + HAVE_SYMLINK + HAVE_VA_COPY + ) +include (CheckSymbolExists) +include (CheckFunctionExists) +check_symbol_exists (isfinite math.h HAVE_ISFINITE) +check_function_exists (glob HAVE_GLOB) +check_function_exists (fork HAVE_FORK) +check_function_exists (getuid HAVE_GETUID) +check_function_exists (lockf HAVE_LOCKF) +check_function_exists (opendir HAVE_OPENDIR) +check_function_exists (readlinkat HAVE_READLINKAT) +check_function_exists (symlink HAVE_SYMLINK) +check_symbol_exists (va_copy stdarg.h HAVE_VA_COPY) + +if (UNIX) + set (HAVE_PROC 1) +else (UNIX) + set (HAVE_PROC) +endif (UNIX) + +# dependencies + +# parallel programming +# enabling OpenMP is supposedly enough to make the compiler link with +# the appropriate libraries +find_package (OpenMP ${ERT_QUIET}) +list (APPEND ERT_LIBRARIES ${OpenMP_LIBRARIES}) +if (OPENMP_FOUND) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") +endif (OPENMP_FOUND) + +# threading library (search for this *after* OpenMP +set (CMAKE_THREAD_PREFER_PTHREAD TRUE) +find_package (Threads ${ERT_QUIET}) +if (CMAKE_USE_PTHREADS_INIT) + list (APPEND ERT_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) +endif (CMAKE_USE_PTHREADS_INIT) + +# compression library +find_package (ZLIB ${ERT_QUIET}) +if (ZLIB_FOUND) + list (APPEND ERT_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) + list (APPEND ERT_LIBRARIES ${ZLIB_LIBRARIES}) +endif (ZLIB_FOUND) + +# numerics +find_package (BLAS ${ERT_QUIET}) +if (BLAS_FOUND) + list (APPEND ERT_INCLUDE_DIRS ${BLAS_INCLUDE_DIRS}) + list (APPEND ERT_LIBRARIES ${BLAS_LIBRARIES}) + list (APPEND ERT_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) +endif (BLAS_FOUND) +find_package (LAPACK ${ERT_QUIET}) +if (LAPACK_FOUND) + list (APPEND ERT_INCLUDE_DIRS ${LAPACK_INCLUDE_DIRS}) + list (APPEND ERT_LIBRARIES ${LAPACK_LIBRARIES}) + list (APPEND ERT_LINKER_FLAGS ${LAPACK_LINKER_FLAGS}) +endif (LAPACK_FOUND) + +# math library (should exist on all unices; automatically linked on Windows) +if (UNIX) + find_library (MATH_LIBRARY + NAMES "m" + ) + list (APPEND ERT_LIBRARIES ${MATH_LIBRARY}) +endif (UNIX) + +# since OpenMP often implies pthreads, we need to tidy up +# (last instance of library must be left standing, thus reversing that +# list before removing duplicates) +if (ERT_INCLUDE_DIRS) + list (REMOVE_DUPLICATES ERT_INCLUDE_DIRS) +endif (ERT_INCLUDE_DIRS) +if (ERT_LIBRARIES) + list (REVERSE ERT_LIBRARIES) + list (REMOVE_DUPLICATES ERT_LIBRARIES) + list (REVERSE ERT_LIBRARIES) +endif (ERT_LIBRARIES) + +# linker flags may not be specified at all +if (DEFINED ERT_LINKER_FLAGS) + list (REMOVE_DUPLICATES ERT_LINKER_FLAGS) +endif (DEFINED ERT_LINKER_FLAGS) + +# see if we can compile a minimum example +# CMake logical test doesn't handle lists (sic) +if (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")) + include (CMakePushCheckState) + include (CheckCSourceCompiles) + cmake_push_check_state () + set (CMAKE_REQUIRED_INCLUDES ${ERT_INCLUDE_DIR}) + set (CMAKE_REQUIRED_LIBRARIES ${ERT_LIBRARIES}) + check_c_source_compiles ( + "#include +int main (void) { + int sz; + sz = ecl_util_get_sizeof_ctype (ECL_INT_TYPE); + return 0; +}" HAVE_ERT) + cmake_pop_check_state () +else (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")) + set (HAVE_ERT 0) +endif (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")) + +# if the test program didn't compile, but was required to do so, bail +# out now and display an error; otherwise limp on +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (ERT + DEFAULT_MSG + ERT_INCLUDE_DIR ERT_LIBRARY HAVE_ERT + ) diff --git a/cmake/Modules/FindSUPERLU.cmake b/cmake/Modules/FindSUPERLU.cmake new file mode 100644 index 0000000..a1785e3 --- /dev/null +++ b/cmake/Modules/FindSUPERLU.cmake @@ -0,0 +1,162 @@ +# +# Module that checks whether SuperLU is available and usable. +# SuperLU must be a version released after the year 2005. +# +# Variables used by this module which you may want to set: +# SUPERLU_PREFIX Path list to search for SuperLU +# +# Sets the follwing variable: +# +# SUPERLU_FOUND True if SuperLU available and usable. +# SUPERLU_MIN_VERSION_4_3 True if SuperLU version >= 4.3. +# SUPERLU_POST_2005_VERSION True if SuperLU is from post-2005 +# SUPERLU_WITH_VERSION Human readable string containing version information. +# SUPERLU_INCLUDE_DIRS Path to the SuperLU include dirs. +# SUPERLU_LIBRARIES Name to the SuperLU library. +# + +# adds SuperLU flags to the targets +function(add_dune_superlu_flags _targets) + if(SUPERLU_FOUND) + foreach(_target ${_targets}) + target_link_libraries(${_target} ${SUPERLU_DUNE_LIBRARIES}) + get_target_property(_props ${_target} COMPILE_FLAGS) + string(REPLACE "_props-NOTFOUND" "" _props "${_props}") + set_target_properties(${_target} PROPERTIES COMPILE_FLAGS + "${_props} ${SUPERLU_DUNE_COMPILE_FLAGS} -DENABLE_SUPERLU=1") + endforeach(_target ${_targets}) + endif(SUPERLU_FOUND) +endfunction(add_dune_superlu_flags) + +# look for BLAS +find_package(BLAS QUIET REQUIRED) +if(NOT BLAS_FOUND) + message(WARNING "SuperLU requires BLAS which was not found, skipping the test.") + return() +endif(NOT BLAS_FOUND) + +# look for header files, only at positions given by the user +find_path(SUPERLU_INCLUDE_DIR + NAMES supermatrix.h + PATHS ${SUPERLU_PREFIX} + PATH_SUFFIXES "superlu" "include/superlu" "include" "SRC" + NO_DEFAULT_PATH +) + +# look for header files, including default paths +find_path(SUPERLU_INCLUDE_DIR + NAMES supermatrix.h + PATH_SUFFIXES "superlu" "include/superlu" "include" "SRC" +) + +# look for library, only at positions given by the user +find_library(SUPERLU_LIBRARY + NAMES "superlu_4.3" "superlu_4.2" "superlu_4.1" "superlu_4.0" "superlu_3.1" "superlu_3.0" "superlu" + PATHS ${SUPERLU_PREFIX} + PATH_SUFFIXES "lib" "lib32" "lib64" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" + NO_DEFAULT_PATH +) + +# look for library files, including default paths +find_library(SUPERLU_LIBRARY + NAMES "superlu_4.3" "superlu_4.2" "superlu_4.1" "superlu_4.0" "superlu_3.1" "superlu_3.0" "superlu" + PATH_SUFFIXES "lib" "lib32" "lib64" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" +) + +# check version specific macros +include(CheckCSourceCompiles) +include(CMakePushCheckState) +cmake_push_check_state() + +# we need if clauses here because variable is set variable-NOTFOUND +# if the searches above were not successful +# Without them CMake print errors like: +# "CMake Error: The following variables are used in this project, but they are set to NOTFOUND. +# Please set them or make sure they are set and tested correctly in the CMake files:" +# +if(SUPERLU_INCLUDE_DIR) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${SUPERLU_INCLUDE_DIR}) +endif(SUPERLU_INCLUDE_DIR) +if(SUPERLU_LIBRARY) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${SUPERLU_LIBRARY}) +endif(SUPERLU_LIBRARY) +if(BLAS_LIBRARIES) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${BLAS_LIBRARIES}) +endif(BLAS_LIBRARIES) +# check whether "mem_usage_t.expansions" was found in "slu_ddefs.h" +CHECK_C_SOURCE_COMPILES(" +#include +int main(void) +{ + mem_usage_t mem; + return mem.expansions; +}" +HAVE_MEM_USAGE_T_EXPANSIONS) + +# check whether version is at least 4.3 +CHECK_C_SOURCE_COMPILES(" +#include +int main(void) +{ + return SLU_DOUBLE; +}" +SUPERLU_MIN_VERSION_4_3) + +# check whether version is at least post-2005 +CHECK_C_SOURCE_COMPILES(" +#include +int main(void) +{ + GlobalLU_t g; + return 0; +}" +SUPERLU_POST_2005_VERSION) +cmake_pop_check_state() + +if(SUPERLU_MIN_VERSION_4_3) + set(SUPERLU_WITH_VERSION "SuperLU >= 4.3" CACHE STRING + "Human readable string containing SuperLU version information.") +else() + set(SUPERLU_WITH_VERSION "SuperLU <= 4.2, post 2005" CACHE STRING + "Human readable string containing SuperLU version information.") +endif(SUPERLU_MIN_VERSION_4_3) + +# behave like a CMake module is supposed to behave +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + "SuperLU" + DEFAULT_MSG + SUPERLU_INCLUDE_DIR + SUPERLU_LIBRARY +) + +mark_as_advanced(SUPERLU_INCLUDE_DIR SUPERLU_LIBRARY) + +# if both headers and library are found, store results +if(SUPERLU_FOUND) + set(SUPERLU_INCLUDE_DIRS ${SUPERLU_INCLUDE_DIR}) + set(SUPERLU_LIBRARIES ${SUPERLU_LIBRARY} ${BLAS_LIBRARIES}) + set(SUPERLU_DEFINITIONS "-DENABLE_SUPERLU=1") + # log result + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determing location of ${SUPERLU_WITH_VERSION} succeded:\n" + "Include directory: ${SUPERLU_INCLUDE_DIRS}\n" + "Library directory: ${SUPERLU_LIBRARIES}\n\n") + set(SUPERLU_DUNE_COMPILE_FLAGS "-I${SUPERLU_INCLUDE_DIRS}" + CACHE STRING "Compile flags used by DUNE when compiling SuperLU programs") + set(SUPERLU_DUNE_LIBRARIES ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES} + CACHE STRING "Libraries used by DUNE when linking SuperLU programs") +else(SUPERLU_FOUND) + # log errornous result + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determing location of SuperLU failed:\n" + "Include directory: ${SUPERLU_INCLUDE_DIRS}\n" + "Library directory: ${SUPERLU_LIBRARIES}\n\n") +endif(SUPERLU_FOUND) + +# set HAVE_SUPERLU for config.h +if(SUPERLU_FOUND) + set(HAVE_SUPERLU 1) +else(SUPERLU_FOUND) + set(HAVE_SUPERLU 0) +endif(SUPERLU_FOUND) diff --git a/cmake/Modules/FindSuiteSparse.cmake b/cmake/Modules/FindSuiteSparse.cmake new file mode 100644 index 0000000..fb7a4f7 --- /dev/null +++ b/cmake/Modules/FindSuiteSparse.cmake @@ -0,0 +1,259 @@ +# - Find Tim Davis' SuiteSparse collection of sparse matrix libraries +# +# Synopsis: +# find_package (SuiteSparse COMPONENTS ) +# +# Components are: +# amd Approximate Minimum Degree ordering +# camd Constrained Approximate Minimum Degree ordering +# colamd COLumn Approximate Minimum Degree ordering +# ccolamd Constrained COLumn Approximate Minimum Degree ordering +# cholmod Supernodal sparse Cholesky factorization and update +# umfpack Unsymmetric MultiFrontal sparse LU factorization +# +# The following variables will be set: +# +# SuiteSparse_FOUND True if all dependencies are satisfied +# SuiteSparse_Xxx_FOUND True if module Xxx is found +# HAVE_SUITESPARSE_Xxx_H Binary value indicating presence of header +# SuiteSparse_INCLUDE_DIRS Paths containing the SuiteSparse header files +# SuiteSparse_LIBRARIES Name of the libraries which must be linked +# SuiteSparse_DEFINITIONS Defines that must be passed to the compiler +# SuiteSparse_LINKER_FLAGS Options that must be passed when linking +# +# See . + +# Copyright (C) 2012 Uni Research AS +# This file is licensed under the GNU General Public License v3.0 + +function (try_compile_umfpack varname) + include (CMakePushCheckState) + include (CheckCSourceCompiles) + cmake_push_check_state () + set (CMAKE_REQUIRED_INCLUDES ${UMFPACK_INCLUDE_DIRS}) + set (CMAKE_REQUIRED_LIBRARIES ${UMFPACK_LIBRARY} ${ARGN} ${SuiteSparse_EXTRA_LIBS}) + check_c_source_compiles ( + "#include +int main (void) { + void *Symbolic, *Numeric; + double Info[UMFPACK_INFO], Control[UMFPACK_CONTROL]; + umfpack_dl_defaults(Control); + umfpack_dl_symbolic(0, 0, 0, 0, 0, + &Symbolic, Control, Info); + umfpack_dl_numeric (0, 0, 0, + Symbolic, &Numeric, Control, Info); + umfpack_dl_free_symbolic(&Symbolic); + umfpack_dl_solve(UMFPACK_A, 0, 0, 0, 0, 0, + Numeric, Control, Info); + umfpack_dl_free_numeric(&Numeric); + umfpack_timer (); + return 0; +}" ${varname}) + cmake_pop_check_state () + set (${varname} "${${varname}}" PARENT_SCOPE) +endfunction (try_compile_umfpack varname) + +# variables to pass on to other packages +if (FIND_QUIETLY) + set (SuiteSparse_QUIET "QUIET") +else (FIND_QUIETLY) + set (SuiteSparse_QUIET "") +endif (FIND_QUIETLY) + +# we need to link to BLAS and LAPACK +if (NOT BLAS_FOUND) + find_package (BLAS ${SuiteSparse_QUIET} REQUIRED) +endif (NOT BLAS_FOUND) +if (NOT LAPACK_FOUND) + find_package (LAPACK ${SuiteSparse_QUIET} REQUIRED) +endif (NOT LAPACK_FOUND) +set (SuiteSparse_EXTRA_LIBS ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}) + +# search paths for the library outside of standard system paths. these are the +# paths in which the package managers on various distros put the files +list (APPEND SuiteSparse_SEARCH_PATH "/usr") # Linux +list (APPEND SuiteSparse_SEARCH_PATH "/opt/local") # MacOS X + +# pick up paths from the environment if specified there; these replace the +# pre-defined paths so that we don't accidentially pick up old stuff +if (NOT $ENV{SuiteSparse_DIR} STREQUAL "") + set (SuiteSparse_SEARCH_PATH "$ENV{SuiteSparse_DIR}") +endif (NOT $ENV{SuiteSparse_DIR} STREQUAL "") +if (${SuiteSparse_DIR}) + set (SuiteSparse_SEARCH_PATH "${SuiteSparse_DIR}") +endif (${SuiteSparse_DIR}) +# CMake uses _DIR suffix as default for config-mode files; it is unlikely +# that we are building SuiteSparse ourselves; use _ROOT suffix to specify +# location to pre-canned binaries +if (NOT $ENV{SuiteSparse_ROOT} STREQUAL "") + set (SuiteSparse_SEARCH_PATH "$ENV{SuiteSparse_ROOT}") +endif (NOT $ENV{SuiteSparse_ROOT} STREQUAL "") +if (${SuiteSparse_ROOT}) + set (SuiteSparse_SEARCH_PATH "${SuiteSparse_ROOT}") +endif (${SuiteSparse_ROOT}) + +# transitive closure of dependencies; after this SuiteSparse_MODULES is the +# full list of modules that must be found to satisfy the user's link demands +set (SuiteSparse_MODULES ${SuiteSparse_FIND_COMPONENTS}) +list (FIND SuiteSparse_MODULES "umfpack" UMFPACK_DESIRED) +if (NOT UMFPACK_DESIRED EQUAL -1) + list (APPEND SuiteSparse_MODULES amd cholmod) +endif (NOT UMFPACK_DESIRED EQUAL -1) +list (FIND SuiteSparse_MODULES "cholmod" CHOLMOD_DESIRED) +if (NOT CHOLMOD_DESIRED EQUAL -1) + list (APPEND SuiteSparse_MODULES amd camd colamd) +endif (NOT CHOLMOD_DESIRED EQUAL -1) +if (SuiteSparse_MODULES) + list (REMOVE_DUPLICATES SuiteSparse_MODULES) +endif (SuiteSparse_MODULES) + +# if someone else already have found all the packages for us, then don't do anything +set (SuiteSparse_EVERYTHING_FOUND TRUE) +foreach (module IN LISTS SuiteSparse_MODULES) + string (TOUPPER ${module} MODULE) + if (NOT SuiteSparse_${MODULE}_FOUND) + set (SuiteSparse_EVERYTHING_FOUND FALSE) + break () + endif (NOT SuiteSparse_${MODULE}_FOUND) +endforeach (module) +if (SuiteSparse_EVERYTHING_FOUND) + return () +endif (SuiteSparse_EVERYTHING_FOUND) + +# if SuiteSparse >= 4.0 we must also link with libsuitesparseconfig +# assume that this is the case if we find the library; otherwise just +# ignore it (older versions don't have a file named like this) +find_library (config_LIBRARY + NAMES suitesparseconfig + PATHS ${SuiteSparse_SEARCH_PATH} + PATH_SUFFIXES ".libs" "lib" "lib32" "lib64" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib/ufsparse" + ) +if (config_LIBRARY) + list (APPEND SuiteSparse_EXTRA_LIBS ${config_LIBRARY}) + # POSIX.1-2001 REALTIME portion require us to link this library too for + # clock_gettime() which is used by suitesparseconfig + if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + list (APPEND SuiteSparse_EXTRA_LIBS "-lrt") + endif ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") +endif (config_LIBRARY) + +# search filesystem for each of the module individually +foreach (module IN LISTS SuiteSparse_MODULES) + string (TOUPPER ${module} MODULE) + # search for files which implements this module + find_path (${MODULE}_INCLUDE_DIR + NAMES ${module}.h + PATHS ${SuiteSparse_SEARCH_PATH} + PATH_SUFFIXES "include" "include/suitesparse" "include/ufsparse" + ) + find_library (${MODULE}_LIBRARY + NAMES ${module} + PATHS ${SuiteSparse_SEARCH_PATH} + PATH_SUFFIXES "lib/.libs" "lib" "lib32" "lib64" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib/ufsparse" + ) + # start out by including the module itself; other dependencies will be added later + set (${MODULE}_INCLUDE_DIRS ${${MODULE}_INCLUDE_DIR}) + set (${MODULE}_LIBRARIES ${${MODULE}_LIBRARY}) +endforeach (module) + +# insert any inter-modular dependencies here +if (CHOLMOD_LIBRARY) + list (APPEND CHOLMOD_LIBRARIES ${AMD_LIBRARIES} ${COLAMD_LIBRARIES}) + # optional libraries; don't insert any -NOT_FOUND paths + if (CAMD_LIBRARY) + list (APPEND CHOLMOD_LIBRARIES ${CAMD_LIBRARIES}) + endif (CAMD_LIBRARY) + if (CCOLAMD_LIBRARY) + list (APPEND CHOLMOD_LIBRARIES ${CCOLAMD_LIBRARIES}) + endif (CCOLAMD_LIBRARY) + list (REVERSE CHOLMOD_LIBRARIES) + # always remove the *first* library from the list + list (REMOVE_DUPLICATES CHOLMOD_LIBRARIES) + list (REVERSE CHOLMOD_LIBRARIES) +endif (CHOLMOD_LIBRARY) +if (UMFPACK_LIBRARY) + set (UMFPACK_EXTRA_LIBS) + # test if umfpack is usable with only amd and not cholmod + try_compile_umfpack (HAVE_UMFPACK_WITHOUT_CHOLMOD ${AMD_LIBRARIES}) + if (HAVE_UMFPACK_WITHOUT_CHOLMOD) + list (APPEND UMFPACK_EXTRA_LIBS ${AMD_LIBRARIES}) + else (HAVE_UMFPACK_WITHOUT_CHOLMOD) + try_compile_umfpack (HAVE_UMFPACK_WITH_CHOLMOD ${CHOLMOD_LIBRARIES}) + if (HAVE_UMFPACK_WITH_CHOLMOD) + list (APPEND UMFPACK_EXTRA_LIBS ${CHOLMOD_LIBRARIES}) + else (HAVE_UMFPACK_WITH_CHOLMOD) + set (UMFPACK_EXTRA_LIBS "-NOTFOUND") + endif (HAVE_UMFPACK_WITH_CHOLMOD) + endif (HAVE_UMFPACK_WITHOUT_CHOLMOD) + # test if umfpack is underlinked (CentOS 5.9), i.e. doesn't specify + # that it depends on amd. in that case, force amd to be linked + if ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC) + try_compile_umfpack (HAVE_UMFPACK_NOT_UNDERLINKED "-Wl,--as-needed" ${UMFPACK_EXTRA_LIBS}) + if (NOT HAVE_UMFPACK_NOT_UNDERLINKED) + list (APPEND UMFPACK_LINKER_FLAGS "-Wl,--no-as-needed") + endif (NOT HAVE_UMFPACK_NOT_UNDERLINKED) + endif ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC) + list (APPEND UMFPACK_LIBRARIES ${UMFPACK_EXTRA_LIBS}) + list (REVERSE UMFPACK_LIBRARIES) + list (REMOVE_DUPLICATES UMFPACK_LIBRARIES) + list (REVERSE UMFPACK_LIBRARIES) +endif (UMFPACK_LIBRARY) + +# don't reset these sets; if two packages request SuiteSparse with +# different modules, we want the sets to be merged +#set (SuiteSparse_LIBRARIES "") +#set (SuiteSparse_INCLUDE_DIRS "") + +# determine which modules were found based on whether all dependencies +# were satisfied; create a list of ALL modules (specified) that was found +# (to be included in one swoop in CMakeLists.txt) +set (SuiteSparse_FOUND TRUE) +foreach (module IN LISTS SuiteSparse_FIND_COMPONENTS) + string (TOUPPER ${module} MODULE) + set (SuiteSparse_${MODULE}_FOUND TRUE) + foreach (file IN LISTS ${MODULE}_INCLUDE_DIRS ${MODULE}_LIBRARIES) + if (NOT EXISTS ${file}) + set (SuiteSparse_${MODULE}_FOUND FALSE) + endif (NOT EXISTS ${file}) + endforeach (file) + if (NOT SuiteSparse_${MODULE}_FOUND) + set (SuiteSparse_FOUND FALSE) + set (HAVE_SUITESPARSE_${MODULE}_H 0 CACHE INT "Is ${module} header present?") + else (NOT SuiteSparse_${MODULE}_FOUND) + set (HAVE_SUITESPARSE_${MODULE}_H 1 CACHE INT "Is ${module} header present?") + list (APPEND SuiteSparse_LIBRARIES "${${MODULE}_LIBRARIES}") + list (APPEND SuiteSparse_LINKER_FLAGS "${${MODULE}_LINKER_FLAGS}") + list (APPEND SuiteSparse_INCLUDE_DIRS "${${MODULE}_INCLUDE_DIRS}") + endif (NOT SuiteSparse_${MODULE}_FOUND) + mark_as_advanced (HAVE_SUITESPARSE_${MODULE}_H) + mark_as_advanced (${MODULE}_INCLUDE_DIR) + mark_as_advanced (${MODULE}_LIBRARY) +endforeach (module) + +if (SuiteSparse_INCLUDE_DIRS) + list (REMOVE_DUPLICATES SuiteSparse_INCLUDE_DIRS) +endif (SuiteSparse_INCLUDE_DIRS) +if (SuiteSparse_LIBRARIES) + list (REVERSE SuiteSparse_LIBRARIES) + list (REMOVE_DUPLICATES SuiteSparse_LIBRARIES) + list (REVERSE SuiteSparse_LIBRARIES) +endif (SuiteSparse_LIBRARIES) + +# on MacOS X the libraries are in a framework directory and an option must be +# added on the compile line to relate headers to that directory +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + list (APPEND SuiteSparse_DEFINITIONS "-framework Accelerate") +endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + +# print a message to indicate status of this package +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (SuiteSparse + DEFAULT_MSG + SuiteSparse_LIBRARIES + SuiteSparse_INCLUDE_DIRS + ) + +# add these after checking to not pollute the message output (checking for +# BLAS and LAPACK is REQUIRED so if they are not found, we'll have failed +# already; suitesparseconfig is "optional" anyway) +list (APPEND SuiteSparse_LIBRARIES ${SuiteSparse_EXTRA_LIBS}) diff --git a/cmake/Modules/FindTinyXML.cmake b/cmake/Modules/FindTinyXML.cmake new file mode 100644 index 0000000..78bcf37 --- /dev/null +++ b/cmake/Modules/FindTinyXML.cmake @@ -0,0 +1,37 @@ +# - Find TinyXML library +# +# Defines the following variables: +# TinyXML_INCLUDE_DIRS Directory of header files +# TinyXML_LIBRARIES Directory of shared object files +# TinyXML_DEFINITIONS Defines that must be set to compile + +# Copyright (C) 2012 Uni Research AS +# This code is licensed under The GNU General Public License v3.0 + +# use the generic find routine +include (OpmPackage) +find_opm_package ( + # module name + "TinyXML" + + # dependencies + "" + + # header to search for + "tinyxml.h" + + # library to search for + "tinyxml" + + # defines to be added to compilations + "" + + # test program +"#include +int main (void) { + TiXmlDocument doc; + return 0; +} +" + # config variables + "") diff --git a/cmake/Modules/Finddune-common.cmake b/cmake/Modules/Finddune-common.cmake new file mode 100644 index 0000000..5ba9bc5 --- /dev/null +++ b/cmake/Modules/Finddune-common.cmake @@ -0,0 +1,57 @@ +# - Find DUNE common library +# +# Defines the following variables: +# dune-common_INCLUDE_DIRS Directory of header files +# dune-common_LIBRARIES Directory of shared object files +# dune-common_DEFINITIONS Defines that must be set to compile +# dune-common_CONFIG_VARS List of defines that should be in config.h +# HAVE_DUNE_COMMON Binary value to use in config.h + +# Copyright (C) 2012 Uni Research AS +# This code is licensed under The GNU General Public License v3.0 + +include (OpmPackage) +find_opm_package ( + # module name + "dune-common" + + # dependencies + "CXX11Features REQUIRED; + BLAS REQUIRED; + LAPACK REQUIRED + " + # header to search for + "dune/common/fvector.hh" + + # library to search for + "dunecommon" + + # defines to be added to compilations + "DUNE_COMMON_FIELDVECTOR_SIZE_IS_METHOD=1" + + # test program +"#include +#include +int main (void) { + Dune::FieldVector v; + Dune::FieldMatrix m; + m[0][0] = 1.0; + v[0] = 1.0; + Dune::FieldVector w = m*v; + return 0; +} +" + # config variables + "HAVE_ARRAY; + HAVE_BOOST_MAKE_SHARED_HPP; + HAVE_BOOST_SHARED_PTR_HPP; + HAVE_GMP; + HAVE_MAKE_SHARED; + HAVE_MPI; + HAVE_NULLPTR; + HAVE_STATIC_ASSERT; + HAVE_TR1_TUPLE; + HAVE_TYPE_TRAITS; + HAVE_TUPLE + ") +#debug_find_vars ("dune-common") diff --git a/cmake/Modules/Finddune-cornerpoint.cmake b/cmake/Modules/Finddune-cornerpoint.cmake new file mode 100644 index 0000000..325fd5d --- /dev/null +++ b/cmake/Modules/Finddune-cornerpoint.cmake @@ -0,0 +1,42 @@ +# - Find OPM corner-point grid library +# +# Defines the following variables: +# dune-cornerpoint_INCLUDE_DIRS Directory of header files +# dune-cornerpoint_LIBRARIES Directory of shared object files +# dune-cornerpoint_DEFINITIONS Defines that must be set to compile +# dune-cornerpoint_CONFIG_VARS List of defines that should be in config.h +# HAVE_DUNE_CORNERPOINT Binary value to use in config.h + +# Copyright (C) 2013 Uni Research AS +# This code is licensed under The GNU General Public License v3.0 + +include (OpmPackage) +find_opm_package ( + # module name + "dune-cornerpoint" + + # dependencies + "dune-common REQUIRED; + dune-grid REQUIRED; + opm-core REQUIRED + " + # header to search for + "dune/grid/CpGrid.hpp" + + # library to search for + "dunecornerpoint" + + # defines to be added to compilations + "" + + # test program +"#include +int main (void) { + Dune::CpGrid g; + return 0; +} +" + # config variables + "") + +#debug_find_vars ("dune-cornerpoint") diff --git a/cmake/Modules/Finddune-geometry.cmake b/cmake/Modules/Finddune-geometry.cmake new file mode 100644 index 0000000..a39865f --- /dev/null +++ b/cmake/Modules/Finddune-geometry.cmake @@ -0,0 +1,47 @@ +# - Find DUNE geometry library +# +# Defines the following variables: +# dune-geometry_INCLUDE_DIRS Directory of header files +# dune-geometry_LIBRARIES Directory of shared object files +# dune-geometry_DEFINITIONS Defines that must be set to compile +# dune-geometry_CONFIG_VARS List of defines that should be in config.h +# HAVE_DUNE_GEOMETRY Binary value to use in config.h + +# Copyright (C) 2013 Uni Research AS +# This code is licensed under The GNU General Public License v3.0 + +include (OpmPackage) +find_opm_package ( + # module name + "dune-geometry" + + # dependencies + # TODO: we should probe for all the HAVE_* values listed below; + # however, we don't actually use them in our implementation, so + # we just include them to forward here in case anyone else does + "CXX11Features REQUIRED; + dune-common REQUIRED + " + # header to search for + "dune/geometry/quadraturerules.hh" + + # library to search for + "dunegeometry" + + # defines to be added to compilations + "" + + # test program +"#include +int main (void) { + Dune::GeometryType gt; + gt.makeQuadrilateral(); + Dune::QuadratureRules::rule(gt, 2).size(); + return 0; +} +" + # config variables + "HAVE_ALGLIB + ") + +#debug_find_vars ("dune-geometry") diff --git a/cmake/Modules/Finddune-grid.cmake b/cmake/Modules/Finddune-grid.cmake new file mode 100644 index 0000000..1ee8a06 --- /dev/null +++ b/cmake/Modules/Finddune-grid.cmake @@ -0,0 +1,58 @@ +# - Find DUNE grid library +# +# Defines the following variables: +# dune-grid_INCLUDE_DIRS Directory of header files +# dune-grid_LIBRARIES Directory of shared object files +# dune-grid_DEFINITIONS Defines that must be set to compile +# dune-grid_CONFIG_VARS List of defines that should be in config.h +# HAVE_DUNE_GRID Binary value to use in config.h + +# Copyright (C) 2013 Uni Research AS +# This code is licensed under The GNU General Public License v3.0 + +include (OpmPackage) +find_opm_package ( + # module name + "dune-grid" + + # dependencies + # TODO: we should probe for all the HAVE_* values listed below; + # however, we don't actually use them in our implementation, so + # we just include them to forward here in case anyone else does + "CXX11Features REQUIRED; + dune-common REQUIRED; + dune-geometry REQUIRED + " + # header to search for + "dune/grid/onedgrid.hh" + + # library to search for + "dunegrid" + + # defines to be added to compilations + "" + + # test program +"#include +#include +int main (void) { + std::vector coords; + Dune::OneDGrid grid(coords); + return grid.lbegin<0>(0) == grid.lend<0>(0); + return 0; +} +" + # config variables + "HAVE_MPI; + HAVE_UG; + HAVE_DUNE_FEM; + HAVE_ALUGRID; + HAVE_GRIDTYPE; + HAVE_GRAPE; + HAVE_PSURFACE; + HAVE_AMIRAMESH; + HAVE_ALBERTA; + HAVE_STDINT_H + ") + +#debug_find_vars ("dune-grid") diff --git a/cmake/Modules/Finddune-istl.cmake b/cmake/Modules/Finddune-istl.cmake new file mode 100644 index 0000000..d8d1a04 --- /dev/null +++ b/cmake/Modules/Finddune-istl.cmake @@ -0,0 +1,62 @@ +# - Find DUNE ISTL library +# +# Defines the following variables: +# dune-istl_INCLUDE_DIRS Directory of header files +# dune-istl_LIBRARIES Directory of shared object files +# dune-istl_DEFINITIONS Defines that must be set to compile +# dune-istl_CONFIG_VARS List of defines that should be in config.h +# HAVE_DUNE_ISTL Binary value to use in config.h + +# Copyright (C) 2012 Uni Research AS +# This code is licensed under The GNU General Public License v3.0 + +# dune-common is only required if dune-istl is; the "required-ness" is +# not transitive as far as CMake is concerned (i.e. if an optional package +# requests a package to be required, the build will fail if it's not found) +if (dune-istl_FIND_REQUIRED) + set (_require_dune_common "REQUIRED") +endif (dune-istl_FIND_REQUIRED) + +include (OpmPackage) +find_opm_package ( + # module name + "dune-istl" + + # required dependencies + "dune-common ${_require_dune_common}; + SUPERLU + " + # header to search for + "dune/istl/bcrsmatrix.hh" + + # library to search for + "" + + # defines to be added to compilations + "" + + # test program +"#include +#include +#include + +int main (void) { + typedef Dune::BCRSMatrix > Matrix; + Matrix matrix( 3, 3, Matrix::random ); + for (int i = 0; i < 3; ++i) matrix.setrowsize(i, 2); + matrix.endrowsizes(); + return 0; +} +" + # config variables + "HAVE_BOOST_FUSION; + HAVE_MEM_USAGE_T_EXPANSIONS; + HAVE_PARDISO; + HAVE_BOOST; + HAVE_MPI; + HAVE_PARMETIS; + HAVE_SUPERLU; + SUPERLU_MIN_VERSION_4_3; + SUPERLU_POST_2005_VERSION + ") +#debug_find_vars ("dune-istl") diff --git a/cmake/Modules/Findopm-core.cmake b/cmake/Modules/Findopm-core.cmake new file mode 100644 index 0000000..23a8e6b --- /dev/null +++ b/cmake/Modules/Findopm-core.cmake @@ -0,0 +1,60 @@ +# - Find OPM core library +# +# Defines the following variables: +# opm-core_INCLUDE_DIRS Directory of header files +# opm-core_LIBRARIES Directory of shared object files +# opm-core_DEFINITIONS Defines that must be set to compile +# opm-core_CONFIG_VARS List of defines that should be in config.h +# HAVE_OPM_CORE Binary value to use in config.h + +# Copyright (C) 2012 Uni Research AS +# This code is licensed under The GNU General Public License v3.0 + +# use the generic find routine +include (OpmPackage) +find_opm_package ( + # module name + "opm-core" + + # dependencies + "C99; + CXX11Features; + Boost 1.39.0 + COMPONENTS date_time filesystem system unit_test_framework REQUIRED; + BLAS REQUIRED; + LAPACK REQUIRED; + SuiteSparse COMPONENTS umfpack; + SUPERLU; + TinyXML; + ERT; + dune-istl + " + # header to search for + "opm/core/grid.h" + + # library to search for + "opmcore" + + # defines to be added to compilations + "" + + # test program +"#include +int main (void) { + struct UnstructuredGrid *g; + g = create_grid_empty (); + destroy_grid (g); + return 0; +} +" + # config variables + "HAVE_AGMG; + HAVE_DUNE_ISTL; + HAVE_DYNAMIC_BOOST_TEST; + HAVE_ERT; + HAVE_SUITESPARSE_UMFPACK_H; + HAVE_NULLPTR; + HAVE_STATIC_ASSERT + ") +include (UseDynamicBoost) +#debug_find_vars ("opm-core") diff --git a/cmake/Modules/Findopm-polymer.cmake b/cmake/Modules/Findopm-polymer.cmake new file mode 100644 index 0000000..647a4ee --- /dev/null +++ b/cmake/Modules/Findopm-polymer.cmake @@ -0,0 +1,41 @@ +# - Find OPM polymer library +# +# Defines the following variables: +# opm-polymer_INCLUDE_DIRS Directory of header files +# opm-polymer_LIBRARIES Directory of shared object files +# opm-polymer_DEFINITIONS Defines that must be set to compile +# opm-polymer_CONFIG_VARS List of defines that should be in config.h +# HAVE_OPM_POLYMER Binary value to use in config.h + +# Copyright (C) 2013 Uni Research AS +# This code is licensed under The GNU General Public License v3.0 + +include (OpmPackage) +find_opm_package ( + # module name + "opm-polymer" + + # dependencies + "ERT; + opm-core REQUIRED + " + # header to search for + "opm/polymer/PolymerState.hpp" + + # library to search for + "opmpolymer" + + # defines to be added to compilations + "" + + # test program +"#include +int main (void) { + Opm::PolymerState s; + return 0; +} +" + # config variables + "HAVE_ERT") + +#debug_find_vars ("opm-polymer") diff --git a/cmake/Modules/Findopm-porsol.cmake b/cmake/Modules/Findopm-porsol.cmake new file mode 100644 index 0000000..611d3fe --- /dev/null +++ b/cmake/Modules/Findopm-porsol.cmake @@ -0,0 +1,43 @@ +# - Find OPM porous media solver library +# +# Defines the following variables: +# opm-porsol_INCLUDE_DIRS Directory of header files +# opm-porsol_LIBRARIES Directory of shared object files +# opm-porsol_DEFINITIONS Defines that must be set to compile +# opm-porsol_CONFIG_VARS List of defines that should be in config.h +# HAVE_OPM_PORSOL Binary value to use in config.h + +# Copyright (C) 2013 Uni Research AS +# This code is licensed under The GNU General Public License v3.0 + +include (OpmPackage) +find_opm_package ( + # module name + "opm-porsol" + + # dependencies + "dune-common REQUIRED; + dune-grid REQUIRED; + dune-istl REQUIRED; + opm-core REQUIRED; + dune-cornerpoint REQUIRED + " + # header to search for + "opm/porsol/mimetic/IncompFlowSolverHybrid.hpp" + + # library to search for + "opmporsol" + + # defines to be added to compilations + "" + + # test program +"#include +int main (void) { + return 0; +} +" + # config variables + "HAVE_VALGRIND") + +#debug_find_vars ("opm-porsol") diff --git a/cmake/Modules/Findopm-upscaling.cmake b/cmake/Modules/Findopm-upscaling.cmake new file mode 100644 index 0000000..7f80e41 --- /dev/null +++ b/cmake/Modules/Findopm-upscaling.cmake @@ -0,0 +1,44 @@ +# - Find OPM upscaling grid library +# +# Defines the following variables: +# opm-upscaling_INCLUDE_DIRS Directory of header files +# opm-upscaling_LIBRARIES Directory of shared object files +# opm-upscaling_DEFINITIONS Defines that must be set to compile +# opm-upscaling_CONFIG_VARS List of defines that should be in config.h +# HAVE_OPM_UPSCALING Binary value to use in config.h + +# Copyright (C) 2013 Uni Research AS +# This code is licensed under The GNU General Public License v3.0 + +include (OpmPackage) +find_opm_package ( + # module name + "opm-upscaling" + + # dependencies + "dune-common REQUIRED; + dune-grid REQUIRED; + dune-istl REQUIRED; + opm-core REQUIRED; + dune-cornerpoint REQUIRED; + opm-porsol REQUIRED; + " + # header to search for + "opm/upscaling/SinglePhaseUpscaler.hpp" + + # library to search for + "opmupscaling" + + # defines to be added to compilations + "" + + # test program +"#include +int main (void) { + return 0; +} +" + # config variables + "HAVE_SUPERLU") + +#debug_find_vars ("opm-upscaling") diff --git a/cmake/Modules/LibtoolArchives.cmake b/cmake/Modules/LibtoolArchives.cmake new file mode 100644 index 0000000..f8a6a56 --- /dev/null +++ b/cmake/Modules/LibtoolArchives.cmake @@ -0,0 +1,150 @@ +function (configure_la name target) + if (NOT (UNIX OR MSYS OR MINGW)) + return () + endif (NOT (UNIX OR MSYS OR MINGW)) + + # these generic variables are initialized from the project info + set (current "${${name}_VERSION_MAJOR}") + set (age "${${name}_VERSION_MINOR}") + set (inherited_linker_flags "${${name}_LINKER_FLAGS}") + set (dependency_libs "${${name}_LIBRARIES}") + + # if we are going to put these in regexps, we must escape period + string (REPLACE "." "\\." esc_dl_pref "${CMAKE_SHARED_LIBRARY_PREFIX}") + string (REPLACE "." "\\." esc_dl_suff "${CMAKE_SHARED_LIBRARY_SUFFIX}") + string (REPLACE "." "\\." esc_ar_pref "${CMAKE_STATIC_LIBRARY_PREFIX}") + string (REPLACE "." "\\." esc_ar_suff "${CMAKE_STATIC_LIBRARY_PREFIX}") + + # CMake loves absolute paths, whereas libtool won't have any of it! + # (you get an error message about argument not parsed). translate each + # of the libraries into a linker option + set (deplib_list "") + foreach (deplib IN LISTS dependency_libs) + # starts with a hyphen already? then just add it + string (SUBSTRING ${deplib} 0 1 dash) + if (${dash} STREQUAL "-") + list (APPEND deplib_list ${deplib}) + else (${dash} STREQUAL "-") + # otherwise, parse the name into a directory and a name + get_filename_component (deplib_dir ${deplib} PATH) + get_filename_component (deplib_orig ${deplib} NAME) + string (REGEX REPLACE + "^${esc_dl_pref}(.*)${esc_dl_suff}$" + "\\1" + deplib_name + ${deplib_orig} + ) + string (REGEX REPLACE + "^${esc_ar_pref}(.*)${esc_ar_suff}$" + "\\1" + deplib_name + ${deplib_name} + ) + # directory and name each on their own; this is somewhat + # unsatisfactory because it may be that a system dir is specified + # by an earlier directory and you start picking up libraries from + # there instead of the "closest" path here. also, the soversion + # is more or less lost. remove system default path, to lessen the + # chance that we pick the wrong library + if (NOT ((deplib_dir STREQUAL "/usr/lib") OR + (deplib_dir STREQUAL "/usr/${CMAKE_INSTALL_LIBDIR}"))) + list (APPEND deplib_list "-L${deplib_dir}") + endif (NOT ((deplib_dir STREQUAL "/usr/lib") OR + (deplib_dir STREQUAL "/usr/${CMAKE_INSTALL_LIBDIR}"))) + # if there was no translation of the name, the library is named + # unconventionally (.so.3gf, I'm looking at you), so pass this + # name unmodified to the linker switch + if (deplib_orig STREQUAL deplib_name) + list (APPEND deplib_list "-l:${deplib_orig}") + else (deplib_orig STREQUAL deplib_name) + list (APPEND deplib_list "-l${deplib_name}") + endif (deplib_orig STREQUAL deplib_name) + endif (${dash} STREQUAL "-") + endforeach (deplib) + set (dependency_libs ${deplib_list}) + + # convert from CMake list (i.e. semi-colon separated) + string (REPLACE ";" " " inherited_linker_flags "${inherited_linker_flags}") + string (REPLACE ";" " " dependency_libs "${dependency_libs}") + + # this is the preferred installation path + set (libdir "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + + # ${name}_LIBRARY_TYPE is either SHARED or STATIC + if (${name}_LIBRARY_TYPE STREQUAL "SHARED") + set (libprefix "${CMAKE_SHARED_LIBRARY_PREFIX}") + set (libsuffix "${CMAKE_SHARED_LIBRARY_SUFFIX}") + set (libname "${CMAKE_SHARED_LIBRARY_PREFIX}${target}${CMAKE_SHARED_LIBRARY_SUFFIX}") + # only Unix has soversion in library names + if (UNIX) + set (dlname "${libname}.${current}") + set (library_names "${libname}.${current}.${age} ${libname}.${current} ${libname}") + else (UNIX) + set (dlname "${libname}") + set (library_names "${libname}") + endif (UNIX) + set (old_library "") + else (${name}_LIBRARY_TYPE STREQUAL "SHARED") + set (dlname "") + set (library_names "") + set (old_library "${CMAKE_STATIC_LIBRARY_PREFIX}${target}${CMAKE_STATIC_LIBRARY_SUFFIX}") + endif (${name}_LIBRARY_TYPE STREQUAL "SHARED") + + # get the version of libtool installed on the system; this is + # necessary because libtool checks that the file contains its own + # signature(!) + if (NOT libtool_MAIN) + find_file ( + libtool_MAIN + ltmain.sh + PATHS /usr + PATH_SUFFIXES share/libtool/config/ + DOC "Location of libtool" + ) + mark_as_advanced (libtool_MAIN) + # notify the user if it not found after we explicitly searched + if (NOT libtool_MAIN) + message (STATUS "Libtool not found!") + endif (NOT libtool_MAIN) + endif (NOT libtool_MAIN) + if (libtool_MAIN) + file (STRINGS + ${libtool_MAIN} + ltversion_STRING + REGEX "^VERSION=\".*\"" + ) + endif (libtool_MAIN) + if (ltversion_STRING) + string (REGEX REPLACE + "^VERSION=\"?(.*)\"?" + "\\1" + ltversion + ${ltversion_STRING} + ) + endif (ltversion_STRING) + + # assume that we are in cmake/Modules, and that the template have been + # put in cmake/Templates. we cannot use CMAKE_CURRENT_LIST_DIR because + # this is in a function, and we cannot know who's calling us + set (templ_dir "${PROJECT_SOURCE_DIR}/cmake/Templates") + + + # only write an .la if libtool is found; otherwise we have no use + # for it. + if (ltversion) + set (la_file "lib${target}.la") + message (STATUS "Writing libtool archive for ${target}") + configure_file ( + ${templ_dir}/la.in + ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${la_file} + @ONLY@ + ) + else (ltversion) + set (la_file "") + endif (ltversion) + + # return this variable to the caller + if (ARGV2) + set (${ARGV2} "${la_file}" PARENT_SCOPE) + endif (ARGV2) +endfunction (configure_la target) diff --git a/cmake/Modules/OpmCompile.cmake b/cmake/Modules/OpmCompile.cmake new file mode 100644 index 0000000..c84703e --- /dev/null +++ b/cmake/Modules/OpmCompile.cmake @@ -0,0 +1,52 @@ +# - Compile main library target + +macro (opm_compile opm) + # some CMake properties do not do list expansion + string (REPLACE ";" " " ${opm}_LINKER_FLAGS_STR "${${opm}_LINKER_FLAGS}") + + # name of the library should not contain dashes, as CMake will + # define a symbol with that name, and those cannot contain dashes + string (REPLACE "-" "" ${opm}_TARGET "${${opm}_NAME}") + + # all public header files are together with the source + set (${opm}_INCLUDE_DIR "${PROJECT_SOURCE_DIR}") + list (APPEND ${opm}_INCLUDE_DIRS "${${opm}_INCLUDE_DIR}") + + # create this library + include_directories (${${opm}_INCLUDE_DIRS}) + link_directories (${${opm}_LIBRARY_DIRS}) + add_definitions (${${opm}_DEFINITIONS}) + add_library (${${opm}_TARGET} ${${opm}_LIBRARY_TYPE} ${${opm}_SOURCES}) + set (${opm}_VERSION "${${opm}_VERSION_MAJOR}.${${opm}_VERSION_MINOR}") + set_target_properties (${${opm}_TARGET} PROPERTIES + SOVERSION ${${opm}_VERSION_MAJOR} + VERSION ${${opm}_VERSION} + LINK_FLAGS "${${opm}_LINKER_FLAGS_STR}" + ) + target_link_libraries (${${opm}_TARGET} ${${opm}_LIBRARIES}) + + # queue this executable to be stripped + strip_debug_symbols (${${opm}_TARGET} ${opm}_DEBUG) + + # pre-compile common headers; this is setup *after* the library to pick + # up extra options set there + if (PRECOMPILE_HEADERS) + get_target_property (_type ${${opm}_TARGET} TYPE) + precompile_header (CXX ${_type} + HEADER "${${opm}_PRECOMP_CXX_HEADER}" + TARGET ${opm}_CXX_pch + FLAGS ${opm}_PRECOMP_CXX_FLAGS + ) + # must set property on source files instead of entire target, because + # it only applies to C++ modules (and cannot be used for C) + set_source_files_properties (${${opm}_CXX_SOURCES} PROPERTIES + OBJECT_DEPENDS "${${opm}_CXX_pch}" + COMPILE_FLAGS "${${opm}_PRECOMP_CXX_FLAGS}" + ) + message (STATUS "Precompiled headers: ${${opm}_CXX_pch}") + endif (PRECOMPILE_HEADERS) + + # we need to know the name of the library which is generated + get_target_property (${opm}_LIBRARY ${${opm}_TARGET} LOCATION) + +endmacro (opm_compile opm) diff --git a/cmake/Modules/OpmDefaults.cmake b/cmake/Modules/OpmDefaults.cmake new file mode 100644 index 0000000..73a3df9 --- /dev/null +++ b/cmake/Modules/OpmDefaults.cmake @@ -0,0 +1,49 @@ +# - Default settings for the build + +include (UseCompVer) + +macro (opm_defaults opm) + # build debug by default + if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + set (CMAKE_BUILD_TYPE "Debug") + endif (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + + # default to building a static library, but let user override + if (DEFINED BUILD_SHARED_LIBS) + set (_shared_def ${BUILD_SHARED_LIBS}) + else (DEFINED BUILD_SHARED_LIBS) + set (_shared_def OFF) + endif (DEFINED BUILD_SHARED_LIBS) + option (BUILD_${${opm}_NAME}_SHARED "Build ${${opm}_NAME} as a shared library" ${_shared_def}) + if (BUILD_${${opm}_NAME}_SHARED) + set (${opm}_LIBRARY_TYPE SHARED) + else (BUILD_${${opm}_NAME}_SHARED) + set (${opm}_LIBRARY_TYPE STATIC) + endif (BUILD_${${opm}_NAME}_SHARED) + + # precompile standard headers to speed up compilation + # unfortunately, this functionality is buggy and tends to segfault at + # least up to version 4.7.2, so it should be disabled by default there + get_gcc_version (CXX GCC_VERSION) + if (GCC_VERSION VERSION_LESS "4.7.2") + set (_precomp_def OFF) + else (GCC_VERSION VERSION_LESS "4.7.2") + set (_precomp_def ON) + endif (GCC_VERSION VERSION_LESS "4.7.2") + option (PRECOMPILE_HEADERS "Precompile common headers for speed." ${_precomp_def}) + mark_as_advanced (PRECOMPILE_HEADERS) + if (NOT PRECOMPILE_HEADERS) + message (STATUS "Precompiled headers: disabled") + endif(NOT PRECOMPILE_HEADERS) + + # if we are on a system where CMake 2.6 is the default (Hi RHEL 6!), + # the configuration files for Boost will trip up the library paths + # (look for /usr/lib64/lib64/ in the log) when used with FindBoost + # module bundled with CMake 2.8. this can be circumvented by turning + # off config mode probing if we have not explicitly specified a + # directory to look for it. for more details, see + # + if (NOT BOOST_ROOT) + set (Boost_NO_BOOST_CMAKE ON) + endif (NOT BOOST_ROOT) +endmacro (opm_defaults opm) diff --git a/cmake/Modules/OpmDistClean.cmake b/cmake/Modules/OpmDistClean.cmake new file mode 100644 index 0000000..03bba48 --- /dev/null +++ b/cmake/Modules/OpmDistClean.cmake @@ -0,0 +1,62 @@ +# - Cleanup configuration files +# +# Remove files generated by the configuration (not by the build); the +# purpose is to get back a clean directory with no build artifacts +# (some empty directories may be left behind, though) +# +# The following suffices are supported: +# _NAME Name of the project +# _STYLESHEET_COPIED Stylesheet that was copied for the documentation +# _LIBTOOL_ARCHIVE Libtool archive file generated for library +# _DEBUG Debug information extracted from library + +macro (opm_dist_clean opm) + + set (DISTCLEAN_FILES + CMakeCache.txt + cmake_install.cmake + Makefile + config.h + ${${opm}_NAME}-config.cmake + ${${opm}_NAME}-config-version.cmake + ${${opm}_NAME}-install.cmake + ${${opm}_NAME}.pc + ${${opm}_NAME}-install.pc + ${doxy_dir}/Doxyfile + ${doxy_dir}/Doxyfile.in + CTestTestfile.cmake + DartConfiguration.tcl + lib/${${opm}_LIBTOOL_ARCHIVE} + ${${opm}_DEBUG} + ${tests_DEBUG} + ${examples_DEBUG} + ${tutorial_DEBUG} + install_manifest.txt + ${${opm}_STYLESHEET_COPIED} + ${tests_INPUT_FILES} + ) + # only remove these files if they were actually copied + if (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) + list (APPEND DISTCLEAN_FILES + GNUmakefile + ) + endif (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) + # script to remove empty directories (can't believe this isn't included!) + set (rmdir "${PROJECT_SOURCE_DIR}/cmake/Scripts/RemoveEmptyDir.cmake") + add_custom_target (distclean + COMMAND ${CMAKE_COMMAND} -E remove -f ${DISTCLEAN_FILES} + COMMAND ${CMAKE_COMMAND} -E remove_directory CMakeFiles/ + COMMAND ${CMAKE_COMMAND} -E remove_directory Testing/ + COMMAND ${CMAKE_COMMAND} -DDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -P ${rmdir} + COMMAND ${CMAKE_COMMAND} -DDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -P ${rmdir} + COMMAND ${CMAKE_COMMAND} -DDIR:LOCATION=${doxy_dir} -P ${rmdir} + COMMAND ${CMAKE_COMMAND} -DDIR:LOCATION=${tests_DIR} -P ${rmdir} +# cannot depend on clean because it is only defined in the master Makefile +# not in CMakeFiles/Makefile where this target will end up +# DEPENDS clean + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMENT Removing CMake-generated files + VERBATIM + ) + +endmacro (opm_dist_clean opm) diff --git a/cmake/Modules/OpmDoc.cmake b/cmake/Modules/OpmDoc.cmake new file mode 100644 index 0000000..df262ab --- /dev/null +++ b/cmake/Modules/OpmDoc.cmake @@ -0,0 +1,81 @@ +# - Setup documentation +# +# Assumes that a Doxyfile template is located in the project root +# directory, and that all documentation is going to be generated +# into its own Documentation/ directory. It will also generate an +# installation target for the documentation (not built by default) +# +# Requires the following variables to be set: +# ${opm}_NAME Name of the project +# +# Output the following variables: +# ${opm}_STYLESHEET_COPIED Location of stylesheet to be removed in distclean + +macro (opm_doc opm doxy_dir) + # combine the template with local customization + file (READ ${PROJECT_SOURCE_DIR}/cmake/Templates/Doxyfile _doxy_templ) + string (REPLACE ";" "\\;" _doxy_templ "${_doxy_templ}") + if (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/Doxylocal) + file (READ ${PROJECT_SOURCE_DIR}/${doxy_dir}/Doxylocal _doxy_local) + string (REPLACE ";" "\\;" _doxy_local "${_doxy_local}") + else (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/Doxylocal) + set (_doxy_local) + endif (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/Doxylocal) + file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${doxy_dir}) + file (WRITE ${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile.in ${_doxy_templ} ${_doxy_local}) + # set this generically named variable so even the custom file can be shared + set (src_DIR "${${opm}_DIR}") + # replace variables in this combined file + configure_file ( + ${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile.in + ${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile + @ONLY + ) + find_package (Doxygen) + if (DOXYGEN_FOUND) + add_custom_target (doc + COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile + SOURCES ${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${doxy_dir} + COMMENT "Generating API documentation with Doxygen" + VERBATIM + ) + # distributions have various naming conventions; this enables the packager + # to direct where the install target should put the documentation. the names + # here are taken from GNUInstallDirs.cmake + set (CMAKE_INSTALL_DATAROOTDIR "share" CACHE STRING "Read-only arch.-indep. data root") + set (CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${${opm}_NAME}" CACHE STRING "Documentation root") + set (_formats html) + foreach (format IN LISTS _formats) + string (TOUPPER ${format} FORMAT) + install ( + DIRECTORY ${PROJECT_BINARY_DIR}/${doxy_dir}/${format} + DESTINATION ${CMAKE_INSTALL_DOCDIR} + COMPONENT ${format} + OPTIONAL + ) + # target to install just HTML documentation + add_custom_target (install-${format} + COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${format} -P cmake_install.cmake + COMMENT Installing ${FORMAT} documentation + VERBATIM + ) + # since the documentation is optional, it is not automatically built + add_dependencies (install-${format} doc) + endforeach (format) + endif (DOXYGEN_FOUND) + + # stylesheets must be specified with relative path in Doxyfile, or the + # full path (to the source directory!) will be put in the output HTML. + # thus, we'll need to copy the stylesheet to this path relative to where + # Doxygen will be run (in the output tree) + if ((NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) AND (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/style.css)) + file (COPY ${PROJECT_SOURCE_DIR}/${doxy_dir}/style.css + DESTINATION ${PROJECT_BINARY_DIR}/${doxy_dir} + ) + set (${opm}_STYLESHEET_COPIED "${doxy_dir}/style.css") + else ((NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) AND (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/style.css)) + set (${opm}_STYLESHEET_COPIED "") + endif ((NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) AND (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/style.css)) + +endmacro (opm_doc opm) diff --git a/cmake/Modules/OpmFiles.cmake b/cmake/Modules/OpmFiles.cmake new file mode 100644 index 0000000..e0b5ed4 --- /dev/null +++ b/cmake/Modules/OpmFiles.cmake @@ -0,0 +1,74 @@ +# - Identify source code + +macro (opm_out_dirs) + # put libraries in lib/ (no multi-arch support in build tree) + set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") + set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") + set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") + set (CMAKE_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles") +endmacro (opm_out_dirs) + +# support for some of the variables that are used in Autotools +# template files +macro (opm_auto_dirs) + set (abs_top_builddir "${PROJECT_BINARY_DIR}") + set (abs_top_srcdir "${PROJECT_SOURCE_DIR}") +endmacro (opm_auto_dirs) + +macro (opm_sources opm) + # find all the source code (note that these variables have name after + # the target library and not the project). the documentation recommends + # against using globs to enumerate source code, but if you list the + # files explicitly you'll change the build files every time you add to + # the project as well as having to rebuild completely anyway. + file (GLOB_RECURSE ${opm}_C_SOURCES "${${opm}_DIR}/[^.]*.c") + file (GLOB_RECURSE ${opm}_CXX_SOURCES "${${opm}_DIR}/[^.]*.cpp") + file (GLOB_RECURSE ${opm}_C_HEADERS "${${opm}_DIR}/[^.]*.h") + file (GLOB_RECURSE ${opm}_CXX_HEADERS "${${opm}_DIR}/[^.]*.hpp") + + # remove pre-compile headers from output list + file (GLOB_RECURSE ${opm}_PRECOMP_CXX_HEADER "${${opm}_DIR}/${${opm}_NAME}-pch.hpp") + if ("${${opm}_PRECOMP_CXX_HEADER}" MATCHES ";") + message (FATAL_ERROR "There can only be one precompiled header!") + endif ("${${opm}_PRECOMP_CXX_HEADER}" MATCHES ";") + list (REMOVE_ITEM ${opm}_CXX_HEADERS + ${PROJECT_SOURCE_DIR}/${${opm}_PRECOMP_CXX_HEADER} + ) + + # merge both languages into one compilation/installation + set (${opm}_SOURCES ${${opm}_C_SOURCES} ${${opm}_CXX_SOURCES}) + set (${opm}_HEADERS ${${opm}_C_HEADERS} ${${opm}_CXX_HEADERS}) +endmacro (opm_sources opm) + +macro (opm_find_tests) + # every C++ program prefixed with test_ under tests/ directory should + # be automatically set up as a test + set (tests_DIR "tests") + file (GLOB_RECURSE tests_SOURCES + "${tests_DIR}/test_*.cpp" + "${tests_DIR}/*_test.cpp" + ) + file (GLOB_RECURSE not_tests_SOURCES + "${tests_DIR}/not-unit/test_*.cpp" + "${tests_DIR}/not-unit/*_test.cpp" + ) + # how to retrieve the "fancy" name from the filename + set (tests_REGEXP + "^test_([^/]*)$" + "^([^/]*)_test$" + ) + if (tests_SOURCES AND not_tests_SOURCES) + list (REMOVE_ITEM tests_SOURCES ${not_tests_SOURCES}) + endif (tests_SOURCES AND not_tests_SOURCES) +endmacro (opm_find_tests) + +macro (opm_find_tutorials) + # enumerate tutorials in project + set (tutorial_DIR "tutorials") + file (GLOB tutorial_SOURCES "${tutorial_DIR}/tutorial[0-9].cpp") +endmacro (opm_find_tutorials) + +macro (opm_find_examples) + set (examples_DIR "examples") + file (GLOB examples_SOURCES "${examples_DIR}/*.cpp") +endmacro (opm_find_examples) diff --git a/cmake/Modules/OpmFind.cmake b/cmake/Modules/OpmFind.cmake new file mode 100644 index 0000000..eafa378 --- /dev/null +++ b/cmake/Modules/OpmFind.cmake @@ -0,0 +1,120 @@ +# - Generic inclusion of packages +# +# Synopsis: +# +# find_and_append_package (name args) +# +# where +# +# name Name of the package, e.g. Boost +# args Other arguments, e.g. COMPONENTS, REQUIRED, QUIET etc. +# +# This macro will append the list of standard variables found by the +# package to this project's standard variables +# +######################################################################## +# +# - Generic inclusion of a list of packages +# +# Synopsis: +# +# find_and_append_package_list (args) +# +# where +# +# args List of package strings. Each string must be quoted if +# it contains more than one word. +# +# Example: +# +# find_and_append_package_list ( +# "Boost COMPONENTS filesystem REQUIRED" +# SUPERLU +# ) +######################################################################## +# +# - Remove duplicate library declarations +# +# Synopsis: +# +# remove_duplicate_libraries (module) +# +# where +# module Name of the module whose libraries should be pruned + +# list of suffixes for all the project variables +set (_opm_proj_vars + LINKER_FLAGS + LIBRARIES + DEFINITIONS + INCLUDE_DIRS + LIBRARY_DIRS + CONFIG_VARS + ) + +# ensure that they are at least the empty list after we're done +foreach (name IN LISTS _opm_proj_vars) + if (NOT DEFINED ${CMAKE_PROJECT_NAME}_${name}) + set (${CMAKE_PROJECT_NAME}_${name} "") + endif (NOT DEFINED ${CMAKE_PROJECT_NAME}_${name}) +endforeach (name) + +# 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 + # system default paths afterwards + if (${name}_DIR) + find_package (${name} ${ARGN} PATHS ${${name}_DIR} NO_DEFAULT_PATH) + else (${name}_DIR) + find_package (${name} ${ARGN}) + endif (${name}_DIR) + if (${name}_FOUND) + foreach (var IN LISTS _opm_proj_vars) + if (DEFINED ${name}_${var}) + list (APPEND ${prefix}_${var} ${${name}_${var}}) + # cleanup lists + if ("${var}" STREQUAL "LIBRARIES") + remove_duplicate_libraries (${prefix}) + else ("${var}" STREQUAL "LIBRARIES") + list (REMOVE_DUPLICATES ${prefix}_${var}) + endif ("${var}" STREQUAL "LIBRARIES") + endif (DEFINED ${name}_${var}) + endforeach (var) + # some libraries only define xxx_FOUND and not a corresponding HAVE_xxx + string (TOUPPER "${name}" NAME) + if (NOT DEFINED HAVE_${NAME}) + set (HAVE_${NAME} 1) + endif (NOT DEFINED HAVE_${NAME}) + endif (${name}_FOUND) +endmacro (find_and_append_package_to prefix name) + +# append to the list of variables associated with the project +macro (find_and_append_package name) + find_and_append_package_to (${CMAKE_PROJECT_NAME} ${name} ${ARGN}) +endmacro (find_and_append_package name) + +# find a list of dependencies, adding each one of them +macro (find_and_append_package_list_to prefix) + # setting and separating is necessary to work around apparent bugs + # in CMake's parser (sic) + set (_deps ${ARGN}) + foreach (_dep IN LISTS _deps) + separate_arguments (_args UNIX_COMMAND ${_dep}) + find_and_append_package_to (${prefix} ${_args}) + endforeach (_dep) +endmacro (find_and_append_package_list_to prefix) + +# convenience method to supply the project name as prefix +macro (find_and_append_package_list) + find_and_append_package_list_to (${CMAKE_PROJECT_NAME} ${ARGN}) +endmacro (find_and_append_package_list) + +# libraries should always be trimmed from the beginning, so that also +# missing functions in those later in the list will be resolved +macro (remove_duplicate_libraries module) + if (DEFINED ${module}_LIBRARIES) + list (REVERSE ${module}_LIBRARIES) + list (REMOVE_DUPLICATES ${module}_LIBRARIES) + list (REVERSE ${module}_LIBRARIES) + endif (DEFINED ${module}_LIBRARIES) +endmacro (remove_duplicate_libraries module) diff --git a/cmake/Modules/OpmInstall.cmake b/cmake/Modules/OpmInstall.cmake new file mode 100644 index 0000000..94bb0a9 --- /dev/null +++ b/cmake/Modules/OpmInstall.cmake @@ -0,0 +1,55 @@ +# - Installation macro +# +# Set up installation targets for the binary library. The following +# suffices must be defined for the prefix passed as parameter: +# +# _NAME Name of the library +# _HEADERS List of header files to install +# _TARGET CMake target which builds the library +# _LIBRARY_TYPE Static or shared library +# _DEBUG File containing debug symbols + +macro (opm_install opm) + foreach (_hdr IN LISTS ${opm}_HEADERS) + get_filename_component (_dir ${_hdr} PATH) + file (RELATIVE_PATH _rel_dir "${PROJECT_SOURCE_DIR}" "${_dir}") + install ( + FILES ${_hdr} + DESTINATION include/${_rel_dir} + ) + endforeach (_hdr) + install ( + TARGETS ${${opm}_TARGET} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + # only /usr/lib/debug seems to be searched for debug info; if we have + # write access to that directory (package installation), then default + # to use it; otherwise put the debug files together with the library + # (local installation). everything can be overridden by the option. + if (CMAKE_INSTALL_PREFIX STREQUAL "/usr") + set (_sys_dbg_def ON) + else (CMAKE_INSTALL_PREFIX STREQUAL "/usr") + set (_sys_dbg_def OFF) + endif (CMAKE_INSTALL_PREFIX STREQUAL "/usr") + option (SYSTEM_DEBUG "Put .debug files in GDB debug file directory" ${_sys_dbg_def}) + set (DEBUG_FILE_DIRECTORY /usr/lib/debug CACHE LOCATION "GDB debug file directory") + mark_as_advanced (DEBUG_FILE_DIRECTORY) + if (SYSTEM_DEBUG) + set (_dbg_prefix "${DEBUG_FILE_DIRECTORY}/") + else (SYSTEM_DEBUG) + set (_dbg_prefix "") + endif (SYSTEM_DEBUG) + # static libraries don't have their debug info stripped, so there is + # only a separate file when we are building shared objects + if (${opm}_LIBRARY_TYPE STREQUAL "SHARED") + install ( + FILES ${PROJECT_BINARY_DIR}/${${opm}_DEBUG} + DESTINATION ${_dbg_prefix}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} + ) + endif (${opm}_LIBRARY_TYPE STREQUAL "SHARED") + install ( + FILES ${PROJECT_SOURCE_DIR}/dune.module + DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/dunecontrol/${${opm}_NAME} + ) +endmacro (opm_install opm) diff --git a/cmake/Modules/OpmPackage.cmake b/cmake/Modules/OpmPackage.cmake new file mode 100644 index 0000000..eec8c0f --- /dev/null +++ b/cmake/Modules/OpmPackage.cmake @@ -0,0 +1,252 @@ +# - Find routine for OPM-like modules +# +# Synopsis: +# +# find_opm_package (module deps header lib defs prog conf) +# +# where +# +# module Name of the module, e.g. "dune-common"; this will be the +# stem of all variables defined (see below). +# deps Semi-colon-separated list of dependent modules which must +# be present; those that are required must be marked as such +# explicitly. Quote if more than one word is necessary to +# describe the dependency. +# header Name of the header file to probe for, e.g. +# "dune/common/fvector.hh". Note that you should have to same +# relative path here as is used in the header files. +# lib Name of the library to probe for, e.g. "dunecommon" +# defs Symbols that should be passed to compilations +# prog Program that should compile if library is present +# conf Symbols that should be present in config.h +# +# It will provide these standard Find-module variables: +# +# ${module}_INCLUDE_DIRS Directory of header files +# ${module}_LIBRARIES Directory of shared object files +# ${module}_DEFINITIONS Defines that must be set to compile +# ${module}_CONFIG_VARS List of defines that should be in config.h +# HAVE_${MODULE} Binary value to use in config.h +# +# Note: Arguments should be quoted, otherwise a list will spill into the +# next argument! + +# Copyright (C) 2012 Uni Research AS +# This file is licensed under the GNU General Public License v3.0 + +# + +# libraries should always be trimmed from the beginning, so that also +# missing functions in those later in the list will be resolved +macro (remove_duplicate_libraries module) + if (DEFINED ${module}_LIBRARIES) + list (REVERSE ${module}_LIBRARIES) + list (REMOVE_DUPLICATES ${module}_LIBRARIES) + list (REVERSE ${module}_LIBRARIES) + endif (DEFINED ${module}_LIBRARIES) +endmacro (remove_duplicate_libraries module) + +# append all items from src into dst; both must be *names* of lists +macro (append_found src dst) + foreach (_item IN LISTS ${src}) + if (NOT "${_item}" MATCHES "-NOTFOUND$") + list (APPEND ${dst} ${_item}) + endif (NOT "${_item}" MATCHES "-NOTFOUND$") + endforeach (_item) +endmacro (append_found src dst) + +function (find_opm_package module deps header lib defs prog conf) + # if someone else has included this test, don't do it again + if (${${module}_FOUND}) + return () + endif (${${module}_FOUND}) + + # dependencies on other packages; underscore version only contains the + # name of the other package + set (_deps) + foreach (_dep IN LISTS deps) + separate_arguments (_args UNIX_COMMAND ${_dep}) + find_package (${_args} QUIET) + list (GET _args 0 _name_only) + list (APPEND _deps ${_name_only}) + endforeach (_dep) + + # see if there is a pkg-config entry for this package, and use those + # settings as a starting point + find_package (PkgConfig) + pkg_check_modules (PkgConf_${module} QUIET ${module}) + + # these variables have non-standard names in FindPkgConfig (sic) + set (${module}_DEFINITIONS ${PkgConf_${module}_CFLAGS_OTHER}) + set (${module}_LINKER_FLAG ${PkgConf_${module}_LDFLAGS_OTHER}) + + # if the user hasn't specified any location, and it isn't found + # in standard system locations either, then start to wander + # about and look for it in proximity to ourself. Qt Creator likes + # to put the build-directories as siblings to the source trees, + # but with a -build suffix + if (NOT (${module}_DIR OR ${module}_ROOT)) + string (TOLOWER "${module}" _module_lower) + set (_guess + "../${module}" + "../${module}-build" + "../${_module_lower}" + "../${_module_lower}-build" + ) + set (_guess_bin) + foreach (_item IN ITEMS ${_guess}) + list (APPEND _guess_bin "${PROJECT_BINARY_DIR}/${_item}") + endforeach (_item) + endif (NOT (${module}_DIR OR ${module}_ROOT)) + + # search for this include and library file to get the installation + # directory of the package; hints are searched before the system locations, + # paths are searched afterwards + find_path (${module}_INCLUDE_DIR + NAMES "${header}" + PATHS ${_guess} + HINTS ${${module}_DIR} ${${module}_ROOT} ${PkgConf_${module}_INCLUDE_DIRS} + PATH_SUFFIXES "include" + ) + + # some modules are all in headers + if (NOT "${lib}" STREQUAL "") + find_library (${module}_LIBRARY + NAMES "${lib}" + PATHS ${_guess_bin} + HINTS ${${module}_DIR} ${${module}_ROOT} ${PkgConf_${module}_LIBRARY_DIRS} + PATH_SUFFIXES "lib" "lib/.libs" ".libs" "lib32" "lib64" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" + ) + else (NOT "${lib}" STREQUAL "") + set (${module}_LIBRARY "") + endif (NOT "${lib}" STREQUAL "") + + # add dependencies so that our result variables are complete + # list of necessities to build with the software + set (${module}_INCLUDE_DIRS "${${module}_INCLUDE_DIR}") + set (${module}_LIBRARIES "${${module}_LIBRARY}") + foreach (_dep IN LISTS _deps) + # only add those packages we actually found (find_package will show + # an error if it was marked as REQUIRED) + if (${_dep}_FOUND) + list (APPEND ${module}_INCLUDE_DIRS ${${_dep}_INCLUDE_DIRS}) + list (APPEND ${module}_LIBRARIES ${${_dep}_LIBRARIES}) + list (APPEND ${module}_DEFINITIONS ${${_dep}_DEFINITIONS}) + list (APPEND ${module}_CONFIG_VARS ${${_dep}_CONFIG_VARS}) + list (APPEND ${module}_LINKER_FLAGS ${${_dep}_LINKER_FLAGS}) + endif (${_dep}_FOUND) + endforeach (_dep) + + # compile with this option to avoid avalanche of warnings + set (${module}_DEFINITIONS "${${module}_DEFINITIONS}") + foreach (_def IN LISTS defs) + list (APPEND ${module}_DEFINITIONS "-D${_def}") + endforeach (_def) + + # tidy the lists before returning them + list (REMOVE_DUPLICATES ${module}_INCLUDE_DIRS) + remove_duplicate_libraries (${module}) + list (REMOVE_DUPLICATES ${module}_DEFINITIONS) + + # these defines are used in dune/${module} headers, and should be put + # in config.h when we include those + foreach (_var IN LISTS conf) + # massage the name to remove source code formatting + string (REGEX REPLACE "^[\n\t\ ]+" "" _var "${_var}") + string (REGEX REPLACE "[\n\t\ ]+$" "" _var "${_var}") + list (APPEND ${module}_CONFIG_VARS ${_var}) + endforeach (_var) + foreach (_dep in _deps) + if (DEFINED ${_dep}_CONFIG_VARS) + list (APPEND ${module}_CONFIG_VARS ${_dep}_CONFIG_VARS) + endif (DEFINED ${_dep}_CONFIG_VARS) + endforeach (_dep) + if (${module}_CONFIG_VARS) + list (REMOVE_DUPLICATES ${module}_CONFIG_VARS) + endif (${module}_CONFIG_VARS) + + # these are the defines that should be set when compiling + # without config.h + config_cmd_line (${module}_CMD_CONFIG ${module}_CONFIG_VARS) + + # check that we can compile a small test-program + include (CMakePushCheckState) + cmake_push_check_state () + include (CheckCXXSourceCompiles) + # only add these if they are actually found; otherwise it won't + # compile and the variable won't be set + append_found (${module}_INCLUDE_DIR CMAKE_REQUIRED_INCLUDES) + append_found (${module}_LIBRARIES CMAKE_REQUIRED_LIBRARIES) + # since we don't have any config.h yet + list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_DEFINITIONS}) + list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_CMD_CONFIG}) + string (TOUPPER ${module} MODULE) + string (REPLACE "-" "_" MODULE ${MODULE}) + check_cxx_source_compiles ("${prog}" HAVE_${MODULE}) + cmake_pop_check_state () + + # write status message in the same manner as everyone else + include (FindPackageHandleStandardArgs) + if ("${lib}" STREQUAL "") + set (_lib_var "") + else ("${lib}" STREQUAL "") + set (_lib_var "${module}_LIBRARY") + endif ("${lib}" STREQUAL "") + find_package_handle_standard_args ( + ${module} + DEFAULT_MSG + ${module}_INCLUDE_DIR ${_lib_var} + ) + + # allow the user to override these from user interface + mark_as_advanced (${module}_INCLUDE_DIR) + mark_as_advanced (${module}_LIBRARY) + + # some genius that coded the FindPackageHandleStandardArgs figured out + # that the module name should be in uppercase (?!) + string (TOUPPER ${module} MODULE_UPPER) + set (${module}_FOUND "${${MODULE_UPPER}_FOUND}" PARENT_SCOPE) + + # return these variables to the caller + set (${module}_INCLUDE_DIRS "${${module}_INCLUDE_DIRS}" PARENT_SCOPE) + set (${module}_LIBRARIES "${${module}_LIBRARIES}" PARENT_SCOPE) + set (${module}_DEFINITIONS "${${module}_DEFINITIONS}" PARENT_SCOPE) + set (${module}_CONFIG_VARS "${${module}_CONFIG_VARS}" PARENT_SCOPE) + set (${module}_LINKER_FLAGS "${${module}_LINKER_FLAGS}" PARENT_SCOPE) + set (HAVE_${MODULE} "${HAVE_${MODULE}}" PARENT_SCOPE) +endfunction (find_opm_package module deps header lib defs prog conf) + +# print all variables defined by the above macro +function (debug_find_vars module) + message (STATUS "${module}_FOUND = ${${module}_FOUND}") + message (STATUS "${module}_INCLUDE_DIRS = ${${module}_INCLUDE_DIRS}") + message (STATUS "${module}_LIBRARIES = ${${module}_LIBRARIES}") + message (STATUS "${module}_DEFINITIONS = ${${module}_DEFINITIONS}") + message (STATUS "${module}_CONFIG_VARS = ${${module}_CONFIG_VARS}") + string (TOUPPER ${module} MODULE) + string (REPLACE "-" "_" MODULE ${MODULE}) + message (STATUS "HAVE_${MODULE} = ${HAVE_${MODULE}}") +endfunction (debug_find_vars module) + +# generate a command-line that can be used to pass variables before +# config.h is available (such as probe tests). varname is the *name* +# of the variable to receive the result, defs is a list of the *names* +# which should be passed +function (config_cmd_line varname defs) + # process each variable + foreach (_var IN LISTS ${defs}) + # only generate an entry if the define was actually set + if ((DEFINED ${_var}) AND (NOT "${${_var}}" STREQUAL "")) + # numbers are not quoted, strings are + if (${_var} MATCHES "[0-9]+") + set (_quoted "${${_var}}") + else (${_var} MATCHES "[0-9]+") + set (_quoted "\"${${_var}}\"") + endif (${_var} MATCHES "[0-9]+") + # add command-line option to define this variable + list (APPEND _cmdline "-D${_var}=${_quoted}") + endif ((DEFINED ${_var}) AND (NOT "${${_var}}" STREQUAL "")) + endforeach (_var) + # return the resulting command-line options for defining vars + set (${varname} "${_cmdline}" PARENT_SCOPE) +endfunction (config_cmd_line) diff --git a/cmake/Modules/OpmProject.cmake b/cmake/Modules/OpmProject.cmake new file mode 100644 index 0000000..0aca605 --- /dev/null +++ b/cmake/Modules/OpmProject.cmake @@ -0,0 +1,142 @@ +# - Helper routines for opm-core like projects + +# convert a list back to a command-line string +function (unseparate_args var_name prefix value) + separate_arguments (value) + foreach (item IN LISTS value) + set (prefixed_item "${prefix}${item}") + if (${var_name}) + set (${var_name} "${${var_name}} ${prefixed_item}") + else (${var_name}) + set (${var_name} "${prefixed_item}") + endif (${var_name}) + endforeach (item) + set (${var_name} "${${var_name}}" PARENT_SCOPE) +endfunction (unseparate_args var_name prefix value) + +# wrapper to set variables in pkg-config file +function (configure_pc_file name source dest prefix libdir includedir) + # escape set of standard strings + unseparate_args (includes "-I" "${${name}_INCLUDE_DIRS}") + unseparate_args (libs "-l" "${${name}_LIBRARIES}") + unseparate_args (defs "" "${${name}_DEFINITIONS}") + + # necessary to make these variables visible to configure_file + set (name "${${name}_NAME}") + set (description "${${name}_DESCRIPTION}") + set (target "${${name}_LIBRARY}") + set (major "${${name}_VERSION_MAJOR}") + set (minor "${${name}_VERSION_MINOR}") + + configure_file (${source} ${dest} @ONLY) +endfunction (configure_pc_file name source dist prefix libdir includedir) + +function (configure_cmake_file name variant version) + # declarative list of the variable names that are used in the template + # and that must be defined in the project to be exported + set (variable_suffices + DESCRIPTION + VERSION + DEFINITIONS + INCLUDE_DIRS + LIBRARY_DIRS + LINKER_FLAGS + CONFIG_VARS + LIBRARY + LIBRARIES + TARGET + ) + + # set these variables temporarily (this is in a function scope) so + # they are available to the template (only) + foreach (suffix IN LISTS variable_suffices) + set (opm-project_${suffix} "${${name}_${suffix}}") + endforeach (suffix) + set (opm-project_NAME "${${name}_NAME}") + + # make the file substitutions + configure_file ( + ${template_dir}/opm-project-config${version}.cmake.in + ${PROJECT_BINARY_DIR}/${${name}_NAME}-${variant}${version}.cmake + @ONLY + ) +endfunction (configure_cmake_file name) + +# installation of CMake modules to help user programs locate the library +function (opm_cmake_config name) + # assume that the template is located in cmake/Templates (cannot use + # the current directory since this is in a function and the directory + # at runtime not at definition will be used + set (template_dir "${PROJECT_SOURCE_DIR}/cmake/Templates") + + # write configuration file to locate library + configure_cmake_file (${name} "config" "") + configure_cmake_file (${name} "config" "-version") + configure_vars ( + FILE CMAKE "${PROJECT_BINARY_DIR}/${${name}_NAME}-config.cmake" + APPEND "${${name}_CONFIG_VARS}" + ) + + # config-mode .pc file; use this to find the build tree + configure_pc_file ( + ${name} + ${template_dir}/opm-project.pc.in + ${PROJECT_BINARY_DIR}/${${name}_NAME}.pc + ${PROJECT_BINARY_DIR} + ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + ${PROJECT_SOURCE_DIR} + ) + + # replace the build directory with the target directory in the + # variables that contains build paths + string (REPLACE + "${PROJECT_SOURCE_DIR}" + "${CMAKE_INSTALL_PREFIX}/include" + ${name}_INCLUDE_DIRS + "${${name}_INCLUDE_DIRS}" + ) + string (REPLACE + "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" + ${name}_LIBRARY + "${${name}_LIBRARY}" + ) + set (CMAKE_LIBRARY_OUTPUT_DIRECTORY + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" + ) + # create a config mode file which targets the install directory instead + # of the build directory (using the same input template) + configure_cmake_file (${name} "install" "") + configure_vars ( + FILE CMAKE "${PROJECT_BINARY_DIR}/${${name}_NAME}-install.cmake" + APPEND "${${name}_CONFIG_VARS}" + ) + # this file gets copied to the final installation directory + install ( + FILES ${PROJECT_BINARY_DIR}/${${name}_NAME}-install.cmake + DESTINATION share/cmake/${${name}_NAME} + RENAME ${${name}_NAME}-config.cmake + ) + # assume that there exists a version file already + install ( + FILES ${PROJECT_BINARY_DIR}/${${name}_NAME}-config-version.cmake + DESTINATION share/cmake/${${name}_NAME} + ) + + # find-mode .pc file; use this to locate system installation + configure_pc_file ( + ${name} + ${template_dir}/opm-project.pc.in + ${PROJECT_BINARY_DIR}/${${name}_NAME}-install.pc + ${CMAKE_INSTALL_PREFIX} + ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} + ${CMAKE_INSTALL_PREFIX}/include + ) + + # put this in the right system location; assume that we have binaries + install ( + FILES ${PROJECT_BINARY_DIR}/${${name}_NAME}-install.pc + DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig/ + RENAME ${${name}_NAME}.pc + ) +endfunction (opm_cmake_config name) diff --git a/cmake/Modules/OpmSatellites.cmake b/cmake/Modules/OpmSatellites.cmake new file mode 100644 index 0000000..c2a1ce2 --- /dev/null +++ b/cmake/Modules/OpmSatellites.cmake @@ -0,0 +1,153 @@ +# - Build satellites that are dependent of main library +# +# Enumerate all source code in a "satellite" directory such as tests/, +# compile each of them and optionally set them as a test for CTest to +# run. They will be linked to the main library created by the project. +# +# The following suffices must be defined for the opm prefix passed as +# parameter: +# +# _LINKER_FLAGS Necessary flags to link with this library +# _TARGET CMake target which creates the library +# _LIBRARIES Other dependencies that must also be linked + +# Synopsis: +# opm_compile_satellites (opm satellite excl_all test_regexp) +# +# Parameters: +# opm Prefix of the variable which contain information +# about the library these satellites depends on, e.g. +# pass "opm-core" if opm-core_TARGET is the name of +# the target the builds this library. Variables with +# suffixes _TARGET and _LIBRARIES must exist. +# +# satellite Prefix of variable which contain the names of the +# files, e.g. pass "tests" if the files are in the +# variable tests_SOURCES. Variables with suffixes +# _DATAFILES, _SOURCES and _DIR should exist. This +# name is also used as name of the target that builds +# all these files. +# +# excl_all EXCLUDE_ALL if these targets should not be built by +# default, otherwise empty string. +# +# test_regexp Regular expression which picks the name of a test +# out of the filename, or blank if no test should be +# setup. +# +# Example: +# opm_compile_satellites (opm-core test "" "^test_([^/]*)$") +# +macro (opm_compile_satellites opm satellite excl_all test_regexp) + # if we are going to build the tests always, then make sure that + # the datafiles are present too + if (NOT (${excl_all} MATCHES "EXCLUDE_ALL")) + set (_incl_all "ALL") + else (NOT (${excl_all} MATCHES "EXCLUDE_ALL")) + set (_incl_all "") + endif (NOT (${excl_all} MATCHES "EXCLUDE_ALL")) + + # if a set of datafiles has been setup, pull those in + add_custom_target (${satellite} ${_incl_all}) + if (${satellite}_DATAFILES) + add_dependencies (${satellite} ${${satellite}_DATAFILES}) + endif (${satellite}_DATAFILES) + + # compile each of these separately + foreach (_sat_FILE IN LISTS ${satellite}_SOURCES) + get_filename_component (_sat_NAME "${_sat_FILE}" NAME_WE) + add_executable (${_sat_NAME} ${excl_all} ${_sat_FILE}) + add_dependencies (${satellite} ${_sat_NAME}) + set_target_properties (${_sat_NAME} PROPERTIES + LINK_FLAGS "${${opm}_LINKER_FLAGS_STR}" + ) + # are we building a test? luckily, the testing framework doesn't + # require anything else, so we don't have to figure out where it + # should go in the library list + if (NOT "${test_regexp}" STREQUAL "") + set (_test_lib "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}") + else (NOT "${test_regexp}" STREQUAL "") + set (_test_lib "") + endif (NOT "${test_regexp}" STREQUAL "") + target_link_libraries (${_sat_NAME} ${${opm}_TARGET} ${${opm}_LIBRARIES} ${_test_lib}) + strip_debug_symbols (${_sat_NAME} _sat_DEBUG) + list (APPEND ${satellite}_DEBUG ${_sat_DEBUG}) + + # variable with regular expression doubles as a flag for + # whether tests should be setup or not + if (NOT "${test_regexp}" STREQUAL "") + foreach (_regexp IN ITEMS ${test_regexp}) + if ("${_sat_NAME}" MATCHES "${_regexp}") + string (REGEX REPLACE "${_regexp}" "\\1" _sat_FANCY "${_sat_NAME}") + endif ("${_sat_NAME}" MATCHES "${_regexp}") + endforeach (_regexp) + get_target_property (_sat_LOC ${_sat_NAME} LOCATION) + if (CMAKE_VERSION VERSION_LESS "2.8.4") + add_test ( + NAME ${_sat_FANCY} + COMMAND ${CMAKE_COMMAND} -E chdir "${PROJECT_BINARY_DIR}/${${satellite}_DIR}" ${_sat_LOC} + ) + else (CMAKE_VERSION VERSION_LESS "2.8.4") + add_test (${_sat_FANCY} ${_sat_LOC}) + # run the test in the directory where the data files are + set_tests_properties (${_sat_FANCY} PROPERTIES + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${${satellite}_DIR} + ) + endif (CMAKE_VERSION VERSION_LESS "2.8.4") + endif(NOT "${test_regexp}" STREQUAL "") + endforeach (_sat_FILE) +endmacro (opm_compile_satellites opm prefix) + +# Synopsis: +# opm_data (satellite target dirname files) +# +# provides these output variables: +# +# ${satellite}_INPUT_FILES List of all files that are copied +# ${satellite}_DATAFILES Name of target which copies these files +# +# Example: +# +# opm_data (tests datafiles "tests/" "*.xml") +# +macro (opm_data satellite target dirname files) + # even if there are no datafiles, create the directory so the + # satellite programs have a homedir to run in + execute_process ( + COMMAND ${CMAKE_COMMAND} -E make_directory ${dirname} + ) + + # if ever huge test datafiles are necessary, then change this + # into "create_symlink" (on UNIX only, apparently) + set (make_avail "copy") + + # provide datafiles as inputs for the tests, by copying them + # to a tests/ directory in the output tree (if different) + set (${satellite}_INPUT_FILES) + set (${satellite}_DATA) + foreach (_fileset IN ITEMS ${files}) + file (GLOB _fileset_DATA "${dirname}/${_fileset}") + list (APPEND ${satellite}_DATA ${_fileset_DATA}) + endforeach (_fileset) + if (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) + foreach (input_datafile IN LISTS ${satellite}_DATA) + file (RELATIVE_PATH rel_datafile "${PROJECT_SOURCE_DIR}" ${input_datafile}) + set (output_datafile "${PROJECT_BINARY_DIR}/${rel_datafile}") + add_custom_command ( + OUTPUT ${output_datafile} + COMMAND ${CMAKE_COMMAND} + ARGS -E ${make_avail} ${input_datafile} ${output_datafile} + DEPENDS ${input_datafile} + VERBATIM + ) + list (APPEND ${satellite}_INPUT_FILES "${output_datafile}") + endforeach (input_datafile) + endif(NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) + + # setup a target which does all the copying + set (${satellite}_DATAFILES "${target}") + add_custom_target (${${satellite}_DATAFILES} + DEPENDS ${${satellite}_INPUT_FILES} + COMMENT "Making \"${satellite}\" data available in output tree" + ) +endmacro (opm_data satellite target dirname files) diff --git a/cmake/Modules/UseCompVer.cmake b/cmake/Modules/UseCompVer.cmake new file mode 100644 index 0000000..48e2163 --- /dev/null +++ b/cmake/Modules/UseCompVer.cmake @@ -0,0 +1,15 @@ +# - Get compiler version + +# probe the GCC version, returns empty string if GCC is not compiler +function (get_gcc_version language ver_name) + if(CMAKE_${language}_COMPILER_ID STREQUAL GNU) + # exec_program is deprecated, but execute_process does't work :-( + exec_program (${CMAKE_${language}_COMPILER} + ARGS ${CMAKE_${language}_COMPILER_ARG1} -dumpversion + OUTPUT_VARIABLE _version + ) + set (${ver_name} ${_version} PARENT_SCOPE) + else (CMAKE_${language}_COMPILER_ID STREQUAL GNU) + set (${ver_name} "" PARENT_SCOPE) + endif (CMAKE_${language}_COMPILER_ID STREQUAL GNU) +endfunction (get_gcc_version ver_name) diff --git a/cmake/Modules/UseDebugSymbols.cmake b/cmake/Modules/UseDebugSymbols.cmake new file mode 100644 index 0000000..175579c --- /dev/null +++ b/cmake/Modules/UseDebugSymbols.cmake @@ -0,0 +1,97 @@ +# - Generate debug symbols in a separate file +# +# (1) Include this file in your CMakeLists.txt; it will setup everything +# to compile WITH debug symbols in any case. +# +# (2) Run the strip_debug_symbols function on every target that you want +# to strip. + +# Copyright (C) 2012 Uni Research AS +# This code is licensed under The GNU General Public License v3.0 + +include (AddOptions) + +# only debugging using the GNU toolchain is supported for now +if (CMAKE_COMPILER_IS_GNUCXX) + # add debug symbols to *all* targets, regardless. there WILL come a + # time when you need to find a bug which only manifests itself in a + # release target on a production system! + message (STATUS "Generating debug symbols: -ggdb3") + add_options (ALL_LANGUAGES ALL_BUILDS "-ggdb3") + + # extracting the debug info is done by a separate utility in the GNU + # toolchain. check that this is actually installed. + message (STATUS "Looking for strip utility") + find_program (OBJCOPY + objcopy + ${CYGWIN_INSTALL_PATH}/bin /usr/bin /usr/local/bin + ) + mark_as_advanced (OBJCOPY) + if (OBJCOPY) + message (STATUS "Looking for strip utility - found") + else (OBJCOPY) + message (WARNING "Looking for strip utility - not found") + endif (OBJCOPY) +endif (CMAKE_COMPILER_IS_GNUCXX) + +# command to separate the debug information from the executable into +# its own file; this must be called for each target; optionally takes +# the name of a variable to receive the list of .debug files +function (strip_debug_symbols targets) + if (CMAKE_COMPILER_IS_GNUCXX AND OBJCOPY) + foreach (target IN LISTS targets) + # libraries must retain the symbols in order to link to them, but + # everything can be stripped in an executable + get_target_property (_kind ${target} TYPE) + + # don't strip static libraries + if ("${_kind}" STREQUAL "STATIC_LIBRARY") + return () + endif ("${_kind}" STREQUAL "STATIC_LIBRARY") + + # don't strip public symbols in shared objects + if ("${_kind}" STREQUAL "EXECUTABLE") + set (_strip_args "--strip-all") + else ("${_kind}" STREQUAL "EXECUTABLE") + set (_strip_args "--strip-debug") + endif ("${_kind}" STREQUAL "EXECUTABLE") + + # add_custom_command doesn't support generator expressions in the + # working_directory argument (sic; that's what you get when you do + # ad hoc programming all the time), so we need to extract the + # location up front (the location on the other hand should not be + # used for libraries as it does not include the soversion -- sic + # again) + get_target_property (_full ${target} LOCATION) + get_filename_component (_dir ${_full} PATH) + get_filename_component (_name ${_full} NAME) + # only libraries have soversion property attached + get_target_property (_target_soversion ${target} SOVERSION) + get_target_property (_target_version ${target} VERSION) + if (_target_soversion) + set (_target_file "${_full}.${_target_version}") + set (_target_file_name "${_name}.${_target_version}") + else (_target_soversion) + set (_target_file "${_full}") + set (_target_file_name "${_name}") + endif (_target_soversion) + # do without generator expressions (which doesn't work everywhere) + add_custom_command (TARGET ${target} + POST_BUILD + WORKING_DIRECTORY ${_dir} + COMMAND ${OBJCOPY} ARGS --only-keep-debug ${_target_file} ${_target_file}.debug + COMMAND ${OBJCOPY} ARGS ${_strip_args} ${_target_file} + COMMAND ${OBJCOPY} ARGS --add-gnu-debuglink=${_target_file_name}.debug ${_target_file} + VERBATIM + ) + # add this .debug file to the list + file (RELATIVE_PATH _this_debug_file "${PROJECT_BINARY_DIR}" "${_target_file}.debug") + set (_debug_files ${_debug_files} ${_this_debug_file}) + endforeach (target) + # if optional debug list was requested, then copy to output parameter + if (ARGV1) + set (${ARGV1} ${_debug_files} PARENT_SCOPE) + endif (ARGV1) + endif (CMAKE_COMPILER_IS_GNUCXX AND OBJCOPY) +endfunction (strip_debug_symbols targets) + diff --git a/cmake/Modules/UseDynamicBoost.cmake b/cmake/Modules/UseDynamicBoost.cmake new file mode 100644 index 0000000..c889ad9 --- /dev/null +++ b/cmake/Modules/UseDynamicBoost.cmake @@ -0,0 +1,33 @@ +# be sure that this component is searched for +find_package (Boost COMPONENTS unit_test_framework QUIET) + +if (${Boost_UNIT_TEST_FRAMEWORK_FOUND}) + # setup to do a test compile + include (CMakePushCheckState) + cmake_push_check_state () + include (CheckCXXSourceCompiles) + list (APPEND CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIRS}) + list (APPEND CMAKE_REQUIRED_LIBRARIES ${Boost_LIBRARIES}) + + check_cxx_source_compiles(" +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE DYNLINK_TEST +#include + +int f(int x) { return 2 * x; } + +BOOST_AUTO_TEST_CASE(DynlinkConfigureTest) { + BOOST_CHECK_MESSAGE(f(2) == 4, + \"Apparently, multiplication doesn't \" + \"work: f(2) = \" << f(2)); +}" HAVE_DYNAMIC_BOOST_TEST) + cmake_pop_check_state () +else (${Boost_UNIT_TEST_FRAMEWORK_FOUND}) + # no Boost, no compile + set (HAVE_DYNAMIC_BOOST_TEST 0) +endif (${Boost_UNIT_TEST_FRAMEWORK_FOUND}) + +# save this for later +set (HAVE_DYNAMIC_BOOST_TEST "${HAVE_DYNAMIC_BOOST_TEST}" + CACHE BOOL "Whether Boost::Test is dynamically linked or not" + ) diff --git a/cmake/Modules/UseFastBuilds.cmake b/cmake/Modules/UseFastBuilds.cmake new file mode 100644 index 0000000..cd954a9 --- /dev/null +++ b/cmake/Modules/UseFastBuilds.cmake @@ -0,0 +1,8 @@ +# - Try to build faster depending on the compiler + +# faster builds by using a pipe instead of temp files +include (AddOptions) +if (CMAKE_COMPILER_IS_GNUCXX) + add_options (ALL_LANGUAGES ALL_BUILDS "-pipe") +endif (CMAKE_COMPILER_IS_GNUCXX) + diff --git a/cmake/Modules/UseFortranWrappers.cmake b/cmake/Modules/UseFortranWrappers.cmake new file mode 100644 index 0000000..744c037 --- /dev/null +++ b/cmake/Modules/UseFortranWrappers.cmake @@ -0,0 +1,78 @@ +# - Provide C wrappers for Fortran code +# +# Synopsis: +# define_fc_func (APPEND config.h IF HAVE_BLAS) + +function (define_fc_func verb file) + # check that we are being called correctly + if (NOT (("${verb}" STREQUAL "APPEND") OR + ("${verb}" STREQUAL "WRITE"))) + message (FATAL_ERROR + "Unknown verb \"${verb}\" passed as first argument." + ) + endif (NOT (("${verb}" STREQUAL "APPEND") OR + ("${verb}" STREQUAL "WRITE"))) + + # check under which conditions we should do our work + if (NOT "${ARGN}" STREQUAL "") + set (args ${ARGN}) + list (GET args 0 keyword) + if (NOT "${keyword}" STREQUAL "IF") + message (FATAL_ERROR + "Unknown conditional \"${keyword}\" passed as third argument." + ) + endif (NOT "${keyword}" STREQUAL "IF") + list (REMOVE_AT args 0) + set (needed FALSE) + foreach (condition IN LISTS args) + if (${${condition}}) + set (needed TRUE) + break () + endif (${${condition}}) + endforeach (condition) + else (NOT "${ARGN}" STREQUAL "") + # if called unconditionally, then always include the wrapper + set (needed TRUE) + endif (NOT "${ARGN}" STREQUAL "") + + # only do something if we actually have some components which requires + # the interaction -- don't load the Fortran compiler just to write + # this macro (which apparently nobody uses then) + if (needed) + # enable languages needed + if (NOT CMAKE_C_COMPILER_LOADED) + enable_language (C) + endif (NOT CMAKE_C_COMPILER_LOADED) + if (NOT CMAKE_Fortran_COMPILER_LOADED) + enable_language (Fortran) + endif (NOT CMAKE_Fortran_COMPILER_LOADED) + + # get a temporary file + set (_tmp_hdr ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/config_f.h) + + # write a small config file that contains the proper convention for + # calling Fortran from C + include (FortranCInterface) + fortrancinterface_header (${_tmp_hdr}) + + # read the definition back in from the file + file (STRINGS + ${_tmp_hdr} + _str + REGEX "^#define FortranCInterface_GLOBAL\\(name,NAME\\) .*$" + ) + + # massage it to look like the one AC_FC_WRAPPERS provide + string (REPLACE "FortranCInterface_GLOBAL" "FC_FUNC" _str ${_str}) + + # write this definition to the end of our own configuration file + file (${verb} ${file} + "\n/* Define to a macro mangling the given C identifier (in lower and upper + case), which must not contain underscores, for linking with Fortran. */\n" + ${_str} + "\n" + ) + else (needed) + message (STATUS "Fortran/C interface not activated") + endif (needed) +endfunction (define_fc_func) diff --git a/cmake/Modules/UseMultiArch.cmake b/cmake/Modules/UseMultiArch.cmake new file mode 100644 index 0000000..06a4012 --- /dev/null +++ b/cmake/Modules/UseMultiArch.cmake @@ -0,0 +1,42 @@ +# - Multiarch support in object code library directories +# +# This module sets the following variable +# CMAKE_INSTALL_LIBDIR to lib, lib64 or lib/x86_64-linux-gnu +# depending on the platform; use this path +# for platform-specific binaries. +# +# CMAKE_INSTALL_LIBDIR_NOARCH to lib or lib64 depending on the platform; +# use this path for architecture-independent +# files. +# +# Note that it will override the results of GNUInstallDirs if included after +# that module. + +# Fedora uses lib64/ for 64-bit systems, Debian uses lib/x86_64-linux-gnu; +# Fedora put module files in lib64/ too, but Debian uses lib/ for that +if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + # Debian or Ubuntu? + if (EXISTS "/etc/debian_version") + set (_libdir_def "lib/${CMAKE_LIBRARY_ARCHITECTURE}") + set (_libdir_noarch "lib") + else (EXISTS "/etc/debian_version") + # 64-bit system? + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + set (_libdir_noarch "lib64") + else (CMAKE_SIZEOF_VOID_P EQUAL 8) + set (_libdir_noarch "lib") + endif (CMAKE_SIZEOF_VOID_P EQUAL 8) + set (_libdir_def "${_libdir_noarch}") + endif (EXISTS "/etc/debian_version") +else ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + set (_libdir_def "lib") + set (_libdir_noarch "lib") +endif ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + +# let the user override if somewhere else is desirable +set (CMAKE_INSTALL_LIBDIR "${_libdir_def}" CACHE PATH "Object code libraries") +set (CMAKE_INSTALL_LIBDIR_NOARCH "${_libdir_noarch}" CACHE PATH "Architecture-independent library files") +mark_as_advanced ( + CMAKE_INSTALL_LIBDIR + CMAKE_INSTALL_LIBDIR_NOARCH + ) diff --git a/cmake/Modules/UseOnlyNeeded.cmake b/cmake/Modules/UseOnlyNeeded.cmake new file mode 100644 index 0000000..fe8246b --- /dev/null +++ b/cmake/Modules/UseOnlyNeeded.cmake @@ -0,0 +1,36 @@ +# - Use only needed imports from libraries +# +# Add the -Wl,--as-needed flag to the default linker flags on Linux +# in order to get only the minimal set of dependencies. + +function (prepend var_name value) + if (${var_name}) + set (${var_name} "${value} ${${var_name}}" PARENT_SCOPE) + else (${var_name}) + set (${var_name} "${value}") + endif (${var_name}) +endfunction (prepend var_name value) + +# only ELF shared objects can be underlinked, and only GNU will accept +# these parameters; otherwise just leave it to the defaults +if ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC) + # these are the modules whose probes will turn up incompatible + # flags on some systems + set (_maybe_underlinked + SuiteSparse + ) + # check if any modules actually reported problems (by setting an + # appropriate linker flag) + set (_underlinked FALSE) + foreach (_module IN LISTS _maybe_underlinked) + if ("${${_module}_LINKER_FLAGS}" MATCHES "-Wl,--no-as-needed") + set (_underlinked TRUE) + endif ("${${_module}_LINKER_FLAGS}" MATCHES "-Wl,--no-as-needed") + endforeach (_module) + # if we didn't have any problems, then go ahead and add + if (NOT _underlinked) + prepend (CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") + prepend (CMAKE_MODULE_LINKER_FLAGS "-Wl,--as-needed") + prepend (CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") + endif (NOT _underlinked) +endif ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC) diff --git a/cmake/Modules/UseOptimization.cmake b/cmake/Modules/UseOptimization.cmake new file mode 100644 index 0000000..e66f7a2 --- /dev/null +++ b/cmake/Modules/UseOptimization.cmake @@ -0,0 +1,41 @@ +# - Turn on optimizations based on build type + +include(TestCXXAcceptsFlag) +include (AddOptions) + +# if we are building a debug target, then disable all optimizations +# otherwise, turn them on. indicate to the code what we have done +# so it can turn on assertions etc. +if (CMAKE_COMPILER_IS_GNUCXX) + # use these options for debug builds - no optimizations + add_options ( + ALL_LANGUAGES + "Debug" + "-O0" "-DDEBUG" + ) + + # extra flags passed for optimization + set (_opt_flags "") + + # link-time (a.k.a. global) optimizations + check_cxx_accepts_flag ("-flto" HAVE_LINK_OPTS) + if (HAVE_LINK_OPTS) + list (APPEND _opt_flags "-flto") + endif (HAVE_LINK_OPTS) + + # native instruction set tuning + option (WITH_NATIVE "Use native instruction set" ON) + if (WITH_NATIVE) + check_cxx_accepts_flag ("-mtune=native" HAVE_MTUNE) + if (HAVE_MTUNE) + list (APPEND _opt_flags "-mtune=native") + endif (HAVE_MTUNE) + endif (WITH_NATIVE) + + # use these options for release builds - full optimization + add_options ( + ALL_LANGUAGES + "Release;RelWithDebInfo;MinSizeRel" + "-O3" "-DNDEBUG" ${_opt_flags} + ) +endif (CMAKE_COMPILER_IS_GNUCXX) diff --git a/cmake/Modules/UsePrecompHeaders.cmake b/cmake/Modules/UsePrecompHeaders.cmake new file mode 100644 index 0000000..12546da --- /dev/null +++ b/cmake/Modules/UsePrecompHeaders.cmake @@ -0,0 +1,152 @@ +# - Use precompiled headers +# +# precompile_header takes these parameters +# +# language Language in which the header is written; C or CXX. +# +# type Type of target being build, SHARED_LIBRARY, STATIC_LIBRARY +# or EXECUTABLE. +# +# header Relative path within the source tree to the header +# that contains the list of includes to be precompiled. +# This header should not be added to the installation, +# as it will be specific for this project. +# +# target Name of target to be created. All targets that +# use the precompiled header should depend on this target +# so that it is built before them. A variable with this +# name will also be created which contains the file name. +# +# flags_name Name of variable to receive the flags that should be +# added to the command-line. +# +# Example: +# get_target_property (type opmcore TYPE) +# precompile_header (CXX ${type} +# HEADER "opm/core/opm-core-pch.hpp" +# TARGET opmcore_CXX_pch +# FLAGS opmcore_PRECOMP_CXX_FLAGS +# ) +# set_source_files_properties (${opmcore_CXX_SOURCES} PROPERTIES +# OBJECT_DEPENDS "${opmcore_CXX_pch}" +# COMPILE_FLAGS "${opmcore_PRECOMP_CXX_FLAGS}" +# ) + +# get compiler version +include (UseCompVer) + +# reconstruct the compiler command line; this does NOT include the +# DEFINE_SYMBOL that is added for shared libraries. type is the TYPE +# target property. +# see larsch's PrecompiledHeader.cmake: +# and +function (compiler_cmdline language type cmd_name args_name) + # get the compiler for this particular language + set (${cmd_name} "${CMAKE_${language}_COMPILER}" PARENT_SCOPE) + + # in case someone has overridden the compiler (e.g. ccache) + set (_args "${CMAKE_${language}_COMPILER_ARG1}") + + # macro definitions + get_directory_property (_defs DEFINITIONS) + list (APPEND _args "${_defs}") + + # global flags (such as -std=c++11); notice that there are both + # release-dependent and non-release-dependent ones + string (TOUPPER "CMAKE_${language}_FLAGS" _flags) + list (APPEND _args "${${_flags}}") + string (TOUPPER "CMAKE_${language}_FLAGS_${CMAKE_BUILD_TYPE}" _flags) + list (APPEND _args "${${_flags}}") + + # assume that we are always generating position-independent code + # when compiling for a shared library + if (type STREQUAL "SHARED_LIBRARY") + list (APPEND _args "${CMAKE_SHARED_LIBRARY_${language}_FLAGS}") + endif (type STREQUAL "SHARED_LIBRARY") + + # directories included + get_directory_property (_dirs INCLUDE_DIRECTORIES) + foreach (_dir ${_dirs}) + list (APPEND _args "-I${_dir}") + endforeach (_dir) + + # make arguments a real list, and write to output variable + separate_arguments (_args) + set (${args_name} "${_args}" PARENT_SCOPE) +endfunction (compiler_cmdline language type cmd_name args_name) + +function (precompile_header + language type hdr_kw header tgt_kw target flgs_kw flags_name) + + # check "syntax" + if (NOT hdr_kw STREQUAL "HEADER") + message (FATAL "Third token to precompile_header shoulde be \"HEADER\"") + endif (NOT hdr_kw STREQUAL "HEADER") + if (NOT tgt_kw STREQUAL "TARGET") + message (FATAL "Fifth token to precompile_header should be \"TARGET\"") + endif (NOT tgt_kw STREQUAL "TARGET") + if (NOT flgs_kw STREQUAL "FLAGS") + message (FATAL "Seventh token to precompile_header should be \"FLAGS\"") + endif (NOT flgs_kw STREQUAL "FLAGS") + + # check language + if (language STREQUAL "CXX") + set (gcc_lang "c++-header") + elseif (language STREQUAL "C") + set (gcc_lang "c-header") + else (language STREQUAL "CXX") + message (FATAL "Only C or C++ can have precompiled headers") + endif (language STREQUAL "CXX") + + # only support precompiled headers if the compiler is gcc >= 3.4 + get_gcc_version (${language} GCC_VERSION) + if (GCC_VERSION) + if (GCC_VERSION VERSION_EQUAL 3.4 OR GCC_VERSION VERSION_GREATER 3.4) + # command-line used to compile modules in this kind of target + compiler_cmdline (${language} ${type} _cmd _args) + + # gcc will include any configurations which are in a directory + # with the same name as the header included + set (_pch_dir "CMakeFiles/pch") + set (_pch_file "${_pch_dir}/${header}.gch/${target}") + + # make sure that output directory exists + get_filename_component (_outdir "${PROJECT_BINARY_DIR}/${_pch_file}" PATH) + file (MAKE_DIRECTORY ${_outdir}) + + # we need to generate the precompiled header in the output tree, but + # at the same time prevent the compiler to pick up the header from the + # source tree. getting the order of the include paths right is fragile + # in CMake. by copying the header, we can put the precompile dump + # right next to it and have the compiler pick it up there + add_custom_command ( + OUTPUT "${_pch_dir}/${header}" + COMMAND ${CMAKE_COMMAND} + ARGS -E copy "${PROJECT_SOURCE_DIR}/${header}" "${_pch_dir}/${header}" + DEPENDS "${PROJECT_SOURCE_DIR}/${header}" + ) + + # add a makefile rule to create the precompiled header + add_custom_command ( + OUTPUT ${PROJECT_BINARY_DIR}/${_pch_file} + COMMAND ${_cmd} + ARGS ${_args} "-o" "${_pch_file}" "-x" "${gcc_lang}" "-c" "${_pch_dir}/${header}" + DEPENDS "${_pch_dir}/${header}" + COMMENT "Precompiling headers ${_pch_file}" + ) + + # create a phony target that is always built, but which only checks + # if the header file is OK (i.e. the header only gets rebuilt if + # necessary) + add_custom_target (${target} ALL + DEPENDS ${PROJECT_BINARY_DIR}/${_pch_file} + ) + + # these flags need to be added to the target + set (${target} "${_pch_file}" PARENT_SCOPE) + set (${flags_name} "-Winvalid-pch -include ${_pch_dir}/${header}" PARENT_SCOPE) + endif (GCC_VERSION VERSION_EQUAL 3.4 OR GCC_VERSION VERSION_GREATER 3.4) + endif (GCC_VERSION) + +endfunction (precompile_header + language type header tgt_kw target flgs_kw flags_name) diff --git a/cmake/Modules/UseSystemInfo.cmake b/cmake/Modules/UseSystemInfo.cmake new file mode 100644 index 0000000..c0db9c1 --- /dev/null +++ b/cmake/Modules/UseSystemInfo.cmake @@ -0,0 +1,50 @@ +# - Print CMake and OS distribution version +# +function (system_info) + message (STATUS "CMake version: ${CMAKE_VERSION}") + if (CMAKE_SYSTEM MATCHES "Linux") + distro_name (DISTRO_NAME) + message (STATUS "Linux distribution: ${DISTRO_NAME}") + else (CMAKE_SYSTEM MATCHES "Linux") + message (STATUS "Operating system: ${CMAKE_SYSTEM}") + endif (CMAKE_SYSTEM MATCHES "Linux") +endfunction (system_info) + +# probe various system files that may be found +function (distro_name varname) + file (GLOB has_os_release /etc/os-release) + file (GLOB has_lsb_release /etc/lsb-release) + file (GLOB has_sys_release /etc/system-release) + # start with /etc/os-release, + # see + if (NOT has_os_release STREQUAL "") + read_release (PRETTY_NAME FROM /etc/os-release INTO _descr) + # previous "standard", used on older Ubuntu and Debian + elseif (NOT has_lsb_release STREQUAL "") + read_release (DISTRIB_DESCRIPTION FROM /etc/lsb-release INTO _descr) + # RHEL/CentOS etc. has just a text-file + elseif (NOT has_sys_release STREQUAL "") + file (READ /etc/system-release _descr) + else (NOT has_lsb_release STREQUAL "") + # no yet known release file found + set (_descr "unknown") + endif (NOT has_os_release STREQUAL "") + # return from function (into appropriate variable) + string (STRIP "${_descr}" _descr) + set (${varname} "${_descr}" PARENT_SCOPE) +endfunction (distro_name varname) + +# read property from the newer /etc/os-release +function (read_release valuename FROM filename INTO varname) + file (STRINGS ${filename} _distrib + REGEX "^${valuename}=" + ) + string (REGEX REPLACE + "^${valuename}=\"?\(.*\)" "\\1" ${varname} ${_distrib} + ) + # remove trailing quote that got globbed by the wildcard (greedy match) + string (REGEX REPLACE + "\"$" "" ${varname} "${${varname}}" + ) + set (${varname} "${${varname}}" PARENT_SCOPE) +endfunction (read_release valuename FROM filename INTO varname) diff --git a/cmake/Modules/UseVCSInfo.cmake b/cmake/Modules/UseVCSInfo.cmake new file mode 100644 index 0000000..642102e --- /dev/null +++ b/cmake/Modules/UseVCSInfo.cmake @@ -0,0 +1,102 @@ +# - Get version control information from source tree +# +# Sets the following variables +# +# VCS_SYSTEM Currently, this will only be "git", or empty if +# no source code control system is found. +# +# VCS_SHA1 Hash code of the last commit. If this is empty, +# then no source code repository was found. +# +# VCS_DECOR Characters that denotes any local modifications: +# "*" - Unstaged local changes +# "+" - Staged, but not committed, local changes +# "%" - Untracked local files +function (vcs_info) + # if we haven't located git yet, then do it now + if (NOT GIT_FOUND) + find_package (Git) + endif (NOT GIT_FOUND) + + # if git is not installed (unpacked tarball), then just state that + # the version practically is unknown + set (VCS_DECOR "") + if (GIT_FOUND) + set (VCS_SYSTEM "git") + + # assume that we have a .git subdirectory under the source directory; + # if we have a bare repository, then we won't be able to build in there + # and we won't be able to identify the git dir to use from only a work + # tree, so we handle that like a regular unpacked tarball + + # exec_program is used because execute_process is buggy on common + # platforms (notable CMake 2.8.7 in Ubuntu Precise 12.04) + + # get hash code + exec_program ( + ${GIT_EXECUTABLE} ${PROJECT_SOURCE_DIR} + ARGS rev-parse --short --verify HEAD + OUTPUT_VARIABLE VCS_SHA1 + RETURN_VALUE has_sha + ) + + # exec_program mashes together output and error + if (NOT ${has_sha} EQUAL 0) + set (VCS_SHA1 "") + endif (NOT ${has_sha} EQUAL 0) + + # only proceed if we actually found a source tree in there + if (VCS_SHA1) + # check for unstaged local changes + exec_program ( + ${GIT_EXECUTABLE} ${PROJECT_SOURCE_DIR} + ARGS diff --no-ext-diff --quiet --exit-code + RETURN_VALUE dirty + OUTPUT_VARIABLE _dummy + ) + if (NOT ${dirty} EQUAL 0) + list (APPEND VCS_DECOR "*") + endif (NOT ${dirty} EQUAL 0) + + # check for staged local changes + exec_program ( + ${GIT_EXECUTABLE} ${PROJECT_SOURCE_DIR} + ARGS diff-index --no-ext-diff --cached --quiet --exit-code HEAD -- + RETURN_VALUE staged + OUTPUT_VARIABLE _dummy + ) + if (NOT ${staged} EQUAL 0) + list (APPEND VCS_DECOR "+") + endif (NOT ${staged} EQUAL 0) + + # check for untracked files + exec_program ( + ${GIT_EXECUTABLE} ${PROJECT_SOURCE_DIR} + ARGS ls-files --others --exclude-standard + OUTPUT_VARIABLE untracked + ) + if (untracked) + list (APPEND VCS_DECOR "%") + endif (untracked) + + # convert list to regular string + string (REPLACE ";" "" VCS_DECOR "${VCS_DECOR}") + endif (VCS_SHA1) + else (GIT_FOUND) + set (VCS_SYSTEM "") + set (VCS_SHA1 "") + set (VCS_DECOR "") + endif (GIT_FOUND) + + # diagnostic output + if (VCS_SYSTEM AND VCS_SHA1) + message (STATUS "Source code repository: ${VCS_SYSTEM} ${VCS_SHA1}${VCS_DECOR}") + else (VCS_SYSTEM AND VCS_SHA1) + message (STATUS "Source code repository: not found!") + endif (VCS_SYSTEM AND VCS_SHA1) + + # export to parent context + set (VCS_SYSTEM "${VCS_SYSTEM}" PARENT_SCOPE) + set (VCS_SHA1 "${VCS_SHA1}" PARENT_SCOPE) + set (VCS_DECOR "${VCS_DECOR}" PARENT_SCOPE) +endfunction (vcs_info) diff --git a/cmake/Modules/UseWarnings.cmake b/cmake/Modules/UseWarnings.cmake new file mode 100644 index 0000000..2dce645 --- /dev/null +++ b/cmake/Modules/UseWarnings.cmake @@ -0,0 +1,7 @@ +# - Turn on warnings when compiling + +include (AddOptions) +if (CMAKE_COMPILER_IS_GNUCXX) + message (STATUS "All warnings enabled: -Wall") + add_options (ALL_LANGUAGES ALL_BUILDS "-Wall") +endif (CMAKE_COMPILER_IS_GNUCXX) diff --git a/cmake/Modules/compat-2.8.7/CMakePushCheckState.cmake b/cmake/Modules/compat-2.8.7/CMakePushCheckState.cmake new file mode 100644 index 0000000..0a42128 --- /dev/null +++ b/cmake/Modules/compat-2.8.7/CMakePushCheckState.cmake @@ -0,0 +1,61 @@ +# This module defines two macros: +# CMAKE_PUSH_CHECK_STATE() +# and +# CMAKE_POP_CHECK_STATE() +# These two macros can be used to save and restore the state of the variables +# CMAKE_REQUIRED_FLAGS, CMAKE_REQUIRED_DEFINITIONS, CMAKE_REQUIRED_LIBRARIES +# and CMAKE_REQUIRED_INCLUDES used by the various Check-files coming with CMake, +# like e.g. check_function_exists() etc. +# The variable contents are pushed on a stack, pushing multiple times is supported. +# This is useful e.g. when executing such tests in a Find-module, where they have to be set, +# but after the Find-module has been executed they should have the same value +# as they had before. +# +# Usage: +# cmake_push_check_state() +# set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF) +# check_function_exists(...) +# cmake_pop_check_state() + +#============================================================================= +# Copyright 2006-2011 Alexander Neundorf, +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +MACRO(CMAKE_PUSH_CHECK_STATE) + + IF(NOT DEFINED _CMAKE_PUSH_CHECK_STATE_COUNTER) + SET(_CMAKE_PUSH_CHECK_STATE_COUNTER 0) + ENDIF() + + MATH(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}+1") + + SET(_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_INCLUDES}) + SET(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS}) + SET(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES}) + SET(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS}) +ENDMACRO(CMAKE_PUSH_CHECK_STATE) + +MACRO(CMAKE_POP_CHECK_STATE) + +# don't pop more than we pushed + IF("${_CMAKE_PUSH_CHECK_STATE_COUNTER}" GREATER "0") + + SET(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + SET(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + SET(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + SET(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + + MATH(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1") + ENDIF() + +ENDMACRO(CMAKE_POP_CHECK_STATE) diff --git a/cmake/Modules/compat-2.8.7/FindBLAS.cmake b/cmake/Modules/compat-2.8.7/FindBLAS.cmake new file mode 100644 index 0000000..9b76d90 --- /dev/null +++ b/cmake/Modules/compat-2.8.7/FindBLAS.cmake @@ -0,0 +1,624 @@ +# - Find BLAS library +# This module finds an installed fortran library that implements the BLAS +# linear-algebra interface (see http://www.netlib.org/blas/). +# The list of libraries searched for is taken +# from the autoconf macro file, acx_blas.m4 (distributed at +# http://ac-archive.sourceforge.net/ac-archive/acx_blas.html). +# +# This module sets the following variables: +# BLAS_FOUND - set to true if a library implementing the BLAS interface +# is found +# BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l +# and -L). +# BLAS_LIBRARIES - uncached list of libraries (using full path name) to +# link against to use BLAS +# BLAS95_LIBRARIES - uncached list of libraries (using full path name) +# to link against to use BLAS95 interface +# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface +# is found +# BLA_STATIC if set on this determines what kind of linkage we do (static) +# BLA_VENDOR if set checks only the specified vendor, if not set checks +# all the possibilities +# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK +########## +### List of vendors (BLA_VENDOR) valid in this module +## Goto,ATLAS PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model), +## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,ACML_GPU,Apple, NAS, Generic +# C/CXX should be enabled to use Intel mkl + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(CheckFunctionExists) +include(CheckFortranFunctionExists) + +set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + +# Check the language being used +get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES ) +if( _LANGUAGES_ MATCHES Fortran ) + set( _CHECK_FORTRAN TRUE ) +elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) ) + set( _CHECK_FORTRAN FALSE ) +else() + if(BLAS_FIND_REQUIRED) + message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.") + else(BLAS_FIND_REQUIRED) + message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)") + return() + endif(BLAS_FIND_REQUIRED) +endif( ) + +macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) +# This macro checks for the existence of the combination of fortran libraries +# given by _list. If the combination is found, this macro checks (using the +# Check_Fortran_Function_Exists macro) whether can link against that library +# combination using the name of a routine given by _name using the linker +# flags given by _flags. If the combination of libraries is found and passes +# the link test, LIBRARIES is set to the list of complete library paths that +# have been found. Otherwise, LIBRARIES is set to FALSE. + +# N.B. _prefix is the prefix applied to the names of all cached variables that +# are generated internally and marked advanced by this macro. + +set(_libdir ${ARGN}) + +set(_libraries_work TRUE) +set(${LIBRARIES}) +set(_combined_name) +if (NOT _libdir) + if (WIN32) + set(_libdir ENV LIB) + elseif (APPLE) + set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH) + else () + set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH) + endif () +endif () +foreach(_library ${_list}) + set(_combined_name ${_combined_name}_${_library}) + + if(_libraries_work) + if (BLA_STATIC) + if (WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif ( WIN32 ) + if (APPLE) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else (APPLE) + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif (APPLE) + else (BLA_STATIC) + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + # for ubuntu's libblas3gf and liblapack3gf packages + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) + endif () + endif (BLA_STATIC) + find_library(${_prefix}_${_library}_LIBRARY + NAMES ${_library} + PATHS ${_libdir} + ) + mark_as_advanced(${_prefix}_${_library}_LIBRARY) + set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) + set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) + endif(_libraries_work) +endforeach(_library ${_list}) +if(_libraries_work) + # Test this combination of libraries. + set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads}) +# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") + if (_CHECK_FORTRAN) + check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) + else() + check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) + endif() + set(CMAKE_REQUIRED_LIBRARIES) + mark_as_advanced(${_prefix}${_combined_name}_WORKS) + set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) +endif(_libraries_work) +if(NOT _libraries_work) + set(${LIBRARIES} FALSE) +endif(NOT _libraries_work) +#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") +endmacro(Check_Fortran_Libraries) + +set(BLAS_LINKER_FLAGS) +set(BLAS_LIBRARIES) +set(BLAS95_LIBRARIES) +if ($ENV{BLA_VENDOR} MATCHES ".+") + set(BLA_VENDOR $ENV{BLA_VENDOR}) +else ($ENV{BLA_VENDOR} MATCHES ".+") + if(NOT BLA_VENDOR) + set(BLA_VENDOR "All") + endif(NOT BLA_VENDOR) +endif ($ENV{BLA_VENDOR} MATCHES ".+") + +if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "goto2" + "" + ) + endif(NOT BLAS_LIBRARIES) +endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") + +if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + dgemm + "" + "f77blas;atlas" + "" + ) + endif(NOT BLAS_LIBRARIES) +endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") + +# BLAS in PhiPACK libraries? (requires generic BLAS lib, too) +if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "sgemm;dgemm;blas" + "" + ) + endif(NOT BLAS_LIBRARIES) +endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") + +# BLAS in Alpha CXML library? +if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "cxml" + "" + ) + endif(NOT BLAS_LIBRARIES) +endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") + +# BLAS in Alpha DXML library? (now called CXML, see above) +if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "dxml" + "" + ) + endif(NOT BLAS_LIBRARIES) +endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") + +# BLAS in Sun Performance library? +if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "-xlic_lib=sunperf" + "sunperf;sunmath" + "" + ) + if(BLAS_LIBRARIES) + set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf") + endif(BLAS_LIBRARIES) + endif(NOT BLAS_LIBRARIES) +endif (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") + +# BLAS in SCSL library? (SGI/Cray Scientific Library) +if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "scsl" + "" + ) + endif(NOT BLAS_LIBRARIES) +endif (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") + +# BLAS in SGIMATH library? +if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "complib.sgimath" + "" + ) + endif(NOT BLAS_LIBRARIES) +endif (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") + +# BLAS in IBM ESSL library? (requires generic BLAS lib, too) +if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "essl;blas" + "" + ) + endif(NOT BLAS_LIBRARIES) +endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") + +#BLAS in acml library? +if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") + if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR + ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR + ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS)) + ) + # try to find acml in "standard" paths + if( WIN32 ) + file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" ) + else() + file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" ) + endif() + if( WIN32 ) + file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" ) + else() + file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" ) + endif() + list(GET _ACML_ROOT 0 _ACML_ROOT) + list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT) + if( _ACML_ROOT ) + get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH ) + if( SIZEOF_INTEGER EQUAL 8 ) + set( _ACML_PATH_SUFFIX "_int64" ) + else() + set( _ACML_PATH_SUFFIX "" ) + endif() + if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" ) + set( _ACML_COMPILER32 "ifort32" ) + set( _ACML_COMPILER64 "ifort64" ) + elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" ) + set( _ACML_COMPILER32 "sun32" ) + set( _ACML_COMPILER64 "sun64" ) + elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" ) + set( _ACML_COMPILER32 "pgi32" ) + if( WIN32 ) + set( _ACML_COMPILER64 "win64" ) + else() + set( _ACML_COMPILER64 "pgi64" ) + endif() + elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" ) + # 32 bit builds not supported on Open64 but for code simplicity + # We'll just use the same directory twice + set( _ACML_COMPILER32 "open64_64" ) + set( _ACML_COMPILER64 "open64_64" ) + elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" ) + set( _ACML_COMPILER32 "nag32" ) + set( _ACML_COMPILER64 "nag64" ) + else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" ) + set( _ACML_COMPILER32 "gfortran32" ) + set( _ACML_COMPILER64 "gfortran64" ) + endif() + + if( BLA_VENDOR STREQUAL "ACML_MP" ) + set(_ACML_MP_LIB_DIRS + "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib" + "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" ) + else() #if( _BLAS_VENDOR STREQUAL "ACML" ) + set(_ACML_LIB_DIRS + "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib" + "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" ) + endif() + endif() + elseif(BLAS_${BLA_VENDOR}_LIB_DIRS) + set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS}) + endif() + + if( BLA_VENDOR STREQUAL "ACML_MP" ) + foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS}) + check_fortran_libraries ( + BLAS_LIBRARIES + BLAS + sgemm + "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS} + ) + if( BLAS_LIBRARIES ) + break() + endif() + endforeach() + elseif( BLA_VENDOR STREQUAL "ACML_GPU" ) + foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS}) + check_fortran_libraries ( + BLAS_LIBRARIES + BLAS + sgemm + "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS} + ) + if( BLAS_LIBRARIES ) + break() + endif() + endforeach() + else() #if( _BLAS_VENDOR STREQUAL "ACML" ) + foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} ) + check_fortran_libraries ( + BLAS_LIBRARIES + BLAS + sgemm + "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS} + ) + if( BLAS_LIBRARIES ) + break() + endif() + endforeach() + endif() + + # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "acml;acml_mv" + "" + ) + endif(NOT BLAS_LIBRARIES) + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "acml_mp;acml_mv" + "" + ) + endif(NOT BLAS_LIBRARIES) + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "acml;acml_mv;CALBLAS" + "" + ) + endif(NOT BLAS_LIBRARIES) +endif () # ACML + +# Apple BLAS library? +if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") +if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + dgemm + "" + "Accelerate" + "" + ) + endif(NOT BLAS_LIBRARIES) +endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") + +if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") + if ( NOT BLAS_LIBRARIES ) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + dgemm + "" + "vecLib" + "" + ) + endif ( NOT BLAS_LIBRARIES ) +endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") +# Generic BLAS library? +if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "blas" + "" + ) + endif(NOT BLAS_LIBRARIES) +endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") + +#BLAS in intel mkl 10 library? (em64t 64bit) +if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") + if (NOT WIN32) + set(LM "-lm") + endif () + if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) + if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) + find_package(Threads) + else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) + find_package(Threads REQUIRED) + endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) + if (WIN32) + if(BLA_F95) + if(NOT BLAS95_LIBRARIES) + check_fortran_libraries( + BLAS95_LIBRARIES + BLAS + sgemm + "" + "mkl_blas95;mkl_intel_c;mkl_intel_thread;mkl_core;libguide40" + "" + ) + endif(NOT BLAS95_LIBRARIES) + else(BLA_F95) + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + SGEMM + "" + "mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40" + "" + ) + endif(NOT BLAS_LIBRARIES) + endif(BLA_F95) + else(WIN32) + if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + if(BLA_F95) + if(NOT BLAS95_LIBRARIES) + check_fortran_libraries( + BLAS95_LIBRARIES + BLAS + sgemm + "" + "mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT BLAS95_LIBRARIES) + else(BLA_F95) + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "mkl_intel;mkl_intel_thread;mkl_core;guide" + "${CMAKE_THREAD_LIBS_INIT}" + "${LM}" + ) + endif(NOT BLAS_LIBRARIES) + endif(BLA_F95) + endif (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") + if(BLA_F95) + if(NOT BLAS95_LIBRARIES) + check_fortran_libraries( + BLAS95_LIBRARIES + BLAS + sgemm + "" + "mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT BLAS95_LIBRARIES) + else(BLA_F95) + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT BLAS_LIBRARIES) + endif(BLA_F95) + endif (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") + endif (WIN32) + #older vesions of intel mkl libs + # BLAS in intel mkl library? (shared) + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "mkl;guide" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT BLAS_LIBRARIES) + #BLAS in intel mkl library? (static, 32bit) + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "mkl_ia32;guide" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT BLAS_LIBRARIES) + #BLAS in intel mkl library? (static, em64t 64bit) + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "mkl_em64t;guide" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT BLAS_LIBRARIES) + endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) +endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") + + +if(BLA_F95) + if(BLAS95_LIBRARIES) + set(BLAS95_FOUND TRUE) + else(BLAS95_LIBRARIES) + set(BLAS95_FOUND FALSE) + endif(BLAS95_LIBRARIES) + + if(NOT BLAS_FIND_QUIETLY) + if(BLAS95_FOUND) + message(STATUS "A library with BLAS95 API found.") + else(BLAS95_FOUND) + if(BLAS_FIND_REQUIRED) + message(FATAL_ERROR + "A required library with BLAS95 API not found. Please specify library location.") + else(BLAS_FIND_REQUIRED) + message(STATUS + "A library with BLAS95 API not found. Please specify library location.") + endif(BLAS_FIND_REQUIRED) + endif(BLAS95_FOUND) + endif(NOT BLAS_FIND_QUIETLY) + set(BLAS_FOUND TRUE) + set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}") +else(BLA_F95) + if(BLAS_LIBRARIES) + set(BLAS_FOUND TRUE) + else(BLAS_LIBRARIES) + set(BLAS_FOUND FALSE) + endif(BLAS_LIBRARIES) + + if(NOT BLAS_FIND_QUIETLY) + if(BLAS_FOUND) + message(STATUS "A library with BLAS API found.") + else(BLAS_FOUND) + if(BLAS_FIND_REQUIRED) + message(FATAL_ERROR + "A required library with BLAS API not found. Please specify library location." + ) + else(BLAS_FIND_REQUIRED) + message(STATUS + "A library with BLAS API not found. Please specify library location." + ) + endif(BLAS_FIND_REQUIRED) + endif(BLAS_FOUND) + endif(NOT BLAS_FIND_QUIETLY) +endif(BLA_F95) + +set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/cmake/Modules/compat-2.8.7/FindLAPACK.cmake b/cmake/Modules/compat-2.8.7/FindLAPACK.cmake new file mode 100644 index 0000000..884266f --- /dev/null +++ b/cmake/Modules/compat-2.8.7/FindLAPACK.cmake @@ -0,0 +1,307 @@ +# - Find LAPACK library +# This module finds an installed fortran library that implements the LAPACK +# linear-algebra interface (see http://www.netlib.org/lapack/). +# +# The approach follows that taken for the autoconf macro file, acx_lapack.m4 +# (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html). +# +# This module sets the following variables: +# LAPACK_FOUND - set to true if a library implementing the LAPACK interface +# is found +# LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l +# and -L). +# LAPACK_LIBRARIES - uncached list of libraries (using full path name) to +# link against to use LAPACK +# LAPACK95_LIBRARIES - uncached list of libraries (using full path name) to +# link against to use LAPACK95 +# LAPACK95_FOUND - set to true if a library implementing the LAPACK f95 +# interface is found +# BLA_STATIC if set on this determines what kind of linkage we do (static) +# BLA_VENDOR if set checks only the specified vendor, if not set checks +# all the possibilities +# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK +### List of vendors (BLA_VENDOR) valid in this module +## Intel(mkl), ACML,Apple, NAS, Generic + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + +get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) +if (NOT _LANGUAGES_ MATCHES Fortran) +include(CheckFunctionExists) +else (NOT _LANGUAGES_ MATCHES Fortran) +include(CheckFortranFunctionExists) +endif (NOT _LANGUAGES_ MATCHES Fortran) + +set(LAPACK_FOUND FALSE) +set(LAPACK95_FOUND FALSE) + +# TODO: move this stuff to separate module + +macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads) +# This macro checks for the existence of the combination of fortran libraries +# given by _list. If the combination is found, this macro checks (using the +# Check_Fortran_Function_Exists macro) whether can link against that library +# combination using the name of a routine given by _name using the linker +# flags given by _flags. If the combination of libraries is found and passes +# the link test, LIBRARIES is set to the list of complete library paths that +# have been found. Otherwise, LIBRARIES is set to FALSE. + +# N.B. _prefix is the prefix applied to the names of all cached variables that +# are generated internally and marked advanced by this macro. + +set(_libraries_work TRUE) +set(${LIBRARIES}) +set(_combined_name) +if (NOT _libdir) + if (WIN32) + set(_libdir ENV LIB) + elseif (APPLE) + set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH) + else () + set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH) + endif () +endif () +foreach(_library ${_list}) + set(_combined_name ${_combined_name}_${_library}) + + if(_libraries_work) + if (BLA_STATIC) + if (WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif ( WIN32 ) + if (APPLE) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else (APPLE) + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif (APPLE) + else (BLA_STATIC) + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + # for ubuntu's libblas3gf and liblapack3gf packages + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) + endif () + endif (BLA_STATIC) + find_library(${_prefix}_${_library}_LIBRARY + NAMES ${_library} + PATHS ${_libdir} + ) + mark_as_advanced(${_prefix}_${_library}_LIBRARY) + set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) + set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) + endif(_libraries_work) +endforeach(_library ${_list}) + +if(_libraries_work) + # Test this combination of libraries. + if(UNIX AND BLA_STATIC) + set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}} ${_blas} "-Wl,--end-group" ${_threads}) + else(UNIX AND BLA_STATIC) + set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads}) + endif(UNIX AND BLA_STATIC) +# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") + if (NOT _LANGUAGES_ MATCHES Fortran) + check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) + else (NOT _LANGUAGES_ MATCHES Fortran) + check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) + endif (NOT _LANGUAGES_ MATCHES Fortran) + set(CMAKE_REQUIRED_LIBRARIES) + mark_as_advanced(${_prefix}${_combined_name}_WORKS) + set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) + #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") +endif(_libraries_work) + + if(_libraries_work) + set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads}) + else(_libraries_work) + set(${LIBRARIES} FALSE) + endif(_libraries_work) + +endmacro(Check_Lapack_Libraries) + + +set(LAPACK_LINKER_FLAGS) +set(LAPACK_LIBRARIES) +set(LAPACK95_LIBRARIES) + + +if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + find_package(BLAS) +else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + find_package(BLAS REQUIRED) +endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + + +if(BLAS_FOUND) + set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) + if ($ENV{BLA_VENDOR} MATCHES ".+") + set(BLA_VENDOR $ENV{BLA_VENDOR}) + else ($ENV{BLA_VENDOR} MATCHES ".+") + if(NOT BLA_VENDOR) + set(BLA_VENDOR "All") + endif(NOT BLA_VENDOR) + endif ($ENV{BLA_VENDOR} MATCHES ".+") + +if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") + if(NOT LAPACK_LIBRARIES) + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "goto2" + "${BLAS_LIBRARIES}" + "" + ) + endif(NOT LAPACK_LIBRARIES) +endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") + + +#acml lapack + if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") + if (BLAS_LIBRARIES MATCHES ".+acml.+") + set (LAPACK_LIBRARIES ${BLAS_LIBRARIES}) + endif () + endif () + +# Apple LAPACK library? +if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") + if(NOT LAPACK_LIBRARIES) + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "Accelerate" + "${BLAS_LIBRARIES}" + "" + ) + endif(NOT LAPACK_LIBRARIES) +endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") +if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") + if ( NOT LAPACK_LIBRARIES ) + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "vecLib" + "${BLAS_LIBRARIES}" + "" + ) + endif ( NOT LAPACK_LIBRARIES ) +endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") +# Generic LAPACK library? +if (BLA_VENDOR STREQUAL "Generic" OR + BLA_VENDOR STREQUAL "ATLAS" OR + BLA_VENDOR STREQUAL "All") + if ( NOT LAPACK_LIBRARIES ) + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "lapack" + "${BLAS_LIBRARIES}" + "" + ) + endif ( NOT LAPACK_LIBRARIES ) +endif () +#intel lapack + if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") + if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) + if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + find_PACKAGE(Threads) + else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + find_package(Threads REQUIRED) + endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + if (BLA_F95) + if(NOT LAPACK95_LIBRARIES) + check_lapack_libraries( + LAPACK95_LIBRARIES + LAPACK + cheev + "" + "mkl_lapack95" + "${BLAS95_LIBRARIES}" + "${CMAKE_THREAD_LIBS_INIT}" + ) + endif(NOT LAPACK95_LIBRARIES) + else(BLA_F95) + if(NOT LAPACK_LIBRARIES) + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "mkl_lapack" + "${BLAS_LIBRARIES}" + "${CMAKE_THREAD_LIBS_INIT}" + ) + endif(NOT LAPACK_LIBRARIES) + endif(BLA_F95) + endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) + endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") +else(BLAS_FOUND) + message(STATUS "LAPACK requires BLAS") +endif(BLAS_FOUND) + +if(BLA_F95) + if(LAPACK95_LIBRARIES) + set(LAPACK95_FOUND TRUE) + else(LAPACK95_LIBRARIES) + set(LAPACK95_FOUND FALSE) + endif(LAPACK95_LIBRARIES) + if(NOT LAPACK_FIND_QUIETLY) + if(LAPACK95_FOUND) + message(STATUS "A library with LAPACK95 API found.") + else(LAPACK95_FOUND) + if(LAPACK_FIND_REQUIRED) + message(FATAL_ERROR + "A required library with LAPACK95 API not found. Please specify library location." + ) + else(LAPACK_FIND_REQUIRED) + message(STATUS + "A library with LAPACK95 API not found. Please specify library location." + ) + endif(LAPACK_FIND_REQUIRED) + endif(LAPACK95_FOUND) + endif(NOT LAPACK_FIND_QUIETLY) + set(LAPACK_FOUND "${LAPACK95_FOUND}") + set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}") +else(BLA_F95) + if(LAPACK_LIBRARIES) + set(LAPACK_FOUND TRUE) + else(LAPACK_LIBRARIES) + set(LAPACK_FOUND FALSE) + endif(LAPACK_LIBRARIES) + + if(NOT LAPACK_FIND_QUIETLY) + if(LAPACK_FOUND) + message(STATUS "A library with LAPACK API found.") + else(LAPACK_FOUND) + if(LAPACK_FIND_REQUIRED) + message(FATAL_ERROR + "A required library with LAPACK API not found. Please specify library location." + ) + else(LAPACK_FIND_REQUIRED) + message(STATUS + "A library with LAPACK API not found. Please specify library location." + ) + endif(LAPACK_FIND_REQUIRED) + endif(LAPACK_FOUND) + endif(NOT LAPACK_FIND_QUIETLY) +endif(BLA_F95) + +set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/cmake/Scripts/DuneCompat2.cmake b/cmake/Scripts/DuneCompat2.cmake new file mode 100644 index 0000000..8678077 --- /dev/null +++ b/cmake/Scripts/DuneCompat2.cmake @@ -0,0 +1,25 @@ +# - Emulate a rule to patch the Makefile, adding a line to the source +# tree and write a marker file indicating it is done. + +set (base_dir ".") +set (marker_file "${base_dir}/CMakeFiles/marker") +set (makefile "${base_dir}/Makefile") + +# if the Makefile has changed, then update it +if ("${makefile}" IS_NEWER_THAN "${marker_file}") + # only add the string once, so it does not return multiple + # results for the command line (will lead to syntax error) + file (STRINGS "${makefile}" abs_top_srcdir_FOUND + REGEX "^abs_top_srcdir = " + ) + if (NOT abs_top_srcdir_FOUND) + file (APPEND "${makefile}" + "abs_top_srcdir = ${CMAKE_HOME_DIRECTORY}\n" + ) + endif (NOT abs_top_srcdir_FOUND) + # touch the marker so that we won't update the Makefile again + execute_process (COMMAND + ${CMAKE_COMMAND} -E touch "${marker_file}" + ) +endif ("${makefile}" IS_NEWER_THAN "${marker_file}") + diff --git a/cmake/Scripts/RemoveEmptyDir.cmake b/cmake/Scripts/RemoveEmptyDir.cmake new file mode 100644 index 0000000..919146c --- /dev/null +++ b/cmake/Scripts/RemoveEmptyDir.cmake @@ -0,0 +1,15 @@ +# - Remove a directory if and only if it contains no files +# +# Pass the name of the directory as the DIR variable + +if (DIR) + # check if empty + file (GLOB_RECURSE files "${DIR}/*") + + # remove only if + if (NOT files) + execute_process (COMMAND + ${CMAKE_COMMAND} -E remove_directory "${DIR}" + ) + endif (NOT files) +endif (DIR) diff --git a/cmake/Templates/Doxyfile b/cmake/Templates/Doxyfile new file mode 100644 index 0000000..c969c9e --- /dev/null +++ b/cmake/Templates/Doxyfile @@ -0,0 +1,1663 @@ +# Doxyfile 1.7.4 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = NO + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = NO + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = NO + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = opm/core/utility/parameters/tinyxml + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is adviced to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the stylesheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 14 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the +# mathjax.org site, so you can quickly see the result without installing +# MathJax, but it is strongly recommended to install a local copy of MathJax +# before deployment. + +MATHJAX_RELPATH = http://www.mathjax.org/mathjax + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvantages are that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = pdf + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = amsmath + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = YES + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = @DOXYGEN_DOT_PATH@ + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will write a font called Helvetica to the output +# directory and reference it in all dot files that doxygen generates. +# When you want a differently looking font you can specify the font name +# using DOT_FONTNAME. You need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = @DOXYGEN_DOT_PATH@ + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/cmake/Templates/la.in b/cmake/Templates/la.in new file mode 100644 index 0000000..59bb09d --- /dev/null +++ b/cmake/Templates/la.in @@ -0,0 +1,41 @@ +# lib@target@.la - a libtool library file +# Generated by libtool (GNU libtool) @ltversion@ +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='@dlname@' + +# Names of this library. +library_names='@library_names@' + +# The name of the static archive. +old_library='@old_library@' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='@inherited_linker_flags@' + +# Libraries that this one depends upon. +dependency_libs='@dependency_libs@' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for lib@target@. +current=@current@ +age=@age@ +revision=0 + +# Is this an already installed library? +installed=no + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='@libdir@' diff --git a/cmake/Templates/opm-project-config-version.cmake.in b/cmake/Templates/opm-project-config-version.cmake.in new file mode 100644 index 0000000..ba1e1e8 --- /dev/null +++ b/cmake/Templates/opm-project-config-version.cmake.in @@ -0,0 +1,28 @@ +# - CMake version file for @opm-project_NAME@ +# +# Determine if requested version matches exactly or is compatible with +# the installed package. It sets the following variables: +# +# PACKAGE_VERSION Full provided version string +# PACKAGE_VERSION_COMPATIBLE True if version is compatible +# PACKAGE_VERSION_EXACT True if version is exact match + +# This file is used by find_package to see if the installed version of a +# package can be used by the client, before the main -config.cmake file +# is loaded. +# see + +# this is the version that is installed +set (PACKAGE_VERSION @opm-project_VERSION@) + +# if we wanted this exact version, then everything's fine +if (PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION) + set (PACKAGE_VERSION_EXACT TRUE) +endif (PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION) + +# in general, we assume that there is going to be API breakage between +# released versions; this will hopefully change in the future +## compatible versions +#if (NOT PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) +# set (PACKAGE_VERSION_COMPATIBLE TRUE) +#endif (NOT PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) diff --git a/cmake/Templates/opm-project-config.cmake.in b/cmake/Templates/opm-project-config.cmake.in new file mode 100644 index 0000000..a69a0b0 --- /dev/null +++ b/cmake/Templates/opm-project-config.cmake.in @@ -0,0 +1,62 @@ +# - @opm-project_DESCRIPTION@ config mode +# +# Defines the following variables: +# @opm-project_NAME@_FOUND - true +# @opm-project_NAME@_VERSION - version of the @opm-project_NAME@ library found, e.g. 0.2 +# @opm-project_NAME@_DEFINITIONS - defines to be made on the command line +# @opm-project_NAME@_INCLUDE_DIRS - header directories with which to compile +# @opm-project_NAME@_LINKER_FLAGS - flags that must be passed to the linker +# @opm-project_NAME@_LIBRARIES - names of the libraries with which to link +# @opm-project_NAME@_LIBRARY_DIRS - directories in which the libraries are situated +# +# You should put lines like this in your CMakeLists.txt +# set (@opm-project_NAME@_DIR "${PROJECT_BINARY_DIR}/../@opm-project_NAME@" CACHE LOCATION "Build tree of @opm-project_NAME@") +# find_package (@opm-project_NAME@) +# configure_vars ( +# FILE CXX "${PROJECT_BINARY_DIR}/config.h" +# WRITE ${@opm-project_NAME@_CONFIG_VARS} +# ) + +# + +# propagate these properties from one build system to the other +set (@opm-project_NAME@_VERSION "@opm-project_VERSION@") +set (@opm-project_NAME@_DEFINITIONS "@opm-project_DEFINITIONS@") +set (@opm-project_NAME@_INCLUDE_DIRS "@opm-project_INCLUDE_DIRS@") +set (@opm-project_NAME@_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@") +set (@opm-project_NAME@_LINKER_FLAGS "@opm-project_LINKER_FLAGS@") +set (@opm-project_NAME@_CONFIG_VARS "@opm-project_CONFIG_VARS@") + +# libraries come from the build tree where this file was generated +set (@opm-project_NAME@_LIBRARY "@opm-project_LIBRARY@") +set (@opm-project_NAME@_LIBRARIES ${@opm-project_NAME@_LIBRARY} "@opm-project_LIBRARIES@") +mark_as_advanced (@opm-project_NAME@_LIBRARY) + +# add the library as a target, so that other things in the project including +# this file may depend on it and get rebuild if this library changes. +add_library (@opm-project_TARGET@ UNKNOWN IMPORTED) +set_property (TARGET @opm-project_TARGET@ PROPERTY IMPORTED_LOCATION "${@opm-project_NAME@_LIBRARY}") + +# ensure that we build with support for C++11 to preserve ABI +string (REPLACE "@CXX_STD0X_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +string (STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS) +set (CMAKE_CXX_FLAGS "@CXX_STD0X_FLAGS@ ${CMAKE_CXX_FLAGS}") + +# same as above, but for C99 +string (REPLACE "@C_STD99_FLAGS@" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") +string (STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS) +set (CMAKE_C_FLAG "@C_STD99_FLAGS@ ${CMAKE_C_FLAGS}") + +# build with OpenMP if that was found +if (NOT "@OpenMP_C_FLAGS@" STREQUAL "") + string (REPLACE "@OpenMP_C_FLAGS@" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + string (STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS) + set (CMAKE_C_FLAG "@OpenMP_C_FLAGS@ ${CMAKE_C_FLAGS}") +endif (NOT "@OpenMP_C_FLAGS@" STREQUAL "") +if (NOT "@OpenMP_CXX_FLAGS@" STREQUAL "") + string (REPLACE "@OpenMP_CXX_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string (STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS) + set (CMAKE_C_FLAG "@OpenMP_CXX_FLAGS@ ${CMAKE_CXX_FLAGS}") +endif (NOT "@OpenMP_CXX_FLAGS@" STREQUAL "") + +# this is the contents of config.h as far as our probes can tell: diff --git a/cmake/Templates/opm-project.pc.in b/cmake/Templates/opm-project.pc.in new file mode 100644 index 0000000..1204d4b --- /dev/null +++ b/cmake/Templates/opm-project.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +libdir=@libdir@ +includedir=@includedir@ +CXX=@CMAKE_CXX_COMPILER@ @CXX_STD0X_FLAGS@ @OpenMP_CXX_FLAGS@ +CC=@CMAKE_C_COMPILER@ @C_STD99_FLAGS@ @OpenMP_C_FLAGS@ +DEPENDENCIES= + +Name: @name@ +Description: @description@ @major@.@minor@ +Version: @major@.@minor@ +URL: http://opm-project.org +Libs: -l@target@ @libs@ +Cflags: @includes@ @defs@ diff --git a/configure b/configure new file mode 100755 index 0000000..f6d807d --- /dev/null +++ b/configure @@ -0,0 +1,289 @@ +#!/bin/bash + +# where is the source tree located +srcdir=$(dirname "$0") + +# name of the project +project=$(sed -n "s,^Module:[\ \t]*\([^\ \t]*\),\1,p" "${srcdir}/dune.module") + +# display help text +usage () { + cat < if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + F77 Fortran 77 compiler command + FFLAGS Fortran 77 compiler flags + FC Fortran compiler command + FCFLAGS Fortran compiler flags + CMAKE_COMMAND Executable used to run cmake scripts + +Use these variables to override the choices made by \`configure' or to help +it to find libraries and programs with nonstandard names/locations. +EOF +} + +# report an error regarding the arguments +invalid_arg () { + cat </dev/null 2>&1; then + CMAKE_COMMAND=cmake28 + else + CMAKE_COMMAND=cmake + fi +fi + +# long arguments are implemented by putting a dash character followed by +# a colon in the optspec, see trick by Arvid Requate at +# +while getopts -- ":-:" optchar; do + case "${optchar}" in + -) + # OPTARG now contains everything after double dashes + case "${OPTARG}" in + prefix=*) + # remove prefix consisting of everything up to equal sign + prefix=${OPTARG#*=} + ;; + help) + usage + exit 0 + ;; + with-*) + # get the name of the package; everything before equal sign + pkgname=${OPTARG%=*} + pkgname=${pkgname#with-} + # get the location of the package; everyhing after equal sign + pkgloc=${OPTARG#*=} + # the parameter to this option is an executable program, so + # skip the directory test in that case + if [ "${pkgname}" = "cmake" ]; then + CMAKE_COMMAND="${pkgloc}" + break + fi + # expand to full path since CMake changes to source directory (!) + # this also normalize the path name wrt. not having a trailing slash + pkgloc=$(test -d "${pkgloc}" && sh -c "cd \"${pkgloc}\"; pwd") + # special aliases + case "${pkgname}" in + umfpack) + pkgname="SuiteSparse" + ;; + tinyxml) + pkgname="TinyXML" + ;; + esac + # packages need different suffix for their root (sic) + case "${pkgname}" in + pch) + pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON" + rootvar="" + ;; + agmg |\ + ert |\ + boost |\ + zlib) + rootvar="${pkgname^^}_ROOT" + ;; + superlu) + rootvar="${pkgname^^}_PREFIX" + ;; + SuiteSparse |\ + TinyXML |\ + opm-* |\ + dune-*) + rootvar="${pkgname}_ROOT" + ;; + *) + invalid_opt --with-${pkgname} + rootvar="" + ;; + esac + # add this to the list of existing features + test -n "${rootvar}" && \ + FEATURES="${FEATURES} \"-D${rootvar}=${pkgloc}\"" + ;; + without-* | \ + disable-*) + # get the name of the package + pkgname=$OPTARG + pkgname=${pkgname#disable-} + pkgname=${pkgname#without-} + # special aliases + case "${pkgname}" in + umfpack) + pkgname="SuiteSparse" + ;; + tinyxml) + pkgname="TinyXML" + ;; + esac + # casing is of course different + case "${pkgname}" in + option-checking) + option_check=no + # special flag: don't disable any particular package + pkgname="" + ;; + debug) + buildtype=Release + # special flag: don't disable any particular package + pkgname="" + ;; + pch) + pch_use=" -DPRECOMPILE_HEADERS:BOOL=OFF" + pkgname="" + ;; + silent-rules) + silent_rules=" -DCMAKE_VERBOSE_MAKEFILE=ON" + pkgname="" + ;; + system-debug) + silent_rules=" -DSYSTEM_DEBUG=OFF" + pkgname="" + ;; + agmg |\ + ert |\ + superlu) + pkgname="${pkgname^^}" + ;; + openmp) + pkgname="OpenMP" + ;; + gxx11check) + pkgname="CXX11Features" + ;; + *) + invalid_opt --disable-${pkgname} + pkgname="" + ;; + esac + # only disable packages if the flag refers to a proper one + test -n "${pkgname}" && \ + FEATURES="${FEATURES} -DCMAKE_DISABLE_FIND_PACKAGE_${pkgname}=TRUE" + ;; + enable-*) + # what kind of library are we building; shared or static? + kind=${OPTARG#enable-} + case "${kind}" in + system-debug) + debug_loc=" -DSYSTEM_DEBUG=ON" + # special flag; don't set shared/static + shared="" + ;; + # this flag is just for compatibility with the deprecation + # flag in DUNE, so we can build without warnings + fieldvector-size-is-method) + shared="" + ;; + shared) + shared="ON" + ;; + static) + shared="OFF" + ;; + *) + invalid_opt --enable-${kind} + shared="" + ;; + esac + test -n "${shared}" && \ + FEATURES="${FEATURES} -DBUILD_${project}_SHARED:BOOL=${shared}" + ;; + *) + # remove everything *after* the equal sign + arg=${OPTARG%=*} + invalid_arg --$arg + exit 1 + ;; + esac + ;; + *) + invalid_arg -$OPTARG + exit 1 + ;; + esac +done +# remove all arguments processed by getopts +shift $((OPTIND-1)) + +# remove Autotools-specific variables +ENVVARS=${@/ACLOCAL_*=*/} + +# pass everything on to CMake +CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\" -DCMAKE_BUILD_TYPE=${buildtype}${pch_use}${silent_rules}${debug_loc} ${FEATURES}" +echo --- calling CMake for ${project} --- +echo ${CMDLINE} +eval exec ${CMDLINE}