2012-11-14 05:45:48 -06:00
|
|
|
# -*- 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:
|
2013-07-30 07:20:34 -05:00
|
|
|
|
|
|
|
###########################################################################
|
|
|
|
# #
|
|
|
|
# Note: The bulk of the build system is located in the cmake/ directory. #
|
|
|
|
# This file only contains the specializations for this particular #
|
|
|
|
# project. Most likely you are interested in editing one of these #
|
|
|
|
# files instead: #
|
|
|
|
# #
|
|
|
|
# dune.module Name and version number #
|
|
|
|
# CMakeLists_files.cmake Path of source files #
|
|
|
|
# cmake/Modules/${project}-prereqs.cmake Dependencies #
|
|
|
|
# #
|
|
|
|
###########################################################################
|
2017-09-15 04:17:40 -05:00
|
|
|
|
|
|
|
# Mandatory call to project
|
|
|
|
project(opm-core C CXX)
|
2013-07-30 07:20:34 -05:00
|
|
|
|
2013-06-25 16:55:58 -05:00
|
|
|
cmake_minimum_required (VERSION 2.8)
|
2013-02-11 03:56:46 -06:00
|
|
|
|
2015-05-27 02:59:19 -05:00
|
|
|
# additional search modules
|
2015-05-27 04:47:20 -05:00
|
|
|
option(SIBLING_SEARCH "Search for other modules in sibling directories?" ON)
|
2015-03-06 05:33:43 -06:00
|
|
|
|
2017-09-25 05:24:15 -05:00
|
|
|
if(SIBLING_SEARCH AND NOT opm-common_DIR)
|
|
|
|
# guess the sibling dir
|
|
|
|
get_filename_component(_leaf_dir_name ${PROJECT_BINARY_DIR} NAME)
|
|
|
|
get_filename_component(_parent_full_dir ${PROJECT_BINARY_DIR} DIRECTORY)
|
|
|
|
get_filename_component(_parent_dir_name ${_parent_full_dir} NAME)
|
|
|
|
#Try if <module-name>/<build-dir> is used
|
|
|
|
get_filename_component(_modules_dir ${_parent_full_dir} DIRECTORY)
|
|
|
|
if(IS_DIRECTORY ${_modules_dir}/opm-common/${_leaf_dir_name})
|
|
|
|
set(opm-common_DIR ${_modules_dir}/opm-common/${_leaf_dir_name})
|
2017-09-15 04:34:22 -05:00
|
|
|
else()
|
2017-09-25 05:24:15 -05:00
|
|
|
string(REPLACE ${PROJECT_NAME} opm-common _opm_common_leaf ${_leaf_dir_name})
|
|
|
|
if(NOT _leaf_dir_name STREQUAL _opm_common_leaf
|
|
|
|
AND IS_DIRECTORY ${_parent_full_dir}/${_opm_common_leaf})
|
|
|
|
# We are using build directories named <prefix><module-name><postfix>
|
|
|
|
set(opm-common_DIR ${_parent_full_dir}/${_opm_common_leaf})
|
|
|
|
elseif(IS_DIRECTORY ${_parent_full_dir}/opm-common)
|
|
|
|
# All modules are in a common build dir
|
|
|
|
set(opm-common_DIR "${_parent_full_dir}/opm-common}")
|
2017-09-15 04:34:22 -05:00
|
|
|
endif()
|
2017-09-15 04:21:59 -05:00
|
|
|
endif()
|
2017-09-26 09:16:41 -05:00
|
|
|
endif()
|
|
|
|
if(opm-common_DIR AND NOT IS_DIRECTORY ${opm-common_DIR})
|
|
|
|
message(WARNING "Value ${opm-common_DIR} passed to variable"
|
|
|
|
" opm-common_DIR is not a directory")
|
2017-09-25 05:24:15 -05:00
|
|
|
endif()
|
2015-03-06 05:33:43 -06:00
|
|
|
|
2017-09-25 05:24:15 -05:00
|
|
|
find_package(opm-common REQUIRED)
|
2015-03-06 05:33:43 -06:00
|
|
|
|
2017-09-25 05:24:15 -05:00
|
|
|
include(OpmInit)
|
2015-03-06 05:33:43 -06:00
|
|
|
|
2013-07-30 07:11:26 -05:00
|
|
|
# not the same location as most of the other projects; this hook overrides
|
|
|
|
macro (dir_hook)
|
|
|
|
set (doxy_dir "Documentation")
|
|
|
|
endmacro (dir_hook)
|
|
|
|
|
2013-07-04 17:58:29 -05:00
|
|
|
# list of prerequisites for this particular project; this is in a
|
|
|
|
# separate file (in cmake/Modules sub-directory) because it is shared
|
|
|
|
# with the find module
|
2015-03-06 05:33:43 -06:00
|
|
|
include ( ${project}-prereqs )
|
2013-07-04 17:58:29 -05:00
|
|
|
|
|
|
|
# read the list of components from this file (in the project directory);
|
|
|
|
# it should set various lists with the names of the files to include
|
|
|
|
include (CMakeLists_files.cmake)
|
|
|
|
|
2013-08-05 14:00:02 -05:00
|
|
|
macro (config_hook)
|
2014-08-06 07:00:54 -05:00
|
|
|
opm_need_version_of ("dune-common")
|
2014-03-19 09:15:55 -05:00
|
|
|
opm_need_version_of ("dune-istl")
|
2013-08-05 14:00:02 -05:00
|
|
|
endmacro (config_hook)
|
|
|
|
|
2013-06-29 15:10:48 -05:00
|
|
|
macro (prereqs_hook)
|
|
|
|
endmacro (prereqs_hook)
|
2013-06-25 16:55:58 -05:00
|
|
|
|
2013-06-29 15:10:48 -05:00
|
|
|
macro (sources_hook)
|
2013-06-25 16:55:58 -05:00
|
|
|
# these solvers are only compiled in if their dependency is 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)
|
|
|
|
|
2014-04-07 12:28:06 -05:00
|
|
|
if ((NOT MPI_FOUND) OR (NOT DUNE_ISTL_FOUND))
|
2014-04-07 11:37:55 -05:00
|
|
|
list (REMOVE_ITEM tests_SOURCES
|
|
|
|
${PROJECT_SOURCE_DIR}/tests/test_parallel_linearsolver.cpp
|
2015-01-21 08:44:20 -06:00
|
|
|
${PROJECT_SOURCE_DIR}/tests/test_parallelistlinformation.cpp
|
2014-03-20 15:50:09 -05:00
|
|
|
)
|
2014-04-07 12:28:06 -05:00
|
|
|
endif ((NOT MPI_FOUND) OR (NOT DUNE_ISTL_FOUND))
|
2014-03-20 15:50:09 -05:00
|
|
|
|
2013-06-25 16:55:58 -05:00
|
|
|
# we are not supposed to include the TinyXML test prog. regardless
|
2013-02-07 16:56:28 -06:00
|
|
|
list (REMOVE_ITEM opm-core_SOURCES
|
2013-06-25 16:55:58 -05:00
|
|
|
${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/utility/parameters/tinyxml/xmltest.cpp
|
2013-02-11 05:52:52 -06:00
|
|
|
)
|
2013-06-15 15:11:14 -05:00
|
|
|
|
2013-06-25 16:55:58 -05:00
|
|
|
# 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 "${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/utility/parameters/tinyxml/tinystr.h")
|
|
|
|
list (REMOVE_ITEM opm-core_HEADERS "${PROJECT_SOURCE_DIR}/${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)
|
2013-06-29 15:10:48 -05:00
|
|
|
endmacro (sources_hook)
|
2013-06-25 16:55:58 -05:00
|
|
|
|
2013-06-29 15:10:48 -05:00
|
|
|
macro (fortran_hook)
|
|
|
|
endmacro (fortran_hook)
|
2013-06-25 16:55:58 -05:00
|
|
|
|
2014-06-16 07:40:52 -05:00
|
|
|
macro (files_hook)
|
|
|
|
endmacro (files_hook)
|
|
|
|
|
2013-06-29 15:10:48 -05:00
|
|
|
macro (tests_hook)
|
2013-06-25 16:55:58 -05:00
|
|
|
cond_disable_test ("ERT")
|
2013-06-29 15:10:48 -05:00
|
|
|
endmacro (tests_hook)
|
2013-06-25 16:55:58 -05:00
|
|
|
|
2013-08-14 14:19:41 -05:00
|
|
|
macro (install_hook)
|
|
|
|
# # copy the cmake macros to system when installing
|
|
|
|
# install (
|
|
|
|
# DIRECTORY cmake
|
|
|
|
# DESTINATION share/opm
|
|
|
|
# )
|
|
|
|
endmacro (install_hook)
|
|
|
|
|
2013-06-25 16:55:58 -05:00
|
|
|
# all setup common to the OPM library modules is done here
|
|
|
|
include (OpmLibMain)
|