Commit ffbb0a6e authored by Kilian Lackhove's avatar Kilian Lackhove

CWIPI: build our own cwipi

parent 43abbd6f
...@@ -190,17 +190,7 @@ INCLUDE (ThirdPartySMV) ...@@ -190,17 +190,7 @@ INCLUDE (ThirdPartySMV)
INCLUDE (ThirdPartyTriangle) INCLUDE (ThirdPartyTriangle)
INCLUDE (ThirdPartyTetGen) INCLUDE (ThirdPartyTetGen)
INCLUDE (ThirdPartyCCM) INCLUDE (ThirdPartyCCM)
INCLUDE (ThirdPartyCwipi)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_CWIPI
"Use CWIPI for Coupling." OFF
"NEKTAR_USE_MPI" OFF)
IF ( NEKTAR_USE_CWIPI )
set(CWIPI_DIR "/usr/local/cwipi" CACHE PATH "CWIPI base path")
find_package(Cwipi)
include_directories(${CWIPI_INCLUDE_DIRS})
ADD_DEFINITIONS(-DNEKTAR_USE_CWIPI)
ENDIF ( NEKTAR_USE_CWIPI )
INCLUDE (Doxygen) INCLUDE (Doxygen)
......
...@@ -5,42 +5,35 @@ ...@@ -5,42 +5,35 @@
# CWIPI_LIBRARIES - The libraries needed to use cwipi # CWIPI_LIBRARIES - The libraries needed to use cwipi
# CWIPI_DEFINITIONS - Compiler switches required for using cwipi # CWIPI_DEFINITIONS - Compiler switches required for using cwipi
set(CWIPI_DEFINITIONS "")
find_path(CWIPI_INCLUDE_DIR cwipi.h SET(CWIPI_SEARCH_PATHS
HINTS ${CWIPI_DIR}/include/ ${CMAKE_SOURCE_DIR}/ThirdParty/cwipi/build/lib
) ${CMAKE_SOURCE_DIR}/../ThirdParty/cwipi/build/lib
${CMAKE_SOURCE_DIR}/ThirdParty/dist/build/lib
find_library(CWIPI_LIBRARY ${CMAKE_SOURCE_DIR}/../ThirdParty/dist/build/lib)
NAMES "libcwipi.so"
HINTS "${CWIPI_DIR}/lib64/" "${CWIPI_DIR}/lib/" FIND_PATH(CWIPI_INCLUDE_DIR NAMES cwipi.h PATHS ${CWIPI_SEARCH_PATHS})
) FIND_LIBRARY(CWIPI_LIBRARY NAMES cwipi PATHS ${CWIPI_SEARCH_PATHS})
FIND_LIBRARY(CWIPI_LIBRARY_FVMC NAMES fvmc PATHS ${CWIPI_SEARCH_PATHS})
find_library(CWIPI_LIBRARY_FVMC FIND_LIBRARY(CWIPI_LIBRARY_BFTC NAMES BFTC PATHS ${CWIPI_SEARCH_PATHS})
NAMES "libfvmc.so"
HINTS "${CWIPI_DIR}/lib64/" "${CWIPI_DIR}/lib/"
) SET(CWIPI_FOUND FALSE)
IF (CWIPI_LIBRARY)
find_library(CWIPI_LIBRARY_BFTC SET(CWIPI_FOUND TRUE)
NAMES "libbftc.so" INCLUDE_DIRECTORIES(${CWIPI_INCLUDE_DIR})
HINTS "${CWIPI_DIR}/lib64/" "${CWIPI_DIR}/lib/" MARK_AS_ADVANCED(CWIPI_LIBRARY)
) MARK_AS_ADVANCED(CWIPI_LIBRARY_FVMC)
MARK_AS_ADVANCED(CWIPI_LIBRARY_BFTC)
set(CWIPI_LIBRARIES MARK_AS_ADVANCED(CWIPI_INCLUDE_DIR)
${CWIPI_LIBRARY} ENDIF (CWIPI_LIBRARY)
${CWIPI_LIBRARY_FVMC}
${CWIPI_LIBRARY_BFTC} IF (CWIPI_FOUND)
) IF (NOT CWIPI_FIND_QUIETLY)
set(CWIPI_INCLUDE_DIRS ${CWIPI_INCLUDE_DIR}) MESSAGE(STATUS "Found CWIPI: ${CWIPI_INCLUDE_DIR}")
ENDIF (NOT CWIPI_FIND_QUIETLY)
include(FindPackageHandleStandardArgs) ELSE(CWIPI_FOUND)
# handle the QUIETLY and REQUIRED arguments and set CWIPI_FOUND to TRUE IF (CWIPI_FIND_REQUIRED)
# if all listed variables are TRUE MESSAGE(FATAL_ERROR "Could not find CWIPI")
find_package_handle_standard_args(cwipi DEFAULT_MSG ENDIF (CWIPI_FIND_REQUIRED)
CWIPI_LIBRARY ENDIF (CWIPI_FOUND)
CWIPI_LIBRARY_FVMC
CWIPI_LIBRARY_BFTC
CWIPI_INCLUDE_DIR
)
mark_as_advanced(CWIPI_LIBRARY CWIPI_INCLUDE_DIR)
########################################################################
#
# ThirdParty configuration for Nektar++
#
# CWIPI
#
########################################################################
OPTION(NEKTAR_USE_CWIPI
"Use CWIPI for Coupling." OFF)
IF ( NEKTAR_USE_CWIPI )
set(CWIPI_DIR "/usr/local/cwipi" CACHE PATH "CWIPI base path")
find_package(Cwipi)
include_directories(${CWIPI_INCLUDE_DIRS})
ADD_DEFINITIONS(-DNEKTAR_USE_CWIPI)
ENDIF ( NEKTAR_USE_CWIPI )
IF (NEKTAR_USE_CWIPI)
# Set some common CWIPI search paths.
SET(CWIPI_SEARCH_PATHS $ENV{LD_LIBRARY_PATH} $ENV{CWIPI_HOME}/lib)
FIND_LIBRARY(CWIPI_LIBRARY NAMES cwipi fvmc bftc PATHS ${CWIPI_SEARCH_PATHS})
IF (CWIPI_LIBRARY)
GET_FILENAME_COMPONENT(CWIPI_PATH ${CWIPI_LIBRARY} PATH)
SET(CWIPI_INCLUDE_DIR ${CWIPI_PATH}/../include CACHE FILEPATH "CWIPI include directory.")
SET(BUILD_CWIPI OFF)
ELSE()
SET(BUILD_CWIPI ON)
ENDIF ()
CMAKE_DEPENDENT_OPTION(THIRDPARTY_BUILD_CWIPI
"Build CWIPI from ThirdParty" ${BUILD_CWIPI}
"NEKTAR_USE_CWIPI" OFF)
IF (THIRDPARTY_BUILD_CWIPI)
INCLUDE(ExternalProject)
get_filename_component(MPI_LIBRARY_PATH ${MPI_LIBRARY} DIRECTORY)
get_filename_component(MPI_BIN_PATH ${MPI_C_COMPILER} DIRECTORY)
get_filename_component(MPI_INC_PATH ${MPI_LIBRARY_PATH} DIRECTORY)
set(MPI_INC_PATH "${MPI_INC_PATH}/include")
EXTERNALPROJECT_ADD(
cwipi-0.8.2
URL "http://sites.onera.fr/cwipi/sites/sites.onera.fr.cwipi/files/u4/cwipi-0.8.2.tgz"
URL_MD5 "cd28dbea20a08d71f5ff4b4770867268"
STAMP_DIR ${TPBUILD}/stamp
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPSRC}/cwipi-0.8.2
BINARY_DIR ${TPBUILD}/cwipi-0.8.2
TMP_DIR ${TPBUILD}/cwipi-0.8.2-tmp
INSTALL_DIR ${TPDIST}
CONFIGURE_COMMAND ${TPSRC}/cwipi-0.8.2/configure
CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}
--with-mpi-include=${MPI_INC_PATH}
--with-mpi-lib=${MPI_LIBRARY_PATH}
--with-mpi-bin=${MPI_BIN_PATH}
--prefix=${TPDIST}
--libdir=${TPDIST}/lib
--quiet
)
SET(CWIPI_LIBRARY cwipi CACHE FILEPATH
"CWIPI library" FORCE)
SET(CWIPI_LIBRARY_FVMC fvmc CACHE FILEPATH
"CWIPI library" FORCE)
SET(CWIPI_LIBRARY_BFTC bftc CACHE FILEPATH
"CWIPI library" FORCE)
SET(CWIPI_INCLUDE_DIR ${TPDIST}/include CACHE FILEPATH
"CWIPI include" FORCE)
LINK_DIRECTORIES(${TPDIST}/lib)
MESSAGE(STATUS "Build CWIPI: ${TPDIST}/lib/lib${CWIPI_LIBRARY}.so ${TPDIST}/lib/lib${CWIPI_LIBRARY_FVMC}.so ${TPDIST}/lib/lib${CWIPI_LIBRARY_BFTC}.so")
SET(CWIPI_CONFIG_INCLUDE_DIR ${TPINC})
ELSE ()
ADD_CUSTOM_TARGET(cwipi-0.8.2 ALL)
MESSAGE(STATUS "Found CWIPI: ${CWIPI_LIBRARY} ${CWIPI_LIBRARY_FVMC} ${CWIPI_LIBRARY_BFTC}")
SET(CWIPI_CONFIG_INCLUDE_DIR ${CWIPI_INCLUDE_DIR})
ENDIF()
ENDIF( NEKTAR_USE_CWIPI )
INCLUDE_DIRECTORIES(SYSTEM ${CWIPI_INCLUDE_DIR})
MARK_AS_ADVANCED(CWIPI_LIBRARY)
MARK_AS_ADVANCED(CWIPI_LIBRARY_FVMC)
MARK_AS_ADVANCED(CWIPI_LIBRARY_BFTC)
MARK_AS_ADVANCED(CWIPI_INCLUDE_DIR)
...@@ -373,6 +373,13 @@ ADD_DEPENDENCIES(LibUtilities modmetis-5.1.0 boost tinyxml-2.6.2 zlib-1.2.7) ...@@ -373,6 +373,13 @@ ADD_DEPENDENCIES(LibUtilities modmetis-5.1.0 boost tinyxml-2.6.2 zlib-1.2.7)
### Libraries needed specifically by LibUtilities ### ### Libraries needed specifically by LibUtilities ###
### Static libraries do not need to be linked by ### Static libraries do not need to be linked by
# CWIPI
IF ( NEKTAR_USE_CWIPI )
TARGET_LINK_LIBRARIES(LibUtilities LINK_PRIVATE ${CWIPI_LIBRARY} ${CWIPI_LIBRARY_FVMC} ${CWIPI_LIBRARY_BFTC})
ADD_DEPENDENCIES(LibUtilities cwipi-0.8.2)
ENDIF ()
# Scotch # Scotch
IF( NEKTAR_USE_SCOTCH ) IF( NEKTAR_USE_SCOTCH )
TARGET_LINK_LIBRARIES(LibUtilities LINK_PRIVATE TARGET_LINK_LIBRARIES(LibUtilities LINK_PRIVATE
......
...@@ -112,4 +112,10 @@ ADD_DEFINITIONS(-DSOLVER_UTILS_EXPORTS) ...@@ -112,4 +112,10 @@ ADD_DEFINITIONS(-DSOLVER_UTILS_EXPORTS)
ADD_NEKTAR_LIBRARY(SolverUtils lib ${NEKTAR_LIBRARY_TYPE} ${SOLVER_UTILS_SOURCES} ${SOLVER_UTILS_HEADERS}) ADD_NEKTAR_LIBRARY(SolverUtils lib ${NEKTAR_LIBRARY_TYPE} ${SOLVER_UTILS_SOURCES} ${SOLVER_UTILS_HEADERS})
TARGET_LINK_LIBRARIES(SolverUtils GlobalMapping) TARGET_LINK_LIBRARIES(SolverUtils GlobalMapping)
# CWIPI
IF ( NEKTAR_USE_CWIPI )
TARGET_LINK_LIBRARIES(SolverUtils LINK_PRIVATE ${CWIPI_LIBRARY} ${CWIPI_LIBRARY_FVMC} ${CWIPI_LIBRARY_BFTC})
ADD_DEPENDENCIES(SolverUtils cwipi-0.8.2)
ENDIF ()
INSTALL(DIRECTORY ./ DESTINATION ${NEKTAR_INCLUDE_DIR}/SolverUtils COMPONENT dev FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") INSTALL(DIRECTORY ./ DESTINATION ${NEKTAR_INCLUDE_DIR}/SolverUtils COMPONENT dev FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp")
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