Commit 5edbb957 authored by incardon's avatar incardon

Adding GPU_branch_start

parent 1a1686d9
# - Try to find Eigen3 lib
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(Eigen3 3.1.2)
# to require version 3.1.2 or newer of Eigen3.
#
# Once done this will define
#
# EIGEN3_FOUND - system has eigen lib with correct version
# EIGEN3_INCLUDE_DIR - the eigen include directory
# EIGEN3_VERSION - eigen version
#
# and the following imported target:
#
# Eigen3::Eigen - The header-only Eigen library
#
# This module reads hints about search locations from
# the following environment variables:
#
# EIGEN3_ROOT
# EIGEN3_ROOT_DIR
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
if(NOT Eigen3_FIND_VERSION)
if(NOT Eigen3_FIND_VERSION_MAJOR)
set(Eigen3_FIND_VERSION_MAJOR 2)
endif(NOT Eigen3_FIND_VERSION_MAJOR)
if(NOT Eigen3_FIND_VERSION_MINOR)
set(Eigen3_FIND_VERSION_MINOR 91)
endif(NOT Eigen3_FIND_VERSION_MINOR)
if(NOT Eigen3_FIND_VERSION_PATCH)
set(Eigen3_FIND_VERSION_PATCH 0)
endif(NOT Eigen3_FIND_VERSION_PATCH)
set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
endif(NOT Eigen3_FIND_VERSION)
macro(_eigen3_check_version)
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK FALSE)
else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK TRUE)
endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
if(NOT EIGEN3_VERSION_OK)
message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
"but at least version ${Eigen3_FIND_VERSION} is required")
endif(NOT EIGEN3_VERSION_OK)
endmacro(_eigen3_check_version)
if (EIGEN3_INCLUDE_DIR)
# in cache already
_eigen3_check_version()
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
set(Eigen3_FOUND ${EIGEN3_VERSION_OK})
else (EIGEN3_INCLUDE_DIR)
# search first if an Eigen3Config.cmake is available in the system,
# if successful this would set EIGEN3_INCLUDE_DIR and the rest of
# the script will work as usual
find_package(Eigen3 ${Eigen3_FIND_VERSION} NO_MODULE QUIET)
if(NOT EIGEN3_INCLUDE_DIR)
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
HINTS
ENV EIGEN3_ROOT
ENV EIGEN3_ROOT_DIR
PATHS
${CMAKE_INSTALL_PREFIX}/include
${KDE4_INCLUDE_DIR}
PATH_SUFFIXES eigen3 eigen
)
endif(NOT EIGEN3_INCLUDE_DIR)
if(EIGEN3_INCLUDE_DIR)
_eigen3_check_version()
endif(EIGEN3_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
mark_as_advanced(EIGEN3_INCLUDE_DIR)
endif(EIGEN3_INCLUDE_DIR)
if(EIGEN3_FOUND AND NOT TARGET Eigen3::Eigen)
add_library(Eigen3::Eigen INTERFACE IMPORTED)
set_target_properties(Eigen3::Eigen PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${EIGEN3_INCLUDE_DIR}")
endif()
# - Try to find LibHilbert
# Once done this will define
#
# LIBHILBERT_FOUND - system has LibHilbert
# LIBHILBERT_INCLUDE_DIRS - include directories for PETSc
# LIBHILBERT_LIBRARY_DIRS - library directories for PETSc
# LIBHILBERT_LIBRARIES - libraries for PETSc
#
#=============================================================================
# Copyright (C) 2010-2016 Pietro Incardona
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
if (LIBHILBERT_FOUND)
return()
endif()
add_library(libhilbert INTERFACE IMPORTED)
# Add libraries (static)
set(_libs "-L${LIBHILBERT_ROOT}/lib -llibhilbert")
set_property(TARGET libhilbert PROPERTY INTERFACE_LINK_LIBRARIES "${_libs}")
# Create LibHilbert test program
set(LIBHILBERT_TEST_LIB_CPP
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/libhilbert_test_lib.cpp")
file(WRITE ${LIBHILBERT_TEST_LIB_CPP} "
extern \"C\"
{
#include \"hilbertKey.h\"
}
int main()
{
//An integer to handle errors
int err;
//Array to handle output
uint64_t nextCoord[2];
//Get the coordinates of the next cell
getIntCoordFromHKey(nextCoord, 4, 2, 0, &err);
return 0;
}
")
# Try to run test program (static linking)
try_run(
LIBHILBERT_TEST_LIB_EXITCODE
LIBHILBERT_TEST_LIB_COMPILED
${CMAKE_CURRENT_BINARY_DIR}
${LIBHILBERT_TEST_LIB_CPP}
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES:STRING=${LIBHILBERT_ROOT}/include"
"-DLINK_LIBRARIES:STRING=${LIBHILBERT_ROOT}/lib"
LINK_LIBRARIES libhilbert
COMPILE_OUTPUT_VARIABLE LIBHILBERT_TEST_LIB_COMPILE_OUTPUT
RUN_OUTPUT_VARIABLE LIBHILBERT_TEST_LIB_OUTPUT)
if (LIBHILBERT_TEST_LIB_COMPILED AND LIBHILBERT_TEST_LIB_EXITCODE EQUAL 0)
message(STATUS "Test LibHilbert_TEST_RUNS static linking - Success")
set(LIBHILBERT_TEST_RUNS TRUE)
set(LIBHILBERT_FOUND TRUE)
set(LIBHILBERT_INCLUDE_DIRS ${LIBHILBERT_ROOT}/include)
set(LIBHILBERT_LIBRARY_DIRS ${LIBHILBERT_ROOT}/lib)
set(LIBHILBERT_LIBRARIES -llibhilbert)
else()
message(STATUS "Test LibHilbert_TEST_RUNS static linking - Failed")
set(LIBHILBERT_TEST_RUNS FALSE)
endif()
# -*- mode: cmake -*-
#
# METIS Find Module for Femus
# Shamelessly stolen from Amanzi open source code https://software.lanl.gov/ascem/trac
#
# Usage:
# Control the search through METIS_DIR or setting environment variable
# METIS_ROOT to the METIS installation prefix.
#
# This module does not search default paths!
#
# Following variables are set:
# METIS_FOUND (BOOL) Flag indicating if METIS was found
# METIS_INCLUDE_DIR (PATH) Path to the METIS include file
# METIS_INCLUDE_DIRS (LIST) List of all required include files
# METIS_LIBRARY_DIR (PATH) Path to the METIS library
# METIS_LIBRARY (FILE) METIS library
# METIS_LIBRARIES (LIST) List of all required METIS libraries
#
# #############################################################################
# Standard CMake modules see CMAKE_ROOT/Modules
include(FindPackageHandleStandardArgs)
# Amanzi CMake functions see <root>/tools/cmake for source
#include(PrintVariable)
if ( METIS_LIBRARIES AND METIS_INCLUDE_DIRS )
# Do nothing. Variables are set. No need to search again
else(METIS_LIBRARIES AND METIS_INCLUDE_DIRS)
# Cache variables
if(METIS_DIR)
set(METIS_DIR "${METIS_DIR}" CACHE PATH "Path to search for METIS include and library files")
endif()
if(METIS_INCLUDE_DIR)
set(METIS_INCLUDE_DIR "${METIS_INCLUDE_DIR}" CACHE PATH "Path to search for METIS include files")
endif()
if(METIS_LIBRARY_DIR)
set(METIS_LIBRARY_DIR "${METIS_LIBRARY_DIR}" CACHE PATH "Path to search for METIS library files")
endif()
# Search for include files
# Search order preference:
# (1) METIS_INCLUDE_DIR - check existence of path AND if the include files exist
# (2) METIS_DIR/<include>
# (3) Default CMake paths See cmake --html-help=out.html file for more information.
#
set(metis_inc_names "metis.h")
if (METIS_INCLUDE_DIR)
if (EXISTS "${METIS_INCLUDE_DIR}")
find_path(metis_test_include_path
NAMES ${metis_inc_names}
HINTS ${METIS_INCLUDE_DIR}
NO_DEFAULT_PATH)
if(NOT metis_test_include_path)
message(SEND_ERROR "Can not locate ${metis_inc_names} in ${METIS_INCLUDE_DIR}")
endif()
set(METIS_INCLUDE_DIR "${metis_test_include_path}")
else()
message(SEND_ERROR "METIS_INCLUDE_DIR=${METIS_INCLUDE_DIR} does not exist")
set(METIS_INCLUDE_DIR "METIS_INCLUDE_DIR-NOTFOUND")
endif()
else()
# Metis sometimes puts the include files in a subdir called Lib
set(metis_inc_suffixes "include" "Lib")
if(METIS_DIR)
if (EXISTS "${METIS_DIR}" )
find_path(METIS_INCLUDE_DIR
NAMES ${metis_inc_names}
HINTS ${METIS_DIR}
PATH_SUFFIXES ${metis_inc_suffixes}
NO_DEFAULT_PATH)
else()
message(SEND_ERROR "METIS_DIR=${METIS_DIR} does not exist")
set(METIS_INCLUDE_DIR "METIS_INCLUDE_DIR-NOTFOUND")
endif()
else()
find_path(METIS_INCLUDE_DIR
NAMES ${metis_inc_names}
PATH_SUFFIXES ${metis_inc_suffixes})
endif()
endif()
# Search for libraries
# Search order preference:
# (1) METIS_LIBRARY_DIR - check existence of path AND if the library file exists
# (2) METIS_DIR/<lib,Lib>
# (3) Default CMake paths See cmake --html-help=out.html file for more information.
#
set(metis_lib_names "metis")
if (METIS_LIBRARY_DIR)
if (EXISTS "${METIS_LIBRARY_DIR}")
find_library(METIS_LIBRARY
NAMES ${metis_lib_names}
HINTS ${METIS_LIBRARY_DIR}
NO_DEFAULT_PATH)
else()
set(METIS_LIBRARY "METIS_LIBRARY-NOTFOUND")
endif()
else()
list(APPEND metis_lib_suffixes "lib" "Lib")
if(METIS_DIR)
if (EXISTS "${METIS_DIR}" )
find_library(METIS_LIBRARY
NAMES ${metis_lib_names}
HINTS ${METIS_DIR}
PATH_SUFFIXES ${metis_lib_suffixes}
NO_DEFAULT_PATH)
else()
set(METISLIBRARY "METIS_LIBRARY-NOTFOUND")
endif()
else()
find_library(METIS_LIBRARY
NAMES ${metis_lib_names}
PATH_SUFFIXES ${metis_lib_suffixes})
endif()
endif()
if ( NOT METIS_LIBRARY )
endif()
# Define prerequisite packages
set(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR})
set(METIS_LIBRARIES ${METIS_LIBRARY})
endif(METIS_LIBRARIES AND METIS_INCLUDE_DIRS )
# Send useful message if everything is found
find_package_handle_standard_args(METIS DEFAULT_MSG
METIS_LIBRARIES
METIS_INCLUDE_DIRS)
# find_package_handle_standard_args should set METIS_FOUND but it does not!
if ( METIS_LIBRARIES AND METIS_INCLUDE_DIRS)
set(METIS_FOUND TRUE)
else()
set(METIS_FOUND FALSE)
endif()
# Define the version
mark_as_advanced(
METIS_INCLUDE_DIR
METIS_INCLUDE_DIRS
METIS_LIBRARY
METIS_LIBRARIES
METIS_LIBRARY_DIR
)
# - Try to find PETSc
# Once done this will define
#
# PETSC_FOUND - system has PETSc
# PETSC_INCLUDE_DIRS - include directories for PETSc
# PETSC_LIBRARY_DIRS - library directories for PETSc
# PETSC_LIBRARIES - libraries for PETSc
# PETSC_STATIC_LIBRARIES - libraries for PETSc (static linking, undefined if not required)
# PETSC_VERSION - version for PETSc
# PETSC_VERSION_MAJOR - First number in PETSC_VERSION
# PETSC_VERSION_MINOR - Second number in PETSC_VERSION
# PETSC_VERSION_SUBMINOR - Third number in PETSC_VERSION
# PETSC_INT_SIZE - sizeof(PetscInt)
#
#=============================================================================
# Copyright (C) 2010-2016 Garth N. Wells, Anders Logg and Johannes Ring
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
# Outline:
# 1. Get flags from PETSc-generated pkg-config file
# 2. Test compile and run program using shared library linking
# 3. If shared library linking fails, test with static library linking
# Load pkg-config module (provided by CMake)
find_package(PkgConfig REQUIRED)
# Find PETSc pkg-config file. Note: craypetsc_real is on Cray systems
set(ENV{PKG_CONFIG_PATH} "$ENV{CRAY_PETSC_PREFIX_DIR}/lib/pkgconfig:$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
pkg_search_module(PETSC craypetsc_real PETSc)
# Extract major, minor, etc from version string
if (PETSC_VERSION)
string(REPLACE "." ";" VERSION_LIST ${PETSC_VERSION})
list(GET VERSION_LIST 0 PETSC_VERSION_MAJOR)
list(GET VERSION_LIST 1 PETSC_VERSION_MINOR)
list(GET VERSION_LIST 2 PETSC_VERSION_SUBMINOR)
endif()
# Configure PETSc IMPORT (this involves creating an 'imported' target
# and attaching 'properties')
if (PETSC_FOUND AND NOT TARGET PETSC::petsc)
add_library(PETSC::petsc INTERFACE IMPORTED)
# Add include paths
set_property(TARGET PETSC::petsc PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${PETSC_INCLUDE_DIRS})
# Add libraries
unset(_libs)
foreach (lib ${PETSC_LIBRARIES})
find_library(LIB_${lib} NAMES ${lib} PATHS ${PETSC_LIBRARY_DIRS} NO_DEFAULT_PATH)
list(APPEND _libs ${LIB_${lib}})
endforeach()
set_property(TARGET PETSC::petsc PROPERTY INTERFACE_LINK_LIBRARIES "${_libs}")
endif()
# Configure PETSc 'static' IMPORT (this involves creating an
# 'imported' target and attaching 'properties')
if (PETSC_FOUND AND NOT TARGET PETSC::petsc_static)
add_library(PETSC::petsc_static INTERFACE IMPORTED)
# Add libraries (static)
unset(_libs)
foreach (lib ${PETSC_STATIC_LIBRARIES})
find_library(LIB_${lib} ${lib} HINTS ${PETSC_STATIC_LIBRARY_DIRS})
list(APPEND _libs ${LIB_${lib}})
endforeach()
set_property(TARGET PETSC::petsc_static PROPERTY INTERFACE_LINK_LIBRARIES "${_libs}")
endif()
# Attempt to build and run PETSc test program
if (DOLFIN_SKIP_BUILD_TESTS)
# Assume PETSc works
set(PETSC_TEST_RUNS TRUE)
elseif (PETSC_FOUND)
# Create PETSc test program
set(PETSC_TEST_LIB_CPP
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/petsc_test_lib.cpp")
file(WRITE ${PETSC_TEST_LIB_CPP} "
#include \"petscts.h\"
#include \"petsc.h\"
int main()
{
PetscErrorCode ierr;
TS ts;
int argc = 0;
char** argv = NULL;
ierr = PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);CHKERRQ(ierr);
ierr = TSCreate(PETSC_COMM_WORLD,&ts);CHKERRQ(ierr);
ierr = TSSetFromOptions(ts);CHKERRQ(ierr);
ierr = TSDestroy(&ts);CHKERRQ(ierr);
ierr = PetscFinalize();CHKERRQ(ierr);
return 0;
}
")
# Add MPI variables if MPI has been found
if (MPI_C_FOUND)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${MPI_C_INCLUDE_PATH})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${MPI_C_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${MPI_C_COMPILE_FLAGS}")
endif()
# Try to run test program (shared linking)
try_run(
PETSC_TEST_LIB_EXITCODE
PETSC_TEST_LIB_COMPILED
${CMAKE_CURRENT_BINARY_DIR}
${PETSC_TEST_LIB_CPP}
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
LINK_LIBRARIES PETSC::petsc
COMPILE_OUTPUT_VARIABLE PETSC_TEST_LIB_COMPILE_OUTPUT
RUN_OUTPUT_VARIABLE PETSC_TEST_LIB_OUTPUT)
# Check program output
if (PETSC_TEST_LIB_COMPILED AND PETSC_TEST_LIB_EXITCODE EQUAL 0)
message(STATUS "Test PETSC_TEST_RUNS with shared library linking - Success")
set(PETSC_TEST_RUNS TRUE)
# Static libraries not required, so unset
set_property(TARGET PETSC::petsc_static PROPERTY INTERFACE_LINK_LIBRARIES)
else()
message(STATUS "Test PETSC_TEST_RUNS with shared library linking - Failed")
# Add MPI variables if MPI has been found
if (MPI_C_FOUND)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${MPI_C_INCLUDE_PATH})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${MPI_C_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${MPI_C_COMPILE_FLAGS}")
endif()
# Try to run test program (static linking)
try_run(
PETSC_TEST_LIB_EXITCODE
PETSC_TEST_LIB_COMPILED
${CMAKE_CURRENT_BINARY_DIR}
${PETSC_TEST_LIB_CPP}
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
LINK_LIBRARIES PETSC::petsc PETSC::petsc_static
COMPILE_OUTPUT_VARIABLE PETSC_TEST_LIB_COMPILE_OUTPUT
RUN_OUTPUT_VARIABLE PETSC_TEST_LIB_OUTPUT)
if (PETSC_TEST_LIB_COMPILED AND PETSC_TEST_LIB_EXITCODE EQUAL 0)
message(STATUS "Test PETSC_TEST_RUNS static linking - Success")
set(PETSC_TEST_RUNS TRUE)
else()
message(STATUS "Test PETSC_TEST_RUNS static linking - Failed")
set(PETSC_TEST_RUNS FALSE)
endif()
endif()
endif()
# Check sizeof(PetscInt)
if (PETSC_INCLUDE_DIRS)
include(CheckTypeSize)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${PETSC_INCLUDE_DIRS})
set(CMAKE_EXTRA_INCLUDE_FILES petscsys.h)
check_type_size("PetscInt" PETSC_INT_SIZE)
unset(CMAKE_EXTRA_INCLUDE_FILES)
unset(CMAKE_REQUIRED_INCLUDES)
endif()
# Standard package handling
include(FindPackageHandleStandardArgs)
if (PETSC_FOUND)
find_package_handle_standard_args(PETSc
REQUIRED_VARS PETSC_FOUND PETSC_TEST_RUNS VERSION_VAR PETSC_VERSION
FAIL_MESSAGE "PETSc could not be configured.")
else()
find_package_handle_standard_args(PETSc
REQUIRED_VARS PETSC_FOUND
FAIL_MESSAGE "PETSc could not be found. Be sure to set PETSC_DIR.")
endif()
# - Try to find ParMETIS
# Once done this will define
#
# PARMETIS_FOUND - system has ParMETIS
# PARMETIS_INCLUDE_DIRS - include directories for ParMETIS
# PARMETIS_LIBRARIES - libraries for ParMETIS
#
# Variables used by this module. They can change the default behaviour and
# need to be set before calling find_package:
#
# PARMETIS_DIR - Prefix directory of the ParMETIS installation
# PARMETIS_INCLUDE_DIR - Include directory of the ParMETIS installation
# (set only if different from ${PARMETIS_DIR}/include)
# PARMETIS_LIB_DIR - Library directory of the ParMETIS installation
# (set only if different from ${PARMETIS_DIR}/lib)
# PARMETIS_TEST_RUNS - Skip tests building and running a test
# executable linked against ParMETIS libraries
# PARMETIS_LIB_SUFFIX - Also search for non-standard library names with the
# given suffix appended
#=============================================================================
# Copyright (C) 2010-2012 Garth N. Wells, Anders Logg, Johannes Ring
# and Florian Rathgeber. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE