Commit 542f3bc3 authored by Chris Cantwell's avatar Chris Cantwell

Added CMake support for Scotch partitioning library.

parent 2a78e963
......@@ -163,6 +163,7 @@ ENDIF ()
INCLUDE (ThirdPartyTinyxml)
INCLUDE (ThirdPartyLoki)
INCLUDE (ThirdPartyMetis)
INCLUDE (ThirdPartyScotch)
INCLUDE (ThirdPartyBoost)
INCLUDE (ThirdPartyZlib)
INCLUDE (ThirdPartyFFTW)
......@@ -294,6 +295,7 @@ INSTALL(FILES ${CMAKE_BINARY_DIR}/Nektar++Config.cmake
${CMAKE_SOURCE_DIR}/cmake/FindNativeBlasLapack.cmake
${CMAKE_SOURCE_DIR}/cmake/FindMKL.cmake
${CMAKE_SOURCE_DIR}/cmake/FindMetis.cmake
${CMAKE_SOURCE_DIR}/cmake/FindScotch.cmake
${CMAKE_SOURCE_DIR}/cmake/FindFFTW.cmake
${CMAKE_SOURCE_DIR}/cmake/FindWin32Lapack.cmake
${CMAKE_SOURCE_DIR}/cmake/NektarCommon.cmake
......
SET(SCOTCH_SEARCH_PATHS
${CMAKE_SOURCE_DIR}/ThirdParty/scotch_6.0.0/
${CMAKE_SOURCE_DIR}/ThirdParty/scotch_6.0.0/build/
${CMAKE_SOURCE_DIR}/../ThirdParty/scotch_6.0.0/
${CMAKE_SOURCE_DIR}/../ThirdParty/scotch_6.0.0/build
${CMAKE_SOURCE_DIR}/ThirdParty/dist/lib
${CMAKE_SOURCE_DIR}/../ThirdParty/dist/lib)
FIND_LIBRARY(SCOTCH_LIB NAMES scotch PATHS ${SCOTCH_SEARCH_PATHS})
FIND_LIBRARY(SCOTCHMETIS_LIB NAMES scotchmetis PATHS ${SCOTCH_SEARCH_PATHS})
SET(SCOTCH_FOUND FALSE)
IF (SCOTCH_LIB AND SCOTCHMETIS_LIB)
SET(SCOTCH_FOUND TRUE)
GET_FILENAME_COMPONENT(SCOTCH_PATH ${SCOTCH_LIB} PATH)
INCLUDE_DIRECTORIES(${SCOTCH_PATH}/../../include)
MARK_AS_ADVANCED(SCOTCH_PATH)
MARK_AS_ADVANCED(SCOTCH_LIB)
MARK_AS_ADVANCED(SCOTCHMETIS_LIB)
ENDIF (SCOTCH_LIB AND SCOTCHMETIS_LIB)
IF (SCOTCH_FOUND)
IF (NOT SCOTCH_LIB_FIND_QUIETLY)
MESSAGE(STATUS "Found Scotch")
ENDIF (NOT SCOTCH_LIB_FIND_QUIETLY)
ELSE(SCOTCH_FOUND)
IF (SCOTCH_LIB_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Scotch")
ENDIF (SCOTCH_LIB_FIND_REQUIRED)
ENDIF (SCOTCH_FOUND)
......@@ -47,6 +47,12 @@ MACRO(SET_LAPACK_LINK_LIBRARIES name)
ENDIF( NEKTAR_USE_BLAS_LAPACK )
IF( NEKTAR_USE_SCOTCH )
TARGET_LINK_LIBRARIES(${name} ${SCOTCHMETIS_LIB} ${SCOTCH_LIB})
# TARGET_LINK_LIBRARIES(${name} optimized ${SCOTCHMETIS_LIB}
# ${SCOTCH_LIB} debug ${SCOTCHMETIS_LIB} ${SCOTCH_LIB} )
ENDIF (NEKTAR_USE_SCOTCH )
IF( NEKTAR_USE_METIS )
TARGET_LINK_LIBRARIES(${name} optimized ${METIS_LIB} debug
${METIS_LIB} )
......
OPTION(NEKTAR_USE_SCOTCH
"Use Scotch library for performing mesh partitioning." OFF)
CMAKE_DEPENDENT_OPTION(THIRDPARTY_BUILD_SCOTCH
"Build Scotch library from ThirdParty" OFF
"NEKTAR_USE_SCOTCH" OFF)
IF( NEKTAR_USE_SCOTCH )
IF (THIRDPARTY_BUILD_SCOTCH)
MESSAGE("Building Scotch is not yet supported.")
INCLUDE(ExternalProject)
EXTERNALPROJECT_ADD(
scotch-6.0.0
PREFIX ${TPSRC}
URL ${TPURL}/scotch_6.0.0.tar.gz
URL_MD5 "6c6816aea0f53db6c71b1d98ed4ad42b"
DOWNLOAD_DIR ${TPSRC}
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX:PATH=${TPSRC}/dist
-DCMAKE_C_FLAGS:STRING=-fPIC
${TPSRC}/src/scotch_6.0.0
)
SET(SCOTCH_LIB scotch CACHE FILEPATH
"Scotch library" FORCE)
SET(SCOTCHMETIS_LIB scotchmetis CACHE FILEPATH
"Scotch Metis interface library" FORCE)
MARK_AS_ADVANCED(SCOTCH_LIB)
MARK_AS_ADVANCED(SCOTCHMETIS_LIB)
LINK_DIRECTORIES(${TPSRC}/dist/lib)
INCLUDE_DIRECTORIES(${TPSRC}/dist/include)
MESSAGE(STATUS "Build Scotch: ${TPSRC}/dist/lib/lib${SCOTCH_LIB}.a")
ELSE (THIRDPARTY_BUILD_SCOTCH)
INCLUDE (FindScotch)
ENDIF (THIRDPARTY_BUILD_SCOTCH)
ENDIF( NEKTAR_USE_SCOTCH )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment