2012-11-14 12:45:48 +01: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:
|
|
|
|
|
cmake_minimum_required (VERSION 2.8)
|
|
|
|
|
project (opm-core)
|
2012-11-15 11:36:50 +01:00
|
|
|
set (opm-core_MAJOR_VERSION 0)
|
|
|
|
|
set (opm-core_MINOR_VERSION 3)
|
2012-11-14 12:45:48 +01:00
|
|
|
enable_language (CXX)
|
|
|
|
|
|
|
|
|
|
# all public header files are together with the source
|
|
|
|
|
set (opm-core_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}")
|
|
|
|
|
|
2012-11-14 12:46:35 +01:00
|
|
|
# additional search modules
|
|
|
|
|
list (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules")
|
|
|
|
|
|
2012-11-28 10:44:54 +01:00
|
|
|
# macro to set standard variables (INCLUDE_DIRS, LIBRARIES etc.)
|
|
|
|
|
include (UseOpmFind)
|
|
|
|
|
|
2012-11-16 14:40:54 +01:00
|
|
|
# compile with C++0x/11 support if available
|
|
|
|
|
find_package (CXX11Features REQUIRED)
|
|
|
|
|
|
2012-11-16 23:21:04 +01:00
|
|
|
# blas/lapack
|
|
|
|
|
find_and_append_package (BLAS REQUIRED)
|
|
|
|
|
find_and_append_package (LAPACK REQUIRED)
|
|
|
|
|
|
2012-11-14 12:45:48 +01:00
|
|
|
# put libraries in lib/
|
|
|
|
|
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
|
|
|
|
|
|
|
|
|
# find all the source code
|
|
|
|
|
file (GLOB_RECURSE opm-core_SOURCES "opm/*.c" "opm/*.cpp")
|
|
|
|
|
|
2012-11-14 12:51:19 +01:00
|
|
|
# these files are provided in source control, but can only compile with Matlab
|
|
|
|
|
# available
|
|
|
|
|
list (REMOVE_ITEM opm-core_SOURCES
|
|
|
|
|
${PROJECT_SOURCE_DIR}/opm/core/grid/cpgpreprocess/mxgrdecl.c
|
|
|
|
|
${PROJECT_SOURCE_DIR}/opm/core/grid/cpgpreprocess/processgrid.c
|
|
|
|
|
${PROJECT_SOURCE_DIR}/opm/core/utility/parameters/tinyxml/xmltest.cpp
|
|
|
|
|
${PROJECT_SOURCE_DIR}/opm/core/linalg/LinearSolverAGMG.cpp
|
|
|
|
|
)
|
|
|
|
|
|
2012-11-14 12:46:35 +01:00
|
|
|
# we don't try to find any of these
|
|
|
|
|
set (HAVE_AGMG 0)
|
|
|
|
|
set (HAVE_DUNE_ISTL 0)
|
|
|
|
|
set (HAVE_DYNAMIC_BOOST_TEST 0)
|
|
|
|
|
set (HAVE_ERT)
|
|
|
|
|
set (HAVE_SUITESPARSE_UMFPACK_H 0)
|
|
|
|
|
|
|
|
|
|
# create configuration header which describes available features
|
|
|
|
|
# necessary to compile this library
|
|
|
|
|
include (UseConfigVars)
|
|
|
|
|
list (APPEND opm-core_CONFIG_VARS
|
|
|
|
|
"HAVE_AGMG"
|
|
|
|
|
"HAVE_DUNE_ISTL"
|
|
|
|
|
"HAVE_DYNAMIC_BOOST_TEST"
|
|
|
|
|
"HAVE_ERT"
|
|
|
|
|
"HAVE_SUITESPARSE_UMFPACK_H"
|
2012-11-16 14:40:54 +01:00
|
|
|
"/* C++0x/11 support */"
|
|
|
|
|
"HAVE_NULLPTR"
|
|
|
|
|
"HAVE_STATIC_ASSERT"
|
2012-11-14 12:46:35 +01:00
|
|
|
)
|
|
|
|
|
configure_vars (
|
|
|
|
|
FILE "${PROJECT_BINARY_DIR}/config.h"
|
|
|
|
|
WRITE ${opm-core_CONFIG_VARS}
|
|
|
|
|
)
|
|
|
|
|
|
2012-11-28 10:44:54 +01:00
|
|
|
# some CMake properties do not do list expansion
|
|
|
|
|
list (REMOVE_DUPLICATES opm-core_LINKER_FLAGS)
|
|
|
|
|
string (REPLACE ";" " " opm-core_LINKER_FLAGS_STR "${opm-core_LINKER_FLAGS}")
|
|
|
|
|
remove_duplicate_libraries (opm-core)
|
|
|
|
|
|
2012-11-14 12:45:48 +01:00
|
|
|
# create this library
|
|
|
|
|
include_directories (${opm-core_INCLUDE_DIRS})
|
2012-11-28 10:44:54 +01:00
|
|
|
add_definitions (${opm-core_DEFINITIONS})
|
2012-11-14 12:45:48 +01:00
|
|
|
add_library (opmcore SHARED ${opm-core_SOURCES})
|
2012-11-15 11:36:50 +01:00
|
|
|
set_target_properties (opmcore PROPERTIES
|
|
|
|
|
SOVERSION ${opm-core_MAJOR_VERSION}
|
|
|
|
|
VERSION ${opm-core_MAJOR_VERSION}.${opm-core_MINOR_VERSION}
|
2012-11-28 10:44:54 +01:00
|
|
|
LINK_FLAGS "${opm-core_LINKER_FLAGS_STR}"
|
2012-11-15 11:36:50 +01:00
|
|
|
)
|
2012-11-28 10:44:54 +01:00
|
|
|
target_link_libraries (opmcore ${opm-core_LIBRARIES})
|