2013-05-15 03:40:00 -05: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-08-02 07:07:33 -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 #
|
|
|
|
# #
|
|
|
|
###########################################################################
|
2013-05-15 03:40:00 -05:00
|
|
|
|
|
|
|
cmake_minimum_required (VERSION 2.8)
|
|
|
|
|
2015-09-08 04:56:28 -05:00
|
|
|
set( OPM_COMMON_ROOT "" CACHE PATH "Root directory containing OPM related cmake modules")
|
2015-05-27 04:51:28 -05:00
|
|
|
option(SIBLING_SEARCH "Search for other modules in sibling directories?" ON)
|
2015-10-19 08:21:08 -05:00
|
|
|
set( USE_OPENMP_DEFAULT OFF ) # Use of OpenMP is considered experimental
|
2015-03-18 08:26:29 -05:00
|
|
|
|
2015-09-08 04:56:28 -05:00
|
|
|
if(NOT OPM_COMMON_ROOT)
|
2015-09-08 03:47:05 -05:00
|
|
|
find_package(opm-common QUIET)
|
2015-05-27 03:48:30 -05:00
|
|
|
endif()
|
2015-03-18 08:26:29 -05:00
|
|
|
|
2015-09-08 03:47:05 -05:00
|
|
|
if (opm-common_FOUND)
|
2015-05-27 03:48:30 -05:00
|
|
|
include(OpmInit)
|
2015-03-18 08:26:29 -05:00
|
|
|
else()
|
2015-09-16 07:22:24 -05:00
|
|
|
unset(opm-common_FOUND)
|
|
|
|
|
2015-09-08 04:56:28 -05:00
|
|
|
if (NOT OPM_COMMON_ROOT AND SIBLING_SEARCH)
|
|
|
|
set(OPM_COMMON_ROOT ${PROJECT_SOURCE_DIR}/../opm-common)
|
2015-05-27 04:51:28 -05:00
|
|
|
endif()
|
2015-09-08 04:56:28 -05:00
|
|
|
if (OPM_COMMON_ROOT)
|
|
|
|
list( APPEND CMAKE_MODULE_PATH "${OPM_COMMON_ROOT}/cmake/Modules")
|
2015-03-18 08:26:29 -05:00
|
|
|
include (OpmInit OPTIONAL RESULT_VARIABLE OPM_INIT)
|
2015-09-08 04:56:28 -05:00
|
|
|
set( OPM_MACROS_ROOT ${OPM_COMMON_ROOT} )
|
2015-03-18 08:26:29 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT OPM_INIT)
|
2015-05-27 03:48:30 -05:00
|
|
|
message( "" )
|
2015-09-08 04:56:28 -05:00
|
|
|
message( " /---------------------------------------------------------------------------------\\")
|
|
|
|
message( " | Could not locate the opm build macros. The opm build macros |")
|
|
|
|
message( " | are in a separate repository - instructions to proceed: |")
|
|
|
|
message( " | |")
|
|
|
|
message( " | 1. Clone the repository: git clone git@github.com:OPM/opm-common.git |")
|
|
|
|
message( " | |")
|
|
|
|
message( " | 2. Run cmake in the current project with -DOPM_COMMON_ROOT=<path>/opm-common |")
|
|
|
|
message( " | |")
|
|
|
|
message( " \\---------------------------------------------------------------------------------/")
|
2015-05-27 03:48:30 -05:00
|
|
|
message( "" )
|
2015-03-18 08:26:29 -05:00
|
|
|
message( FATAL_ERROR "Could not find OPM Macros")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endif()
|
2013-05-15 03:40:00 -05:00
|
|
|
|
2015-10-21 10:35:44 -05:00
|
|
|
|
2013-08-02 07:07:33 -05:00
|
|
|
# not the same location as most of the other projects? this hook overrides
|
|
|
|
macro (dir_hook)
|
|
|
|
endmacro (dir_hook)
|
2013-05-15 03:40:00 -05:00
|
|
|
|
2013-08-02 07:07:33 -05:00
|
|
|
# project information is in dune.module. Read this file and set variables.
|
|
|
|
# we cannot generate dune.module since it is read by dunecontrol before
|
|
|
|
# the build starts, so it makes sense to keep the data there then.
|
|
|
|
include (OpmInit)
|
2013-05-15 03:40:00 -05:00
|
|
|
|
2015-10-21 10:35:44 -05:00
|
|
|
# Look for the opm-data repository; if found the variable
|
|
|
|
# HAVE_OPM_DATA will be set to true.
|
|
|
|
include( Findopm-data )
|
|
|
|
|
2013-08-02 07:07:33 -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-05-15 08:43:03 -05:00
|
|
|
include ("${project}-prereqs")
|
2013-05-15 03:40:00 -05:00
|
|
|
|
2013-08-02 07:07:33 -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-05-15 03:40:00 -05:00
|
|
|
|
2013-08-02 07:07:33 -05:00
|
|
|
macro (config_hook)
|
2014-04-09 17:59:31 -05:00
|
|
|
opm_need_version_of ("dune-common")
|
2014-09-30 06:46:01 -05:00
|
|
|
opm_need_version_of ("dune-istl")
|
2016-06-06 08:40:06 -05:00
|
|
|
opm_need_version_of ("ewoms")
|
2013-08-02 07:07:33 -05:00
|
|
|
endmacro (config_hook)
|
2013-05-15 03:40:00 -05:00
|
|
|
|
2013-08-02 07:07:33 -05:00
|
|
|
macro (prereqs_hook)
|
|
|
|
endmacro (prereqs_hook)
|
2013-05-15 03:40:00 -05:00
|
|
|
|
2013-08-02 07:07:33 -05:00
|
|
|
macro (sources_hook)
|
2016-04-05 08:17:17 -05:00
|
|
|
if(OPM_GRID_FOUND OR opm-grid_FOUND)
|
2014-02-20 06:17:18 -06:00
|
|
|
list (APPEND examples_SOURCES
|
2015-10-12 03:59:01 -05:00
|
|
|
${PROJECT_SOURCE_DIR}/examples/flow_mpi.cpp
|
2015-11-25 06:15:06 -06:00
|
|
|
${PROJECT_SOURCE_DIR}/examples/flow_multisegment_mpi.cpp
|
2014-04-09 17:56:09 -05:00
|
|
|
)
|
2016-05-02 03:25:11 -05:00
|
|
|
list (APPEND examples_SOURCES_DIST
|
|
|
|
${PROJECT_SOURCE_DIR}/examples/flow_mpi.cpp
|
|
|
|
)
|
2014-02-20 06:17:18 -06:00
|
|
|
endif()
|
2013-08-02 07:07:33 -05:00
|
|
|
endmacro (sources_hook)
|
2013-05-15 03:40:00 -05:00
|
|
|
|
2013-08-02 07:07:33 -05:00
|
|
|
macro (fortran_hook)
|
|
|
|
endmacro (fortran_hook)
|
2013-05-15 03:40:00 -05:00
|
|
|
|
2014-06-16 07:40:52 -05:00
|
|
|
macro (files_hook)
|
|
|
|
endmacro (files_hook)
|
|
|
|
|
2013-08-02 07:07:33 -05:00
|
|
|
macro (tests_hook)
|
|
|
|
endmacro (tests_hook)
|
2013-05-15 03:40:00 -05:00
|
|
|
|
2013-08-02 07:07:33 -05:00
|
|
|
# all setup common to the OPM library modules is done here
|
|
|
|
include (OpmLibMain)
|
2013-05-15 03:40:00 -05:00
|
|
|
|
2013-08-02 07:07:33 -05:00
|
|
|
# download Eigen if user doesn't have the correct version
|
2013-07-09 04:37:56 -05:00
|
|
|
if (NOT EIGEN3_FOUND)
|
2013-08-02 07:07:33 -05:00
|
|
|
message (STATUS "Downloading Eigen3")
|
|
|
|
include (ExternalProject)
|
|
|
|
externalProject_Add (Eigen3
|
|
|
|
GIT_REPOSITORY git://github.com/OPM/eigen3
|
2014-05-21 06:57:16 -05:00
|
|
|
UPDATE_COMMAND git checkout 9e788db99d73f3199ade74bfda8d9f73fdfbbe4c
|
2013-08-02 07:07:33 -05:00
|
|
|
CMAKE_ARGS -DEIGEN_TEST_NO_OPENGL=1 -DEIGEN_BUILD_PKGCONFIG=0 -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/eigen3-installed
|
|
|
|
)
|
|
|
|
|
|
|
|
include_directories (${CMAKE_BINARY_DIR}/eigen3-installed/include/eigen3)
|
2016-04-08 13:33:18 -05:00
|
|
|
add_dependencies (opmsimulators Eigen3)
|
2013-07-09 04:37:56 -05:00
|
|
|
endif (NOT EIGEN3_FOUND)
|
2015-10-21 10:35:44 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (HAVE_OPM_DATA)
|
2016-11-21 11:02:21 -06:00
|
|
|
include (${CMAKE_CURRENT_SOURCE_DIR}/compareECLFiles.cmake)
|
2017-03-03 08:08:12 -06:00
|
|
|
endif()
|
2016-11-04 09:30:37 -05:00
|
|
|
|
|
|
|
# create a symbolic link from flow to flow_legacy
|
|
|
|
ADD_CUSTOM_TARGET(flow ALL
|
2016-11-04 09:30:37 -05:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E create_symlink "flow_legacy" "${CMAKE_BINARY_DIR}/bin/flow")
|
2016-11-04 09:30:37 -05:00
|
|
|
|