Merge pull request #149 from rolk/149_projstruct
Harmonize project structure to maximize build code reuse
This commit is contained in:
commit
9af7166eee
158
CMakeLists.txt
158
CMakeLists.txt
@ -2,21 +2,58 @@
|
||||
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
|
||||
|
||||
# key information about the library
|
||||
set (opm-core_NAME "opm-core")
|
||||
set (opm-core_DESCRIPTION "Open Porous Media Initiative Core Library")
|
||||
set (opm-core_DIR "opm/core")
|
||||
set (opm-core_VERSION_MAJOR 1)
|
||||
set (opm-core_VERSION_MINOR 0)
|
||||
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 (${opm-core_NAME})
|
||||
project (${${project}_NAME})
|
||||
enable_language (C)
|
||||
enable_language (CXX)
|
||||
|
||||
# additional search modules
|
||||
set (opm-core_MODULE_DIR "${PROJECT_SOURCE_DIR}/cmake/Modules")
|
||||
list (APPEND CMAKE_MODULE_PATH ${opm-core_MODULE_DIR})
|
||||
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)
|
||||
@ -29,12 +66,12 @@ 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 "${opm-core_MODULE_DIR}/compat-2.8.7")
|
||||
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 (opm-core)
|
||||
opm_defaults (${project})
|
||||
message (STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
# use tricks to do faster builds
|
||||
@ -45,35 +82,11 @@ include (UsePrecompHeaders)
|
||||
|
||||
# macro to set standard variables (INCLUDE_DIRS, LIBRARIES etc.)
|
||||
include (OpmFind)
|
||||
|
||||
# dependencies
|
||||
list (APPEND opm-core_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features"
|
||||
# matrix library
|
||||
"BLAS REQUIRED"
|
||||
"LAPACK REQUIRED"
|
||||
# Tim Davis' SuiteSparse archive
|
||||
"SuiteSparse COMPONENTS umfpack"
|
||||
# solver
|
||||
"SUPERLU"
|
||||
# xml processing (for config parsing)
|
||||
"TinyXML"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.39.0
|
||||
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
|
||||
# DUNE dependency
|
||||
"dune-istl"
|
||||
# Ensembles-based Reservoir Tools (ERT)
|
||||
"ERT"
|
||||
)
|
||||
find_and_append_package_list_to (opm-core ${opm-core_DEPS})
|
||||
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 opm-core_LIBRARIES ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||
list (REMOVE_ITEM ${project}_LIBRARIES ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||
|
||||
# don't import more libraries than we need to
|
||||
include (UseOnlyNeeded)
|
||||
@ -95,12 +108,13 @@ 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 (opm-core)
|
||||
opm_sources (${project})
|
||||
|
||||
# enumerate all testing programs in test/ directory
|
||||
opm_find_tests ()
|
||||
@ -111,28 +125,31 @@ 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 opm-core_SOURCES ${AGMG_SOURCES})
|
||||
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}/linalg/LinearSolverAGMG.cpp
|
||||
${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}/linalg/LinearSolverIstl.cpp
|
||||
${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}/linalg/call_umfpack.c
|
||||
${PROJECT_SOURCE_DIR}/${opm-core_DIR}/linalg/LinearSolverUmfpack.cpp
|
||||
${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
|
||||
@ -147,22 +164,22 @@ 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}/grid/cpgpreprocess/mxgrdecl.c
|
||||
${PROJECT_SOURCE_DIR}/${opm-core_DIR}/grid/cpgpreprocess/processgrid.c
|
||||
${PROJECT_SOURCE_DIR}/${opm-core_DIR}/utility/parameters/tinyxml/xmltest.cpp
|
||||
${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}/utility/parameters/tinyxml/*")
|
||||
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}/utility/parameters/tinyxml/tinystr.h")
|
||||
list (REMOVE_ITEM opm-core_HEADERS "${opm-core_DIR}/utility/parameters/tinyxml/tinyxml.h")
|
||||
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
|
||||
@ -172,56 +189,53 @@ if (NOT HAVE_ERT)
|
||||
${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)
|
||||
set (opm-core_CONFIG_VAR
|
||||
HAVE_AGMG
|
||||
HAVE_DUNE_ISTL
|
||||
HAVE_DYNAMIC_BOOST_TEST
|
||||
HAVE_ERT
|
||||
HAVE_SUITESPARSE_UMFPACK_H
|
||||
HAVE_NULLPTR
|
||||
HAVE_STATIC_ASSERT
|
||||
)
|
||||
list (APPEND opm-core_CONFIG_VARS ${opm-core_CONFIG_VAR})
|
||||
list (APPEND ${project}_CONFIG_VARS ${${project}_CONFIG_VAR})
|
||||
set (CONFIG_H "${PROJECT_BINARY_DIR}/config.h")
|
||||
configure_vars (
|
||||
FILE CXX "${PROJECT_BINARY_DIR}/config.h"
|
||||
WRITE ${opm-core_CONFIG_VARS}
|
||||
FILE CXX ${CONFIG_H}
|
||||
WRITE ${${project}_CONFIG_VARS}
|
||||
)
|
||||
|
||||
### --- begin AGMG specific --- ###
|
||||
include (UseFortranWrappers)
|
||||
define_fc_func (
|
||||
APPEND "${PROJECT_BINARY_DIR}/config.h"
|
||||
APPEND ${CONFIG_H}
|
||||
)
|
||||
### --- end AGMG specific --- ###
|
||||
|
||||
# compile main library; pull in all required includes and libraries
|
||||
include (OpmCompile)
|
||||
opm_compile (opm-core)
|
||||
opm_compile (${project})
|
||||
|
||||
# installation target: copy the library together with debug and
|
||||
# configuration files to system directories
|
||||
include (OpmInstall)
|
||||
opm_install (opm-core)
|
||||
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 (opm-core)
|
||||
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 (opm-core tutorial "" "")
|
||||
opm_compile_satellites (opm-core examples "" "")
|
||||
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}))
|
||||
@ -233,10 +247,11 @@ macro (cond_disable_test 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/*.xml")
|
||||
opm_compile_satellites (opm-core tests "" "^test_([^/]*)$")
|
||||
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
|
||||
@ -248,18 +263,17 @@ add_custom_target (check
|
||||
|
||||
# generate documentation from source code with Doxygen;
|
||||
# setup install target for this documentation
|
||||
set (docu_dir "Documentation")
|
||||
include (OpmDoc)
|
||||
opm_doc (opm-core ${docu_dir})
|
||||
opm_doc (${project} ${doxy_dir})
|
||||
|
||||
# provide compatibility with using this build in dunecontrol
|
||||
include (DuneCompat)
|
||||
include (LibtoolArchives)
|
||||
configure_la (opm-core ${opm-core_TARGET} opm-core_LIBTOOL_ARCHIVE)
|
||||
configure_la (${project} ${${project}_TARGET} ${project}_LIBTOOL_ARCHIVE)
|
||||
|
||||
### clean in-source builds ###
|
||||
include (OpmDistClean)
|
||||
opm_dist_clean (opm-core)
|
||||
opm_dist_clean (${project})
|
||||
|
||||
# smart wrapper that auto-parallelizes builds
|
||||
file (COPY
|
||||
|
@ -1,7 +1,7 @@
|
||||
# this is included after opm-core_NAME is set
|
||||
set(CTEST_PROJECT_NAME "${opm-core_NAME}")
|
||||
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=${opm-core_NAME}")
|
||||
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=${${project}_NAME}")
|
||||
set(CTEST_DROP_SITE_CDASH TRUE)
|
||||
|
54
Documentation/Doxylocal
Normal file
54
Documentation/Doxylocal
Normal file
@ -0,0 +1,54 @@
|
||||
# The INPUT tag can be used to specify the files and/or directories that contain
|
||||
# documented source files. You may enter file names like "myfile.cpp" or
|
||||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = @PROJECT_SOURCE_DIR@/@src_DIR@/ \
|
||||
@PROJECT_SOURCE_DIR@/tutorials/ \
|
||||
@PROJECT_SOURCE_DIR@/examples/
|
||||
|
||||
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
|
||||
# can be used to strip a user-defined part of the path. Stripping is
|
||||
# only done if one of the specified strings matches the left-hand part of
|
||||
# the path. The tag can be used to show relative paths in the file list.
|
||||
# If left blank the directory from which doxygen is run is used as the
|
||||
# path to strip.
|
||||
|
||||
STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@
|
||||
|
||||
# The EXAMPLE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain example code fragments that are included (see
|
||||
# the \include command).
|
||||
|
||||
EXAMPLE_PATH = @PROJECT_SOURCE_DIR@/tutorials/
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
# If a relative path is entered, it will be relative to the location
|
||||
# where doxygen was started. If left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = @PROJECT_BINARY_DIR@/@doxy_dir@
|
||||
|
||||
# The IMAGE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain image that are included in the documentation (see
|
||||
# the \image command).
|
||||
|
||||
IMAGE_PATH = @PROJECT_SOURCE_DIR@/@doxy_dir@/Figure
|
||||
|
||||
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
|
||||
# by doxygen. The layout file controls the global structure of the generated
|
||||
# output files in an output format independent way. The create the layout file
|
||||
# that represents doxygen's defaults, run doxygen with the -l option.
|
||||
# You can optionally specify a file name after the option, if omitted
|
||||
# DoxygenLayout.xml will be used as the name of the layout file.
|
||||
|
||||
LAYOUT_FILE = @PROJECT_SOURCE_DIR@/@doxy_dir@/DoxygenLayout.xml
|
||||
|
||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
|
||||
# style sheet that is used by each HTML page. It can be used to
|
||||
# fine-tune the look of the HTML output. If the tag is left blank doxygen
|
||||
# will generate a default style sheet. Note that doxygen will try to copy
|
||||
# the style sheet file to the HTML output directory, so don't put your own
|
||||
# stylesheet in the HTML output directory as well, or it will be erased!
|
||||
|
||||
HTML_STYLESHEET = style.css
|
@ -22,7 +22,8 @@ macro (opm_dist_clean opm)
|
||||
${${opm}_NAME}-install.cmake
|
||||
${${opm}_NAME}.pc
|
||||
${${opm}_NAME}-install.pc
|
||||
Doxyfile
|
||||
${doxy_dir}/Doxyfile
|
||||
${doxy_dir}/Doxyfile.in
|
||||
CTestTestfile.cmake
|
||||
DartConfiguration.tcl
|
||||
lib/${${opm}_LIBTOOL_ARCHIVE}
|
||||
@ -48,7 +49,7 @@ macro (opm_dist_clean opm)
|
||||
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=${docu_dir} -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
|
||||
|
@ -5,37 +5,51 @@
|
||||
# into its own Documentation/ directory. It will also generate an
|
||||
# installation target for the documentation (not built by default)
|
||||
#
|
||||
# Requires the following suffices to be set:
|
||||
# _NAME Name of the project
|
||||
# Requires the following variables to be set:
|
||||
# ${opm}_NAME Name of the project
|
||||
#
|
||||
# Output the following suffices:
|
||||
# _STYLESHEET_COPIED Location of stylesheet to be removed in distclean
|
||||
# Output the following variables:
|
||||
# ${opm}_STYLESHEET_COPIED Location of stylesheet to be removed in distclean
|
||||
|
||||
macro (opm_doc opm docu_dir)
|
||||
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_SOURCE_DIR}/Doxyfile.in
|
||||
${PROJECT_BINARY_DIR}/Doxyfile
|
||||
${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}/Doxyfile
|
||||
SOURCES ${PROJECT_BINARY_DIR}/Doxyfile
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${docu_dir}
|
||||
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
|
||||
option (CMAKE_INSTALL_DATAROOTDIR "Read-only arch.-indep. data root" "share")
|
||||
option (CMAKE_INSTALL_DOCDIR "Documentation root" "${CMAKE_INSTALL_DATAROOTDIR}/doc/${${opm}_NAME}")
|
||||
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}/${docu_dir}/${format}
|
||||
DIRECTORY ${PROJECT_BINARY_DIR}/${doxy_dir}/${format}
|
||||
DESTINATION ${CMAKE_INSTALL_DOCDIR}
|
||||
COMPONENT ${format}
|
||||
OPTIONAL
|
||||
@ -55,13 +69,13 @@ macro (opm_doc opm docu_dir)
|
||||
# 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)
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/${docu_dir}/style.css
|
||||
DESTINATION ${PROJECT_BINARY_DIR}/${docu_dir}
|
||||
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 "${docu_dir}/style.css")
|
||||
else (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_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)
|
||||
endif ((NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) AND (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/style.css))
|
||||
|
||||
endmacro (opm_doc opm)
|
||||
|
@ -8,6 +8,13 @@ macro (opm_out_dirs)
|
||||
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
|
||||
@ -20,7 +27,10 @@ macro (opm_sources opm)
|
||||
file (GLOB_RECURSE ${opm}_CXX_HEADERS "${${opm}_DIR}/[^.]*.hpp")
|
||||
|
||||
# remove pre-compile headers from output list
|
||||
set (${opm}_PRECOMP_CXX_HEADER "${${opm}_DIR}/${${opm}_NAME}-pch.hpp")
|
||||
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}
|
||||
)
|
||||
@ -34,9 +44,22 @@ 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")
|
||||
file (GLOB_RECURSE not_tests_SOURCES "${tests_DIR}/not-unit/test_*.cpp")
|
||||
list (REMOVE_ITEM tests_SOURCES ${not_tests_SOURCES})
|
||||
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)
|
||||
|
@ -64,19 +64,23 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp)
|
||||
# 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 "")
|
||||
if (NOT "${test_regexp}" STREQUAL "")
|
||||
set (_test_lib "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}")
|
||||
else (NOT ${test_regexp} STREQUAL "")
|
||||
else (NOT "${test_regexp}" STREQUAL "")
|
||||
set (_test_lib "")
|
||||
endif (NOT ${test_regexp} STREQUAL "")
|
||||
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 "")
|
||||
string (REGEX REPLACE "${test_regexp}" "\\1" _sat_FANCY "${_sat_NAME}")
|
||||
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 (
|
||||
@ -90,12 +94,12 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp)
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${${satellite}_DIR}
|
||||
)
|
||||
endif (CMAKE_VERSION VERSION_LESS "2.8.4")
|
||||
endif(NOT ${test_regexp} STREQUAL "")
|
||||
endif(NOT "${test_regexp}" STREQUAL "")
|
||||
endforeach (_sat_FILE)
|
||||
endmacro (opm_compile_satellites opm prefix)
|
||||
|
||||
# Synopsis:
|
||||
# opm_data (satellite target files)
|
||||
# opm_data (satellite target dirname files)
|
||||
#
|
||||
# provides these output variables:
|
||||
#
|
||||
@ -104,9 +108,15 @@ endmacro (opm_compile_satellites opm prefix)
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# opm_data (test datafiles "tests/*.xml")
|
||||
# opm_data (tests datafiles "tests/" "*.xml")
|
||||
#
|
||||
macro (opm_data satellite target files)
|
||||
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")
|
||||
@ -114,7 +124,11 @@ macro (opm_data satellite target files)
|
||||
# provide datafiles as inputs for the tests, by copying them
|
||||
# to a tests/ directory in the output tree (if different)
|
||||
set (${satellite}_INPUT_FILES)
|
||||
file (GLOB ${satellite}_DATA ${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})
|
||||
@ -134,6 +148,6 @@ macro (opm_data satellite target files)
|
||||
set (${satellite}_DATAFILES "${target}")
|
||||
add_custom_target (${${satellite}_DATAFILES}
|
||||
DEPENDS ${${satellite}_INPUT_FILES}
|
||||
COMMENT "Making test data available in output tree"
|
||||
COMMENT "Making \"${satellite}\" data available in output tree"
|
||||
)
|
||||
endmacro (opm_data satellite target files)
|
||||
endmacro (opm_data satellite target dirname files)
|
||||
|
@ -46,13 +46,6 @@ PROJECT_BRIEF =
|
||||
|
||||
PROJECT_LOGO =
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
# If a relative path is entered, it will be relative to the location
|
||||
# where doxygen was started. If left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = @PROJECT_BINARY_DIR@/Documentation
|
||||
|
||||
# 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.
|
||||
@ -120,15 +113,6 @@ INLINE_INHERITED_MEMB = NO
|
||||
|
||||
FULL_PATH_NAMES = YES
|
||||
|
||||
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
|
||||
# can be used to strip a user-defined part of the path. Stripping is
|
||||
# only done if one of the specified strings matches the left-hand part of
|
||||
# the path. The tag can be used to show relative paths in the file list.
|
||||
# If left blank the directory from which doxygen is run is used as the
|
||||
# path to strip.
|
||||
|
||||
STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@
|
||||
|
||||
# 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.
|
||||
@ -541,15 +525,6 @@ SHOW_NAMESPACES = YES
|
||||
|
||||
FILE_VERSION_FILTER =
|
||||
|
||||
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
|
||||
# by doxygen. The layout file controls the global structure of the generated
|
||||
# output files in an output format independent way. The create the layout file
|
||||
# that represents doxygen's defaults, run doxygen with the -l option.
|
||||
# You can optionally specify a file name after the option, if omitted
|
||||
# DoxygenLayout.xml will be used as the name of the layout file.
|
||||
|
||||
LAYOUT_FILE = @PROJECT_SOURCE_DIR@/Documentation/DoxygenLayout.xml
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
@ -605,13 +580,6 @@ WARN_LOGFILE =
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# The INPUT tag can be used to specify the files and/or directories that contain
|
||||
# documented source files. You may enter file names like "myfile.cpp" or
|
||||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = @PROJECT_SOURCE_DIR@/opm/core/ @PROJECT_SOURCE_DIR@/tutorials/ @PROJECT_SOURCE_DIR@/examples/
|
||||
|
||||
# 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
|
||||
@ -664,12 +632,6 @@ EXCLUDE_PATTERNS =
|
||||
|
||||
EXCLUDE_SYMBOLS =
|
||||
|
||||
# The EXAMPLE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain example code fragments that are included (see
|
||||
# the \include command).
|
||||
|
||||
EXAMPLE_PATH = @PROJECT_SOURCE_DIR@/tutorials/
|
||||
|
||||
# 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
|
||||
@ -684,12 +646,6 @@ EXAMPLE_PATTERNS =
|
||||
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
|
||||
# The IMAGE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain image that are included in the documentation (see
|
||||
# the \image command).
|
||||
|
||||
IMAGE_PATH = @PROJECT_SOURCE_DIR@/Documentation/Figure
|
||||
|
||||
# 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 <filter> <input-file>, where <filter>
|
||||
@ -844,15 +800,6 @@ HTML_HEADER =
|
||||
|
||||
HTML_FOOTER =
|
||||
|
||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
|
||||
# style sheet that is used by each HTML page. It can be used to
|
||||
# fine-tune the look of the HTML output. If the tag is left blank doxygen
|
||||
# will generate a default style sheet. Note that doxygen will try to copy
|
||||
# the style sheet file to the HTML output directory, so don't put your own
|
||||
# stylesheet in the HTML output directory as well, or it will be erased!
|
||||
|
||||
HTML_STYLESHEET = style.css
|
||||
|
||||
# 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
|
31
configure
vendored
31
configure
vendored
@ -1,5 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# name of the project
|
||||
project=opm-core
|
||||
|
||||
# display help text
|
||||
usage () {
|
||||
cat <<EOF
|
||||
@ -22,9 +25,9 @@ Optional Features:
|
||||
--disable-option-checking ignore unrecognized --enable/--with options
|
||||
|
||||
Optional Packages:
|
||||
--with-boost=PATH use Boost library from a specified location
|
||||
--with-dune-common=PATH use DUNE-common library from a specified location
|
||||
--with-dune-istl=PATH use DUNE-ISTL library from a specified location
|
||||
--with-boost=PATH use Boost library from a specified location
|
||||
--with-superlu=PATH user defined path to SuperLU library
|
||||
--with-agmg=PATH Include DOUBLE PRECISION version Notay's of AGMG
|
||||
Algebraic Multigrid solver from specified source
|
||||
@ -146,20 +149,20 @@ while getopts -- ":-:" optchar; do
|
||||
rootvar=""
|
||||
;;
|
||||
agmg |\
|
||||
boost |\
|
||||
ert |\
|
||||
boost |\
|
||||
zlib)
|
||||
rootvar="${pkgname^^}_ROOT"
|
||||
;;
|
||||
dune-common |\
|
||||
dune-istl |\
|
||||
SuiteSparse |\
|
||||
TinyXML)
|
||||
rootvar="${pkgname}_ROOT"
|
||||
;;
|
||||
superlu)
|
||||
rootvar="${pkgname^^}_PREFIX"
|
||||
;;
|
||||
SuiteSparse |\
|
||||
TinyXML |\
|
||||
dune-istl |\
|
||||
dune-common)
|
||||
rootvar="${pkgname}_ROOT"
|
||||
;;
|
||||
*)
|
||||
invalid_opt --with-${pkgname}
|
||||
rootvar=""
|
||||
@ -169,14 +172,20 @@ while getopts -- ":-:" optchar; do
|
||||
test -n "${rootvar}" && \
|
||||
FEATURES="${FEATURES} \"-D${rootvar}=${pkgloc}\""
|
||||
;;
|
||||
without-* | \
|
||||
disable-*)
|
||||
# get the name of the package
|
||||
pkgname=${OPTARG#disable-}
|
||||
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
|
||||
@ -248,7 +257,7 @@ while getopts -- ":-:" optchar; do
|
||||
;;
|
||||
esac
|
||||
test -n "${shared}" && \
|
||||
FEATURES="${FEATURES} -DBUILD_opm-core_SHARED:BOOL=${shared}"
|
||||
FEATURES="${FEATURES} -DBUILD_${project}_SHARED:BOOL=${shared}"
|
||||
;;
|
||||
*)
|
||||
# remove everything *after* the equal sign
|
||||
@ -272,6 +281,6 @@ ENVVARS=${@/ACLOCAL_*=*/}
|
||||
|
||||
# pass everything on to CMake
|
||||
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"$(dirname "$0")\" \"-DCMAKE_INSTALL_PREFIX=$prefix\" -DCMAKE_BUILD_TYPE=${buildtype}${pch_use}${silent_rules}${debug_loc} ${FEATURES}"
|
||||
echo --- calling CMake for opm-core ---
|
||||
echo --- calling CMake for ${project} ---
|
||||
echo ${CMDLINE}
|
||||
eval exec ${CMDLINE}
|
||||
|
Loading…
Reference in New Issue
Block a user