Commit a83bfe20 authored by Dave Moxey's avatar Dave Moxey

Refactor Scotch library

parent b6f85d3f
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(SCOTCHERR_LIB NAMES scotcherr PATHS ${SCOTCH_SEARCH_PATHS})
SET(SCOTCH_FOUND FALSE)
IF (SCOTCH_LIB AND SCOTCHERR_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(SCOTCHERR_LIB)
ENDIF (SCOTCH_LIB AND SCOTCHERR_LIB)
IF (SCOTCH_FOUND)
IF (NOT SCOTCH_LIB_FIND_QUIETLY)
MESSAGE(STATUS "Found Scotch: ${SCOTCH_LIB}, ${SCOTCHERR_LIB}")
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)
......@@ -64,8 +64,10 @@ SET(LOKI_INCLUDE_DIRS "@LOKI_CONFIG_INCLUDE_DIR@")
SET(NEKTAR++_TP_INCLUDE_DIRS ${NEKTAR++_TP_INCLUDE_DIRS} ${LOKI_INCLUDE_DIRS})
SET(TINYXML_INCLUDE_DIRS "@TINYXML_CONFIG_INCLUDE_DIR@")
SET(NEKTAR++_TP_INCLUDE_DIRS ${NEKTAR++_TP_INCLUDE_DIRS} ${TINYXML_INCLUDE_DIRS})
SET(NEKTAR++_TP_INCLUDE_DIRS ${NEKTAR++_TP_INCLUDE_DIRS} ${TINYXML_ADDITIONAL_INCLUDE_DIRS})
SET(SCOTCH_INCLUDE_DIRS "@SCOTCH_CONFIG_INCLUDE_DIR@")
SET(NEKTAR++_TP_INCLUDE_DIRS ${NEKTAR++_TP_INCLUDE_DIRS} ${SCOTCH_INCLUDE_DIRS})
SET(FFTW_INCLUDE_DIR "@FFTW_INCLUDE_DIR@")
SET(NEKTAR++_TP_INCLUDE_DIRS ${NEKTAR++_TP_INCLUDE_DIRS} ${FFTW_INCLUDE_DIR})
......
......@@ -34,7 +34,7 @@ IF (THIRDPARTY_BUILD_LOKI)
)
# Set LOKI_INCLUDE_DIR.
FILE(COPY ${LOKI_INCLUDE_DIR}/loki/ DESTINATION ${TPDIST}/include/loki/)
FILE(COPY ${TPSRC}/loki-0.1.3/include/loki/ DESTINATION ${TPDIST}/include/loki/)
SET(LOKI_INCLUDE_DIR ${TPDIST}/include CACHE PATH "" FORCE)
MESSAGE(STATUS "Build Loki: ${LOKI_INCLUDE_DIR}")
......
########################################################################
#
# ThirdParty configuration for Nektar++
#
# Scotch partitioner
#
########################################################################
IF (NOT WIN32)
OPTION(NEKTAR_USE_SCOTCH
"Use Scotch library for performing mesh partitioning." OFF)
ENDIF(NOT WIN32)
CMAKE_DEPENDENT_OPTION(THIRDPARTY_BUILD_SCOTCH
"Build Scotch library from ThirdParty" OFF
"NEKTAR_USE_SCOTCH" OFF)
IF (NEKTAR_USE_SCOTCH)
# First search for system TinyXML installs. Hint /opt/local for MacPorts.
FIND_LIBRARY(SCOTCH_LIBRARY NAMES scotch PATHS /opt/local/lib)
FIND_LIBRARY(SCOTCHERR_LIBRARY NAMES scotcherr PATHS /opt/local/lib)
FIND_PATH (SCOTCH_INCLUDE_DIR scotch.h PATHS /opt/local/include)
IF (SCOTCH_LIBRARY AND SCOTCHERR_LIBRARY AND SCOTCH_INCLUDE_DIR)
SET(BUILD_SCOTCH OFF)
ELSE()
SET(BUILD_SCOTCH ON)
ENDIF ()
CMAKE_DEPENDENT_OPTION(THIRDPARTY_BUILD_SCOTCH
"Build Scotch library from ThirdParty" ${BUILD_SCOTCH}
"NEKTAR_USE_SCOTCH" OFF)
IF( NEKTAR_USE_SCOTCH )
IF (THIRDPARTY_BUILD_SCOTCH)
UNSET(FLEX CACHE)
FIND_PROGRAM(FLEX flex)
......@@ -59,20 +78,27 @@ IF( NEKTAR_USE_SCOTCH )
INSTALL_COMMAND $(MAKE) -C ${SCOTCH_SRC}
prefix=${TPDIST} install
)
SET(SCOTCH_LIB scotch CACHE FILEPATH
SET(SCOTCH_LIBRARY scotch CACHE FILEPATH
"Scotch library" FORCE)
SET(SCOTCHERR_LIB scotcherr CACHE FILEPATH
SET(SCOTCHERR_LIBRARY scotcherr CACHE FILEPATH
"Scotch error library" FORCE)
SET(SCOTCHMETIS_LIB scotchmetis CACHE FILEPATH
"Scotch Metis interface library" FORCE)
MARK_AS_ADVANCED(SCOTCH_LIB)
MARK_AS_ADVANCED(SCOTCHERR_LIB)
MARK_AS_ADVANCED(SCOTCHMETIS_LIB)
SET(SCOTCH_INCLUDE_DIR ${TPDIST}/include CACHE FILEPATH
"Scotch include directory" FORCE)
LINK_DIRECTORIES(${TPDIST}/lib)
INCLUDE_DIRECTORIES(${TPDIST}/include)
MESSAGE(STATUS "Build Scotch: ${TPDIST}/lib/lib${SCOTCH_LIB}.a")
MESSAGE(STATUS "Build Scotch: ${TPDIST}/lib/lib${SCOTCH_LIBRARY}.a")
SET(SCOTCH_CONFIG_INCLUDE_DIR ${TPINC})
ELSE (THIRDPARTY_BUILD_SCOTCH)
ADD_CUSTOM_TARGET(scotch-6.0.0 ALL)
INCLUDE (FindScotch)
MESSAGE(STATUS "Found Scotch: ${SCOTCH_LIBRARY}")
SET(SCOTCH_CONFIG_INCLUDE_DIR ${SCOTCH_INCLUDE_DIR})
ENDIF (THIRDPARTY_BUILD_SCOTCH)
ENDIF( NEKTAR_USE_SCOTCH )
INCLUDE_DIRECTORIES(${SCOTCH_INCLUDE_DIR})
MARK_AS_ADVANCED(SCOTCH_LIBRARY)
MARK_AS_ADVANCED(SCOTCHERR_LIBRARY)
MARK_AS_ADVANCED(SCOTCH_INCLUDE_DIR)
ENDIF()
......@@ -54,7 +54,6 @@ IF (THIRDPARTY_BUILD_TINYXML)
SET(TINYXML_CONFIG_INCLUDE_DIR ${TPINC})
ELSE()
ADD_CUSTOM_TARGET(tinyxml-2.4.3 ALL)
MESSAGE(STATUS "Found TinyXML: ${TINYXML_LIBRARY}")
SET(TINYXML_CONFIG_INCLUDE_DIR ${TINYXML_INCLUDE_DIR})
ENDIF (THIRDPARTY_BUILD_TINYXML)
......
......@@ -356,7 +356,7 @@ ADD_DEPENDENCIES(LibUtilities modmetis-5.1.0 boost tinyxml-2.4.3 zlib-1.2.7)
# Scotch
IF( NEKTAR_USE_SCOTCH )
TARGET_LINK_LIBRARIES(LibUtilities LINK_PRIVATE
${SCOTCH_LIB} ${SCOTCHERR_LIB})
${SCOTCH_LIBRARY} ${SCOTCHERR_LIBRARY})
ADD_DEPENDENCIES(LibUtilities scotch-6.0.0)
ENDIF ()
......
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