From 0da7648a16b408d3ef80120a62c892cadb8bc257 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 22 Aug 2013 22:52:48 +0000 Subject: [PATCH] CMake: Pick up debug and optimized versions of p4est if available git-svn-id: https://svn.dealii.org/trunk@30440 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/modules/FindP4EST.cmake | 82 +++++++++++++++++++-------- 1 file changed, 57 insertions(+), 25 deletions(-) diff --git a/deal.II/cmake/modules/FindP4EST.cmake b/deal.II/cmake/modules/FindP4EST.cmake index 173da3893a..a90349c250 100644 --- a/deal.II/cmake/modules/FindP4EST.cmake +++ b/deal.II/cmake/modules/FindP4EST.cmake @@ -33,23 +33,6 @@ INCLUDE(FindPackageHandleStandardArgs) SET_IF_EMPTY(P4EST_DIR "$ENV{P4EST_DIR}") SET_IF_EMPTY(SC_DIR "$ENV{SC_DIR}") -# -# We used to recommend installing p4est with a custom script that -# compiled p4est twice, once in debug and once in optimized mode. -# the installation would then have happened into directories -# $P4EST_DIR/DEBUG and $P4EST_DIR/FAST. If we can find these -# two directories, then use the FAST directory rather than trying -# to figure out how we can build deal.II against the two libraries -# depending on whether we are in debug or optimized mode. -# -IF(P4EST_DIR - AND EXISTS ${P4EST_DIR}/DEBUG - AND EXISTS ${P4EST_DIR}/FAST) - MESSAGE(STATUS "Found old-style p4est directory layout") - SET (P4EST_DIR ${P4EST_DIR}/FAST) -ENDIF() - - # # Search for the sc library, usually bundled with p4est. If no SC_DIR was # given, take what we chose for p4est. @@ -57,6 +40,8 @@ ENDIF() FIND_PATH(P4EST_INCLUDE_DIR p4est_config.h HINTS + ${P4EST_DIR}/FAST + ${P4EST_DIR}/DEBUG ${P4EST_DIR} PATH_SUFFIXES p4est include/p4est include src @@ -64,34 +49,61 @@ FIND_PATH(P4EST_INCLUDE_DIR p4est_config.h FIND_PATH(SC_INCLUDE_DIR sc.h HINTS + ${SC_DIR}/FAST + ${SC_DIR}/DEBUG ${SC_DIR} + ${P4EST_DIR}/FAST + ${P4EST_DIR}/DEBUG ${P4EST_DIR} PATH_SUFFIXES sc include/p4est include src sc/src ) -FIND_LIBRARY(P4EST_LIBRARY +FIND_LIBRARY(P4EST_LIBRARY_OPTIMIZED NAMES p4est HINTS + ${P4EST_DIR}/FAST + ${P4EST_DIR}/DEBUG ${P4EST_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib src ) -FIND_LIBRARY(SC_LIBRARY +FIND_LIBRARY(P4EST_LIBRARY_DEBUG + NAMES p4est + HINTS + ${P4EST_DIR}/DEBUG + PATH_SUFFIXES + lib${LIB_SUFFIX} lib64 lib src + ) + +FIND_LIBRARY(SC_LIBRARY_OPTIMIZED NAMES sc HINTS + ${SC_DIR}/FAST + ${SC_DIR}/DEBUG ${SC_DIR} + ${P4EST_DIR}/FAST + ${P4EST_DIR}/DEBUG ${P4EST_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib src sc/src ) -SET(_output ${P4EST_LIBRARY} ${SC_LIBRARY}) +FIND_LIBRARY(SC_LIBRARY_DEBUG + NAMES sc + HINTS + ${SC_DIR}/DEBUG + ${P4EST_DIR}/DEBUG + PATH_SUFFIXES + lib${LIB_SUFFIX} lib64 lib src sc/src + ) + +SET(_output ${P4EST_LIBRARY_OPTMIZED} ${SC_LIBRARY_OPTIMIZED}) FIND_PACKAGE_HANDLE_STANDARD_ARGS(P4EST DEFAULT_MSG _output # Cosmetic: Gives nice output - P4EST_LIBRARY - SC_LIBRARY + P4EST_LIBRARY_OPTIMIZED + SC_LIBRARY_OPTIMIZED P4EST_INCLUDE_DIR SC_INCLUDE_DIR ) @@ -103,10 +115,29 @@ MARK_AS_ADVANCED( SC_INCLUDE_DIR ) + IF(P4EST_FOUND) - SET(P4EST_LIBRARIES - ${P4EST_LIBRARY} - ${SC_LIBRARY} + + IF( "${P4EST_LIBRARY_OPTIMIZED}" STREQUAL "${P4EST_LIBRARY_DEBUG}" + AND + "${SC_LIBRARY_OPTIMIZED}" STREQUAL "${SC_LIBRARY_DEBUG}" ) + SET(P4EST_LIBRARIES + ${P4EST_LIBRARY_OPTIMIZED} + ${SC_LIBRARY_OPTIMIZED} + ) + ELSE() + SET(P4EST_LIBRARIES + optimized + ${P4EST_LIBRARY_OPTIMIZED} + ${SC_LIBRARY_OPTIMIZED} + debug + ${P4EST_LIBRARY_DEBUG} + ${SC_LIBRARY_DEBUG} + general + ) + ENDIF() + + LIST(APPEND P4EST_LIBRARIES ${LAPACK_LIBRARIES} # for good measure ${MPI_C_LIBRARIES} # for good measure ) @@ -123,6 +154,7 @@ IF(P4EST_FOUND) IF("${P4EST_MPI_STRING}" STREQUAL "") SET(P4EST_WITH_MPI FALSE) ELSE() + SET(P4EST_WITH_MPI TRUE) ENDIF() -- 2.39.5