mirror of
https://github.com/OPM/opm-upscaling.git
synced 2025-02-25 18:45:23 -06:00
Various improvements in the build process
Allow uppercase alternatives, fix whitespace bug, allow empty pre- compiled header, find OpenMP
This commit is contained in:
parent
3af27c2130
commit
8ee3058af9
@ -43,16 +43,18 @@ function (add_options langs builds)
|
|||||||
# remove it first
|
# remove it first
|
||||||
string (REPLACE "${_opt}" "" _without "${${_var}}")
|
string (REPLACE "${_opt}" "" _without "${${_var}}")
|
||||||
string (STRIP "${_without}" _without)
|
string (STRIP "${_without}" _without)
|
||||||
|
# we need to strip this one as well, so they are comparable
|
||||||
|
string (STRIP "${${_var}}" _stripped)
|
||||||
# if it wasn't there, then add it at the end
|
# if it wasn't there, then add it at the end
|
||||||
if ("${_without}" STREQUAL "${${_var}}")
|
if ("${_without}" STREQUAL "${_stripped}")
|
||||||
# don't add any extra spaces if no options yet are set
|
# don't add any extra spaces if no options yet are set
|
||||||
if (NOT ${${_var}} STREQUAL "")
|
if (NOT ${_stripped} STREQUAL "")
|
||||||
set (${_var} "${${_var}} ${_opt}")
|
set (${_var} "${_stripped} ${_opt}")
|
||||||
else (NOT ${${_var}} STREQUAL "")
|
else (NOT ${_stripped} STREQUAL "")
|
||||||
set (${_var} "${_opt}")
|
set (${_var} "${_opt}")
|
||||||
endif (NOT ${${_var}} STREQUAL "")
|
endif (NOT ${_stripped} STREQUAL "")
|
||||||
set (${_var} "${${_var}}" PARENT_SCOPE)
|
set (${_var} "${${_var}}" PARENT_SCOPE)
|
||||||
endif ("${_without}" STREQUAL "${${_var}}")
|
endif ("${_without}" STREQUAL "${_stripped}")
|
||||||
endforeach (_opt)
|
endforeach (_opt)
|
||||||
endforeach (build)
|
endforeach (build)
|
||||||
endforeach (lang)
|
endforeach (lang)
|
||||||
|
44
cmake/Modules/Duplicates.cmake
Normal file
44
cmake/Modules/Duplicates.cmake
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# - Remove duplicate library declarations
|
||||||
|
#
|
||||||
|
# Synopsis:
|
||||||
|
#
|
||||||
|
# remove_duplicate_libraries (module)
|
||||||
|
#
|
||||||
|
# where
|
||||||
|
# module Name of the module whose libraries should be pruned
|
||||||
|
|
||||||
|
# Copyright (C) 2013 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)
|
||||||
|
|
||||||
|
# headers can be trimmed from the end, since adding a directory to
|
||||||
|
# the list is an idempotent action
|
||||||
|
macro (remove_duplicate_headers module)
|
||||||
|
if (DEFINED ${module}_INCLUDE_DIRS)
|
||||||
|
list (REMOVE_DUPLICATES ${module}_INCLUDE_DIRS)
|
||||||
|
endif (DEFINED ${module}_INCLUDE_DIRS)
|
||||||
|
endmacro (remove_duplicate_headers module)
|
||||||
|
|
||||||
|
# linker flags may not be specified at all
|
||||||
|
macro (remove_duplicate_flags module)
|
||||||
|
if (DEFINED ${module}_LINKER_FLAGS)
|
||||||
|
list (REMOVE_DUPLICATES ${module}_LINKER_FLAGS)
|
||||||
|
endif (DEFINED ${module}_LINKER_FLAGS)
|
||||||
|
endmacro (remove_duplicate_flags module)
|
||||||
|
|
||||||
|
# fix up both headers and libraries, in case two dependencies have
|
||||||
|
# included the same second-level library independently
|
||||||
|
macro (remove_dup_deps module)
|
||||||
|
remove_duplicate_headers (${module})
|
||||||
|
remove_duplicate_libraries (${module})
|
||||||
|
remove_duplicate_flags (${module})
|
||||||
|
endmacro (remove_dup_deps module)
|
@ -118,21 +118,8 @@ endif (UNIX)
|
|||||||
# dependencies
|
# dependencies
|
||||||
|
|
||||||
# parallel programming
|
# parallel programming
|
||||||
# enabling OpenMP is supposedly enough to make the compiler link with
|
include (UseOpenMP)
|
||||||
# the appropriate libraries
|
find_openmp (ERT)
|
||||||
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
|
# compression library
|
||||||
find_package (ZLIB ${ERT_QUIET})
|
find_package (ZLIB ${ERT_QUIET})
|
||||||
@ -166,19 +153,8 @@ endif (UNIX)
|
|||||||
# since OpenMP often implies pthreads, we need to tidy up
|
# since OpenMP often implies pthreads, we need to tidy up
|
||||||
# (last instance of library must be left standing, thus reversing that
|
# (last instance of library must be left standing, thus reversing that
|
||||||
# list before removing duplicates)
|
# list before removing duplicates)
|
||||||
if (ERT_INCLUDE_DIRS)
|
include (Duplicates)
|
||||||
list (REMOVE_DUPLICATES ERT_INCLUDE_DIRS)
|
remove_dup_deps (ERT)
|
||||||
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
|
# see if we can compile a minimum example
|
||||||
# CMake logical test doesn't handle lists (sic)
|
# CMake logical test doesn't handle lists (sic)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# SuperLU must be a version released after the year 2005.
|
# SuperLU must be a version released after the year 2005.
|
||||||
#
|
#
|
||||||
# Variables used by this module which you may want to set:
|
# Variables used by this module which you may want to set:
|
||||||
# SUPERLU_PREFIX Path list to search for SuperLU
|
# SUPERLU_ROOT Path list to search for SuperLU
|
||||||
#
|
#
|
||||||
# Sets the follwing variable:
|
# Sets the follwing variable:
|
||||||
#
|
#
|
||||||
@ -38,7 +38,7 @@ endif(NOT BLAS_FOUND)
|
|||||||
# look for header files, only at positions given by the user
|
# look for header files, only at positions given by the user
|
||||||
find_path(SUPERLU_INCLUDE_DIR
|
find_path(SUPERLU_INCLUDE_DIR
|
||||||
NAMES supermatrix.h
|
NAMES supermatrix.h
|
||||||
PATHS ${SUPERLU_PREFIX}
|
PATHS ${SUPERLU_PREFIX} ${SUPERLU_ROOT}
|
||||||
PATH_SUFFIXES "superlu" "include/superlu" "include" "SRC"
|
PATH_SUFFIXES "superlu" "include/superlu" "include" "SRC"
|
||||||
NO_DEFAULT_PATH
|
NO_DEFAULT_PATH
|
||||||
)
|
)
|
||||||
@ -52,7 +52,7 @@ find_path(SUPERLU_INCLUDE_DIR
|
|||||||
# look for library, only at positions given by the user
|
# look for library, only at positions given by the user
|
||||||
find_library(SUPERLU_LIBRARY
|
find_library(SUPERLU_LIBRARY
|
||||||
NAMES "superlu_4.3" "superlu_4.2" "superlu_4.1" "superlu_4.0" "superlu_3.1" "superlu_3.0" "superlu"
|
NAMES "superlu_4.3" "superlu_4.2" "superlu_4.1" "superlu_4.0" "superlu_3.1" "superlu_3.0" "superlu"
|
||||||
PATHS ${SUPERLU_PREFIX}
|
PATHS ${SUPERLU_PREFIX} ${SUPERLU_ROOT}
|
||||||
PATH_SUFFIXES "lib" "lib32" "lib64" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
PATH_SUFFIXES "lib" "lib32" "lib64" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||||
NO_DEFAULT_PATH
|
NO_DEFAULT_PATH
|
||||||
)
|
)
|
||||||
|
@ -14,12 +14,14 @@ macro (opm_defaults opm)
|
|||||||
else (DEFINED BUILD_SHARED_LIBS)
|
else (DEFINED BUILD_SHARED_LIBS)
|
||||||
set (_shared_def OFF)
|
set (_shared_def OFF)
|
||||||
endif (DEFINED BUILD_SHARED_LIBS)
|
endif (DEFINED BUILD_SHARED_LIBS)
|
||||||
option (BUILD_${${opm}_NAME}_SHARED "Build ${${opm}_NAME} as a shared library" ${_shared_def})
|
string (TOUPPER "${${opm}_NAME}" opm_UPPER)
|
||||||
if (BUILD_${${opm}_NAME}_SHARED)
|
string (REPLACE "-" "_" opm_UPPER "${opm_UPPER}")
|
||||||
|
option (BUILD_${opm_UPPER}_SHARED "Build ${${opm}_NAME} as a shared library" ${_shared_def})
|
||||||
|
if (BUILD_${opm_UPPER}_SHARED)
|
||||||
set (${opm}_LIBRARY_TYPE SHARED)
|
set (${opm}_LIBRARY_TYPE SHARED)
|
||||||
else (BUILD_${${opm}_NAME}_SHARED)
|
else (BUILD_${opm_UPPER}_SHARED)
|
||||||
set (${opm}_LIBRARY_TYPE STATIC)
|
set (${opm}_LIBRARY_TYPE STATIC)
|
||||||
endif (BUILD_${${opm}_NAME}_SHARED)
|
endif (BUILD_${opm_UPPER}_SHARED)
|
||||||
|
|
||||||
# precompile standard headers to speed up compilation
|
# precompile standard headers to speed up compilation
|
||||||
# unfortunately, this functionality is buggy and tends to segfault at
|
# unfortunately, this functionality is buggy and tends to segfault at
|
||||||
|
@ -31,16 +31,8 @@
|
|||||||
# "Boost COMPONENTS filesystem REQUIRED"
|
# "Boost COMPONENTS filesystem REQUIRED"
|
||||||
# SUPERLU
|
# SUPERLU
|
||||||
# )
|
# )
|
||||||
########################################################################
|
|
||||||
#
|
include (Duplicates)
|
||||||
# - 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
|
# list of suffixes for all the project variables
|
||||||
set (_opm_proj_vars
|
set (_opm_proj_vars
|
||||||
@ -108,13 +100,3 @@ endmacro (find_and_append_package_list_to prefix)
|
|||||||
macro (find_and_append_package_list)
|
macro (find_and_append_package_list)
|
||||||
find_and_append_package_list_to (${CMAKE_PROJECT_NAME} ${ARGN})
|
find_and_append_package_list_to (${CMAKE_PROJECT_NAME} ${ARGN})
|
||||||
endmacro (find_and_append_package_list)
|
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)
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
# ${module}_LIBRARIES Directory of shared object files
|
# ${module}_LIBRARIES Directory of shared object files
|
||||||
# ${module}_DEFINITIONS Defines that must be set to compile
|
# ${module}_DEFINITIONS Defines that must be set to compile
|
||||||
# ${module}_CONFIG_VARS List of defines that should be in config.h
|
# ${module}_CONFIG_VARS List of defines that should be in config.h
|
||||||
|
# ${module}_QUIET Verbosity of last find of this module
|
||||||
# HAVE_${MODULE} Binary value to use in config.h
|
# HAVE_${MODULE} Binary value to use in config.h
|
||||||
#
|
#
|
||||||
# Note: Arguments should be quoted, otherwise a list will spill into the
|
# Note: Arguments should be quoted, otherwise a list will spill into the
|
||||||
@ -36,16 +37,7 @@
|
|||||||
|
|
||||||
# <http://www.vtk.org/Wiki/CMake:How_To_Find_Libraries>
|
# <http://www.vtk.org/Wiki/CMake:How_To_Find_Libraries>
|
||||||
|
|
||||||
# libraries should always be trimmed from the beginning, so that also
|
include (Duplicates)
|
||||||
# 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
|
# append all items from src into dst; both must be *names* of lists
|
||||||
macro (append_found src dst)
|
macro (append_found src dst)
|
||||||
foreach (_item IN LISTS ${src})
|
foreach (_item IN LISTS ${src})
|
||||||
@ -56,6 +48,13 @@ macro (append_found src dst)
|
|||||||
endmacro (append_found src dst)
|
endmacro (append_found src dst)
|
||||||
|
|
||||||
function (find_opm_package module deps header lib defs prog conf)
|
function (find_opm_package module deps header lib defs prog conf)
|
||||||
|
# variables to pass on to other packages
|
||||||
|
if (FIND_QUIETLY)
|
||||||
|
set (${module}_QUIET "QUIET")
|
||||||
|
else (FIND_QUIETLY)
|
||||||
|
set (${module}_QUIET "")
|
||||||
|
endif (FIND_QUIETLY)
|
||||||
|
|
||||||
# if someone else has included this test, don't do it again
|
# if someone else has included this test, don't do it again
|
||||||
if (${${module}_FOUND})
|
if (${${module}_FOUND})
|
||||||
return ()
|
return ()
|
||||||
@ -80,12 +79,17 @@ function (find_opm_package module deps header lib defs prog conf)
|
|||||||
set (${module}_DEFINITIONS ${PkgConf_${module}_CFLAGS_OTHER})
|
set (${module}_DEFINITIONS ${PkgConf_${module}_CFLAGS_OTHER})
|
||||||
set (${module}_LINKER_FLAG ${PkgConf_${module}_LDFLAGS_OTHER})
|
set (${module}_LINKER_FLAG ${PkgConf_${module}_LDFLAGS_OTHER})
|
||||||
|
|
||||||
|
# in addition to accepting mod-ule_ROOT, we also accept the somewhat
|
||||||
|
# more idiomatic MOD_ULE_ROOT variant
|
||||||
|
string (TOUPPER ${module} MODULE_UPPER)
|
||||||
|
string (REPLACE "-" "_" MODULE ${MODULE_UPPER})
|
||||||
|
|
||||||
# if the user hasn't specified any location, and it isn't found
|
# if the user hasn't specified any location, and it isn't found
|
||||||
# in standard system locations either, then start to wander
|
# in standard system locations either, then start to wander
|
||||||
# about and look for it in proximity to ourself. Qt Creator likes
|
# about and look for it in proximity to ourself. Qt Creator likes
|
||||||
# to put the build-directories as siblings to the source trees,
|
# to put the build-directories as siblings to the source trees,
|
||||||
# but with a -build suffix
|
# but with a -build suffix
|
||||||
if (NOT (${module}_DIR OR ${module}_ROOT))
|
if (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT))
|
||||||
string (TOLOWER "${module}" _module_lower)
|
string (TOLOWER "${module}" _module_lower)
|
||||||
set (_guess
|
set (_guess
|
||||||
"../${module}"
|
"../${module}"
|
||||||
@ -97,7 +101,7 @@ function (find_opm_package module deps header lib defs prog conf)
|
|||||||
foreach (_item IN ITEMS ${_guess})
|
foreach (_item IN ITEMS ${_guess})
|
||||||
list (APPEND _guess_bin "${PROJECT_BINARY_DIR}/${_item}")
|
list (APPEND _guess_bin "${PROJECT_BINARY_DIR}/${_item}")
|
||||||
endforeach (_item)
|
endforeach (_item)
|
||||||
endif (NOT (${module}_DIR OR ${module}_ROOT))
|
endif (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT))
|
||||||
|
|
||||||
# search for this include and library file to get the installation
|
# search for this include and library file to get the installation
|
||||||
# directory of the package; hints are searched before the system locations,
|
# directory of the package; hints are searched before the system locations,
|
||||||
@ -105,7 +109,7 @@ function (find_opm_package module deps header lib defs prog conf)
|
|||||||
find_path (${module}_INCLUDE_DIR
|
find_path (${module}_INCLUDE_DIR
|
||||||
NAMES "${header}"
|
NAMES "${header}"
|
||||||
PATHS ${_guess}
|
PATHS ${_guess}
|
||||||
HINTS ${${module}_DIR} ${${module}_ROOT} ${PkgConf_${module}_INCLUDE_DIRS}
|
HINTS ${${module}_DIR} ${${module}_ROOT} ${${MODULE}_ROOT} ${PkgConf_${module}_INCLUDE_DIRS}
|
||||||
PATH_SUFFIXES "include"
|
PATH_SUFFIXES "include"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -114,7 +118,7 @@ function (find_opm_package module deps header lib defs prog conf)
|
|||||||
find_library (${module}_LIBRARY
|
find_library (${module}_LIBRARY
|
||||||
NAMES "${lib}"
|
NAMES "${lib}"
|
||||||
PATHS ${_guess_bin}
|
PATHS ${_guess_bin}
|
||||||
HINTS ${${module}_DIR} ${${module}_ROOT} ${PkgConf_${module}_LIBRARY_DIRS}
|
HINTS ${${module}_DIR} ${${module}_ROOT} ${${MODULE}_ROOT} ${PkgConf_${module}_LIBRARY_DIRS}
|
||||||
PATH_SUFFIXES "lib" "lib/.libs" ".libs" "lib32" "lib64" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
PATH_SUFFIXES "lib" "lib/.libs" ".libs" "lib32" "lib64" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||||
)
|
)
|
||||||
else (NOT "${lib}" STREQUAL "")
|
else (NOT "${lib}" STREQUAL "")
|
||||||
@ -175,13 +179,11 @@ function (find_opm_package module deps header lib defs prog conf)
|
|||||||
include (CheckCXXSourceCompiles)
|
include (CheckCXXSourceCompiles)
|
||||||
# only add these if they are actually found; otherwise it won't
|
# only add these if they are actually found; otherwise it won't
|
||||||
# compile and the variable won't be set
|
# compile and the variable won't be set
|
||||||
append_found (${module}_INCLUDE_DIR CMAKE_REQUIRED_INCLUDES)
|
append_found (${module}_INCLUDE_DIRS CMAKE_REQUIRED_INCLUDES)
|
||||||
append_found (${module}_LIBRARIES CMAKE_REQUIRED_LIBRARIES)
|
append_found (${module}_LIBRARIES CMAKE_REQUIRED_LIBRARIES)
|
||||||
# since we don't have any config.h yet
|
# since we don't have any config.h yet
|
||||||
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_DEFINITIONS})
|
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_DEFINITIONS})
|
||||||
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_CMD_CONFIG})
|
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_CMD_CONFIG})
|
||||||
string (TOUPPER ${module} MODULE)
|
|
||||||
string (REPLACE "-" "_" MODULE ${MODULE})
|
|
||||||
check_cxx_source_compiles ("${prog}" HAVE_${MODULE})
|
check_cxx_source_compiles ("${prog}" HAVE_${MODULE})
|
||||||
cmake_pop_check_state ()
|
cmake_pop_check_state ()
|
||||||
|
|
||||||
@ -195,7 +197,7 @@ function (find_opm_package module deps header lib defs prog conf)
|
|||||||
find_package_handle_standard_args (
|
find_package_handle_standard_args (
|
||||||
${module}
|
${module}
|
||||||
DEFAULT_MSG
|
DEFAULT_MSG
|
||||||
${module}_INCLUDE_DIR ${_lib_var}
|
${module}_INCLUDE_DIR ${_lib_var} HAVE_${MODULE}
|
||||||
)
|
)
|
||||||
|
|
||||||
# allow the user to override these from user interface
|
# allow the user to override these from user interface
|
||||||
@ -204,7 +206,6 @@ function (find_opm_package module deps header lib defs prog conf)
|
|||||||
|
|
||||||
# some genius that coded the FindPackageHandleStandardArgs figured out
|
# some genius that coded the FindPackageHandleStandardArgs figured out
|
||||||
# that the module name should be in uppercase (?!)
|
# that the module name should be in uppercase (?!)
|
||||||
string (TOUPPER ${module} MODULE_UPPER)
|
|
||||||
set (${module}_FOUND "${${MODULE_UPPER}_FOUND}" PARENT_SCOPE)
|
set (${module}_FOUND "${${MODULE_UPPER}_FOUND}" PARENT_SCOPE)
|
||||||
|
|
||||||
# return these variables to the caller
|
# return these variables to the caller
|
||||||
@ -213,6 +214,7 @@ function (find_opm_package module deps header lib defs prog conf)
|
|||||||
set (${module}_DEFINITIONS "${${module}_DEFINITIONS}" PARENT_SCOPE)
|
set (${module}_DEFINITIONS "${${module}_DEFINITIONS}" PARENT_SCOPE)
|
||||||
set (${module}_CONFIG_VARS "${${module}_CONFIG_VARS}" PARENT_SCOPE)
|
set (${module}_CONFIG_VARS "${${module}_CONFIG_VARS}" PARENT_SCOPE)
|
||||||
set (${module}_LINKER_FLAGS "${${module}_LINKER_FLAGS}" PARENT_SCOPE)
|
set (${module}_LINKER_FLAGS "${${module}_LINKER_FLAGS}" PARENT_SCOPE)
|
||||||
|
set (${module}_QUIET "${${module}_QUIET}" PARENT_SCOPE)
|
||||||
set (HAVE_${MODULE} "${HAVE_${MODULE}}" PARENT_SCOPE)
|
set (HAVE_${MODULE} "${HAVE_${MODULE}}" PARENT_SCOPE)
|
||||||
endfunction (find_opm_package module deps header lib defs prog conf)
|
endfunction (find_opm_package module deps header lib defs prog conf)
|
||||||
|
|
||||||
@ -223,6 +225,8 @@ function (debug_find_vars module)
|
|||||||
message (STATUS "${module}_LIBRARIES = ${${module}_LIBRARIES}")
|
message (STATUS "${module}_LIBRARIES = ${${module}_LIBRARIES}")
|
||||||
message (STATUS "${module}_DEFINITIONS = ${${module}_DEFINITIONS}")
|
message (STATUS "${module}_DEFINITIONS = ${${module}_DEFINITIONS}")
|
||||||
message (STATUS "${module}_CONFIG_VARS = ${${module}_CONFIG_VARS}")
|
message (STATUS "${module}_CONFIG_VARS = ${${module}_CONFIG_VARS}")
|
||||||
|
message (STATUS "${module}_LINKER_FLAGS = ${${module}_LINKER_FLAGS}")
|
||||||
|
message (STATUS "${module}_QUIET = ${${module}_QUIET}")
|
||||||
string (TOUPPER ${module} MODULE)
|
string (TOUPPER ${module} MODULE)
|
||||||
string (REPLACE "-" "_" MODULE ${MODULE})
|
string (REPLACE "-" "_" MODULE ${MODULE})
|
||||||
message (STATUS "HAVE_${MODULE} = ${HAVE_${MODULE}}")
|
message (STATUS "HAVE_${MODULE} = ${HAVE_${MODULE}}")
|
||||||
|
41
cmake/Modules/UseOpenMP.cmake
Normal file
41
cmake/Modules/UseOpenMP.cmake
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# - Use OpenMP features
|
||||||
|
#
|
||||||
|
# Synopsis:
|
||||||
|
#
|
||||||
|
# find_openmp (module)
|
||||||
|
#
|
||||||
|
# where:
|
||||||
|
#
|
||||||
|
# module Name of the module to which OpenMP libraries
|
||||||
|
# etc. should be added, e.g. "opm-core".
|
||||||
|
#
|
||||||
|
# Note: Compiler flags are always added globally, to avoid ABI
|
||||||
|
# incompatibility problems.
|
||||||
|
#
|
||||||
|
# It is assumed that the following variables are available
|
||||||
|
#
|
||||||
|
# ${module}_QUIET Verbosity level of the parent's find module
|
||||||
|
# ${module}_LIBRARIES List of libraries to which OpenMP will be added
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# find_openmp (opm-core)
|
||||||
|
# remove_dup_deps (opm-core)
|
||||||
|
|
||||||
|
include (AddOptions)
|
||||||
|
macro (find_openmp opm)
|
||||||
|
# enabling OpenMP is supposedly enough to make the compiler link with
|
||||||
|
# the appropriate libraries
|
||||||
|
find_package (OpenMP ${${opm}_QUIET})
|
||||||
|
list (APPEND ${opm}_LIBRARIES ${OpenMP_LIBRARIES})
|
||||||
|
if (OPENMP_FOUND)
|
||||||
|
add_options (C ALL_BUILDS "${OpenMP_C_FLAGS}")
|
||||||
|
add_options (CXX ALL_BUILDS "${OpenMP_CXX_FLAGS}")
|
||||||
|
endif (OPENMP_FOUND)
|
||||||
|
|
||||||
|
# threading library (search for this *after* OpenMP
|
||||||
|
set (CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||||
|
find_package (Threads ${${opm}_QUIET})
|
||||||
|
if (CMAKE_USE_PTHREADS_INIT)
|
||||||
|
list (APPEND ${opm}_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
endif (CMAKE_USE_PTHREADS_INIT)
|
||||||
|
endmacro (find_openmp opm)
|
@ -97,6 +97,11 @@ function (precompile_header
|
|||||||
else (language STREQUAL "CXX")
|
else (language STREQUAL "CXX")
|
||||||
message (FATAL "Only C or C++ can have precompiled headers")
|
message (FATAL "Only C or C++ can have precompiled headers")
|
||||||
endif (language STREQUAL "CXX")
|
endif (language STREQUAL "CXX")
|
||||||
|
|
||||||
|
# if no precompiled header was found, then we shouldn't do anything here
|
||||||
|
if (NOT header)
|
||||||
|
return ()
|
||||||
|
endif (NOT header)
|
||||||
|
|
||||||
# only support precompiled headers if the compiler is gcc >= 3.4
|
# only support precompiled headers if the compiler is gcc >= 3.4
|
||||||
get_gcc_version (${language} GCC_VERSION)
|
get_gcc_version (${language} GCC_VERSION)
|
||||||
|
28
configure
vendored
28
configure
vendored
@ -141,20 +141,17 @@ while getopts -- ":-:" optchar; do
|
|||||||
pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON"
|
pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON"
|
||||||
rootvar=""
|
rootvar=""
|
||||||
;;
|
;;
|
||||||
agmg |\
|
agmg |\
|
||||||
ert |\
|
ert |\
|
||||||
boost |\
|
boost |\
|
||||||
zlib)
|
superlu |\
|
||||||
rootvar="${pkgname^^}_ROOT"
|
|
||||||
;;
|
|
||||||
superlu)
|
|
||||||
rootvar="${pkgname^^}_PREFIX"
|
|
||||||
;;
|
|
||||||
SuiteSparse |\
|
SuiteSparse |\
|
||||||
TinyXML |\
|
TinyXML |\
|
||||||
opm-* |\
|
opm-* |\
|
||||||
dune-*)
|
dune-* |\
|
||||||
rootvar="${pkgname}_ROOT"
|
zlib)
|
||||||
|
rootvar="${pkgname^^}_ROOT"
|
||||||
|
rootvar="${rootvar/-/_}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
invalid_opt --with-${pkgname}
|
invalid_opt --with-${pkgname}
|
||||||
@ -249,8 +246,10 @@ while getopts -- ":-:" optchar; do
|
|||||||
shared=""
|
shared=""
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
projuppr=${project^^}
|
||||||
|
projuppr=${projuppr/-/_}
|
||||||
test -n "${shared}" && \
|
test -n "${shared}" && \
|
||||||
FEATURES="${FEATURES} -DBUILD_${project}_SHARED:BOOL=${shared}"
|
FEATURES="${FEATURES} -DBUILD_${projuppr}_SHARED:BOOL=${shared}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# remove everything *after* the equal sign
|
# remove everything *after* the equal sign
|
||||||
@ -270,7 +269,10 @@ done
|
|||||||
shift $((OPTIND-1))
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
# remove Autotools-specific variables
|
# remove Autotools-specific variables
|
||||||
ENVVARS=${@/ACLOCAL_*=*/}
|
for a in "$@"; do
|
||||||
|
a="${a/ACLOCAL_*=*/}"
|
||||||
|
[ -n "$a" ] && ENVVARS="$ENVVARS \"${a/\"/\\\"}\""
|
||||||
|
done
|
||||||
|
|
||||||
# pass everything on to CMake
|
# 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}"
|
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\" -DCMAKE_BUILD_TYPE=${buildtype}${pch_use}${silent_rules}${debug_loc} ${FEATURES}"
|
||||||
|
Loading…
Reference in New Issue
Block a user