Commit d18b2249 authored by Dave Moxey's avatar Dave Moxey

Refactor third-party libraries to use THIRDPARTY_LIBRARY macro

parent 682e97bf
......@@ -10,35 +10,40 @@ MACRO(CONSTRUCT_DEBIAN_DEPS depends outvar)
ENDMACRO()
MACRO(FINALISE_CPACK_COMPONENT name)
CMAKE_PARSE_ARGUMENTS(COMP "" "DESCRIPTION" "" ${ARGN})
IF (NEKTAR_BUILD_PACKAGES)
CMAKE_PARSE_ARGUMENTS(COMP "" "DESCRIPTION" "" ${ARGN})
STRING(TOUPPER ${name} COMPVAR)
STRING(TOUPPER ${name} COMPVAR)
SET(CPACK_COMPONENT_${COMPVAR}_DISPLAY_NAME nektar++-${name}
CACHE INTERNAL "")
SET(CPACK_COMPONENT_${COMPVAR}_DESCRIPTION ${COMP_DESCRIPTION} CACHE INTERNAL "")
SET(CPACK_COMPONENT_${COMPVAR}_DISPLAY_NAME nektar++-${name}
CACHE INTERNAL "")
SET(CPACK_COMPONENT_${COMPVAR}_DESCRIPTION ${COMP_DESCRIPTION} CACHE INTERNAL "")
SET(tmp ${CPACK_COMPONENT_${COMPVAR}_DEPENDS})
LIST(REMOVE_DUPLICATES tmp)
SET(CPACK_COMPONENT_${COMPVAR}_DEPENDS ${tmp} CACHE INTERNAL "")
SET(tmp ${CPACK_COMPONENT_${COMPVAR}_DEPENDS})
LIST(REMOVE_DUPLICATES tmp)
SET(CPACK_COMPONENT_${COMPVAR}_DEPENDS ${tmp} CACHE INTERNAL "")
CONSTRUCT_DEBIAN_DEPS(${CPACK_COMPONENT_${COMPVAR}_DEPENDS} "tmp")
SET(CPACK_DEBIAN_${COMPVAR}_PACKAGE_DEPENDS ${tmp} CACHE INTERNAL "")
CONSTRUCT_DEBIAN_DEPS(${CPACK_COMPONENT_${COMPVAR}_DEPENDS} "tmp")
SET(CPACK_DEBIAN_${COMPVAR}_PACKAGE_DEPENDS ${tmp} CACHE INTERNAL "")
ENDIF()
ENDMACRO()
MACRO(THIRDPARTY_SHARED_LIBNAME name)
FOREACH (lib ${${name}})
LIST(APPEND tmplist "${TPDIST}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${lib}${CMAKE_SHARED_LIBRARY_SUFFIX}")
ENDFOREACH()
SET(${name} ${tmplist})
UNSET(tmplist)
ENDMACRO()
MACRO(THIRDPARTY_LIBRARY varname)
CMAKE_PARSE_ARGUMENTS(TPLIB "" "DESCRIPTION" "STATIC;SHARED" ${ARGN})
MACRO(THIRDPARTY_STATIC_LIBNAME name)
FOREACH (lib ${${name}})
LIST(APPEND tmplist "${TPDIST}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
IF(TPLIB_SHARED)
SET(LIBTYPE "SHARED")
SET(TPLIBS ${TPLIB_SHARED})
ELSEIF(TPLIB_STATIC)
SET(LIBTYPE "STATIC")
SET(TPLIBS ${TPLIB_STATIC})
ENDIF()
FOREACH (lib ${TPLIBS})
LIST(APPEND tmplist "${TPDIST}/lib/${CMAKE_${LIBTYPE}_LIBRARY_PREFIX}${lib}${CMAKE_${LIBTYPE}_LIBRARY_SUFFIX}")
ENDFOREACH()
SET(${name} ${tmplist})
SET(${varname} ${tmplist} CACHE FILEPATH ${TPLIB_DESCRIPTION} FORCE)
UNSET(tmplist)
ENDMACRO()
......
......@@ -65,9 +65,9 @@ IF (THIRDPARTY_BUILD_BOOST)
INCLUDE(ExternalProject)
# Only build the libraries we need
SET(BOOST_LIB_LIST --with-system --with-iostreams --with-filesystem
--with-program_options --with-date_time --with-thread
--with-regex --with-timer --with-chrono)
FOREACH(boostlib ${NEEDED_BOOST_LIBS})
LIST(APPEND BOOST_LIB_LIST --with-${boostlib})
ENDFOREACH()
IF (NOT WIN32)
# We need -fPIC for 64-bit builds
......@@ -89,9 +89,9 @@ IF (THIRDPARTY_BUILD_BOOST)
ELSEIF (MSVC14)
SET(TOOLSET msvc-14.0)
ENDIF()
ELSE(APPLE)
ELSE()
SET(TOOLSET gcc)
ENDIF(APPLE)
ENDIF()
IF (NOT WIN32)
EXTERNALPROJECT_ADD(
......@@ -162,40 +162,24 @@ IF (THIRDPARTY_BUILD_BOOST)
ENDIF(THIRDPARTY_BUILD_ZLIB)
# Set up CMake variables
SET(Boost_CHRONO_LIBRARY boost_chrono)
SET(Boost_CHRONO_LIBRARY_DEBUG boost_chrono)
SET(Boost_CHRONO_LIBRARY_RELEASE boost_chrono)
SET(Boost_DATE_TIME_LIBRARY boost_date_time)
SET(Boost_DATE_TIME_LIBRARY_DEBUG boost_date_time)
SET(Boost_DATE_TIME_LIBRARY_RELEASE boost_date_time)
SET(Boost_FILESYSTEM_LIBRARY boost_filesystem)
SET(Boost_FILESYSTEM_LIBRARY_DEBUG boost_filesystem)
SET(Boost_FILESYSTEM_LIBRARY_RELEASE boost_filesystem)
SET(Boost_IOSTREAMS_LIBRARY boost_iostreams)
SET(Boost_IOSTREAMS_LIBRARY_DEBUG boost_iostreams)
SET(Boost_IOSTREAMS_LIBRARY_RELEASE boost_iostreams)
SET(Boost_PROGRAM_OPTIONS_LIBRARY boost_program_options)
SET(Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG boost_program_options)
SET(Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE boost_program_options)
SET(Boost_REGEX_LIBRARY boost_regex)
SET(Boost_REGEX_LIBRARY_DEBUG boost_regex)
SET(Boost_REGEX_LIBRARY_RELEASE boost_regex)
SET(Boost_SYSTEM_LIBRARY boost_system)
SET(Boost_SYSTEM_LIBRARY_DEBUG boost_system)
SET(Boost_SYSTEM_LIBRARY_RELEASE boost_system)
SET(Boost_THREAD_LIBRARY boost_thread)
SET(Boost_THREAD_LIBRARY_DEBUG boost_thread)
SET(Boost_THREAD_LIBRARY_RELEASE boost_thread)
SET(Boost_TIMER_LIBRARY boost_timer)
SET(Boost_TIMER_LIBRARY_DEBUG boost_timer)
SET(Boost_TIMER_LIBRARY_RELEASE boost_timer)
FOREACH(BOOSTLIB ${NEEDED_BOOST_LIBS})
STRING(TOUPPER ${BOOSTLIB} BOOSTLIB_UPPER)
THIRDPARTY_LIBRARY(Boost_${BOOSTLIB_UPPER}_LIBRARY
SHARED boost_${BOOSTLIB} DESCRIPTION "Boost ${BOOSTLIB} library")
THIRDPARTY_LIBRARY(Boost_${BOOSTLIB_UPPER}_LIBRARY_DEBUG
SHARED boost_${BOOSTLIB} DESCRIPTION "Boost ${BOOSTLIB} library, debug")
THIRDPARTY_LIBRARY(Boost_${BOOSTLIB_UPPER}_LIBRARY_RELEASE
SHARED boost_${BOOSTLIB} DESCRIPTION "Boost ${BOOSTLIB} library, release")
MARK_AS_ADVANCED(Boost_${BOOSTLIB_UPPER}_LIBRARY)
MARK_AS_ADVANCED(Boost_${BOOSTLIB_UPPER}_LIBRARY_DEBUG)
MARK_AS_ADVANCED(Boost_${BOOSTLIB_UPPER}_LIBRARY_RELEASE)
LIST(APPEND Boost_LIBRARIES ${Boost_${BOOSTLIB_UPPER}_LIBRARY})
ENDFOREACH()
SET(Boost_INCLUDE_DIRS ${TPSRC}/dist/include)
SET(Boost_CONFIG_INCLUDE_DIR ${TPINC})
SET(Boost_LIBRARY_DIRS ${TPSRC}/dist/lib)
SET(Boost_CONFIG_LIBRARY_DIR ${TPLIB})
SET(Boost_LIBRARIES boost_chrono boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_system boost_thread boost_timer)
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
STRING(REPLACE ";" ", " NEEDED_BOOST_LIBS_STRING "${NEEDED_BOOST_LIBS}")
MESSAGE(STATUS "Build boost libs: ${NEEDED_BOOST_LIBS_STRING}")
......
......@@ -39,16 +39,14 @@ IF (NEKTAR_USE_FFTW)
TMP_DIR ${TPBUILD}/fftw-3.2.2-tmp
INSTALL_DIR ${TPDIST}
CONFIGURE_COMMAND CC=${CMAKE_C_COMPILER} ${TPSRC}/fftw-3.2.2/configure --prefix=${TPDIST} --quiet --enable-shared --disable-dependency-tracking
)
)
SET(FFTW_LIBRARY fftw3 CACHE FILEPATH
"FFTW library" FORCE)
THIRDPARTY_LIBRARY(FFTW_LIBRARY SHARED fftw3
DESCRIPTION "FFTW library")
SET(FFTW_INCLUDE_DIR ${TPDIST}/include CACHE FILEPATH
"FFTW include" FORCE)
LINK_DIRECTORIES(${TPDIST}/lib)
MESSAGE(STATUS "Build FFTW: ${TPDIST}/lib/lib${FFTW_LIBRARY}.so")
MESSAGE(STATUS "Build FFTW: ${FFTW_LIBRARY}")
SET(FFTW_CONFIG_INCLUDE_DIR ${TPINC})
ELSE ()
ADD_CUSTOM_TARGET(fftw-3.2.2 ALL)
......
......@@ -61,13 +61,11 @@ IF (NEKTAR_USE_HDF5)
${TPSRC}/hdf5-1.8.16
)
SET(HDF5_LIBRARIES hdf5-shared CACHE FILEPATH
"HDF5 libraries" FORCE)
THIRDPARTY_LIBRARY(HDF5_LIBRARIES SHARED hdf5-shared
DESCRIPTION "HDF5 library")
SET(HDF5_INCLUDE_DIRS ${TPDIST}/include CACHE FILEPATH
"HDF5 include directory" FORCE)
LINK_DIRECTORIES(${TPDIST}/lib)
MESSAGE(STATUS "Build HDF5: ${HDF5_LIBRARIES}")
SET(HDF5_CONFIG_INCLUDE_DIR ${TPINC})
......
......@@ -80,9 +80,8 @@ IF( NEKTAR_USE_MPI )
)
SET_TARGET_PROPERTIES(openmpi-1.10.3 PROPERTIES EXCLUDE_FROM_ALL 1)
SET(MPI_CXX_LIBRARIES mpi mpi_cxx)
THIRDPARTY_SHARED_LIBNAME(MPI_CXX_LIBRARIES)
SET(MPI_CXX_LIBRARIES ${MPI_CXX_LIBRARIES} CACHE FILEPATH "MPI C++ libraries" FORCE)
THIRDPARTY_LIBRARY(MPI_CXX_LIBRARIES SHARED mpi mpi_cxx
DESCRIPTION "MPI C++ libraries")
SET(MPI_CXX_COMPILE_FLAGS "" CACHE STRING "MPI compiler flags" FORCE)
SET(MPI_CXX_INCLUDE_PATH ${TPDIST}/include CACHE FILEPATH "MPI include path" FORCE)
SET(MPI_CXX_COMPILER ${TPDIST}/bin/mpicxx CACHE FILEPATH "MPI C++ compiler" FORCE)
......@@ -123,14 +122,14 @@ IF( NEKTAR_USE_MPI )
-DCMAKE_INSTALL_PREFIX:PATH=${TPDIST}
${TPSRC}/gsmpi-1.2.1
)
SET(GSMPI_LIBRARY gsmpi CACHE FILEPATH
"GSMPI path" FORCE)
THIRDPARTY_LIBRARY(GSMPI_LIBRARY STATIC gsmpi
DESCRIPTION "GSMPI library")
THIRDPARTY_LIBRARY(XXT_LIBRARY STATIC xxt
DESCRIPTION "XXT library")
MARK_AS_ADVANCED(GSMPI_LIBRARY)
SET(XXT_LIBRARY xxt CACHE FILEPATH
"XXT path" FORCE)
MARK_AS_ADVANCED(XXT_LIBRARY)
THIRDPARTY_STATIC_LIBNAME(GSMPI_LIBRARY)
THIRDPARTY_STATIC_LIBNAME(XXT_LIBRARY)
MESSAGE(STATUS "Build GSMPI: ${GSMPI_LIBRARY}")
MESSAGE(STATUS "Build XXT: ${XXT_LIBRARY}")
......
......@@ -40,14 +40,8 @@ IF (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
ENDIF()
ENDIF()
SET(METIS_LIB metis CACHE FILEPATH "METIS library" FORCE)
THIRDPARTY_LIBRARY(METIS_LIB STATIC metis DESCRIPTION "Metis library")
MARK_AS_ADVANCED(METIS_LIB)
MESSAGE(STATUS "Build Metis: ${METIS_LIB}")
LINK_DIRECTORIES(${TPDIST}/lib)
INCLUDE_DIRECTORIES(${TPDIST}/include)
IF (WIN32)
MESSAGE(STATUS "Build Metis: ${TPDIST}/${LIB_DIR}/${METIS_LIB}.dll")
ELSE ()
MESSAGE(STATUS "Build Metis: ${TPDIST}/${LIB_DIR}/lib${METIS_LIB}.a")
ENDIF()
INCLUDE_DIRECTORIES(${TPDIST}/include)
\ No newline at end of file
......@@ -66,13 +66,11 @@ IF (NEKTAR_USE_PETSC)
${PETSC_NO_MPI}
BUILD_COMMAND MAKEFLAGS= make)
SET(PETSC_LIBRARIES petsc CACHE FILEPATH
"PETSc library" FORCE)
THIRDPARTY_LIBRARY(PETSC_LIBRARIES SHARED petsc
DESCRIPTION "PETSc library")
SET(PETSC_INCLUDES ${TPDIST}/include CACHE FILEPATH
"PETSc includes" FORCE)
LINK_DIRECTORIES(${TPDIST}/lib)
MESSAGE(STATUS "Build PETSc: ${TPDIST}/${LIB_DIR}/lib${PETSC_LIBRARIES}.so")
MESSAGE(STATUS "Build PETSc: ${PETSC_LIBRARIES}")
SET(PETSC_CONFIG_INCLUDE_DIR ${TPINC})
ELSE (THIRDPARTY_BUILD_PETSC)
INCLUDE(FindPETSc)
......
......@@ -79,17 +79,12 @@ IF (NEKTAR_USE_SCOTCH)
prefix=${TPDIST} install
)
SET(SCOTCH_LIBRARY scotch CACHE FILEPATH
"Scotch library" FORCE)
SET(SCOTCHERR_LIBRARY scotcherr CACHE FILEPATH
"Scotch error library" FORCE)
THIRDPARTY_LIBRARY(SCOTCH_LIBRARY STATIC scotch
DESCRIPTION "Scotch library")
THIRDPARTY_LIBRARY(SCOTCHERR_LIBRARY STATIC scotcherr
DESCRIPTION "Scotch error library")
SET(SCOTCH_INCLUDE_DIR ${TPDIST}/include CACHE FILEPATH
"Scotch include directory" FORCE)
LINK_DIRECTORIES(${TPDIST}/lib)
THIRDPARTY_STATIC_LIBNAME(SCOTCH_LIBRARY)
THIRDPARTY_STATIC_LIBNAME(SCOTCHERR_LIBRARY)
MESSAGE(STATUS "Build Scotch: ${SCOTCH_LIBRARY}")
SET(SCOTCH_CONFIG_INCLUDE_DIR ${TPINC})
ELSE (THIRDPARTY_BUILD_SCOTCH)
......
......@@ -32,21 +32,11 @@ IF(NEKTAR_USE_MESHGEN)
-DCMAKE_INSTALL_PREFIX:PATH=${TPDIST}
${TPSRC}/tetgen-1.5
)
SET(TETGEN_LIBRARY tetgen CACHE FILEPATH
"TetGen library" FORCE)
THIRDPARTY_LIBRARY(TETGEN_LIBRARY STATIC tetgen
DESCRIPTION "Tetgen library")
SET(TETGEN_INCLUDE_DIR ${TPDIST}/include CACHE FILEPATH
"TetGen include" FORCE)
LINK_DIRECTORIES(${TPDIST}/lib)
IF (WIN32)
MESSAGE(STATUS
"Build TetGen: ${TPDIST}/${LIB_DIR}/${TETGEN_LIBRARY}.dll")
ELSE ()
MESSAGE(STATUS
"Build TetGen: ${TPDIST}/${LIB_DIR}/lib${TETGEN_LIBRARY}.a")
ENDIF ()
MESSAGE(STATUS "Build TetGen: ${TETGEN_LIBRARY}")
SET(TETGEN_CONFIG_INCLUDE_DIR ${TPINC})
ELSE()
ADD_CUSTOM_TARGET(tetgen-1.5 ALL)
......@@ -54,5 +44,7 @@ IF(NEKTAR_USE_MESHGEN)
SET(TRIANGLE_CONFIG_INCLUDE_DIR ${TETGEN_INCLUDE_DIR})
ENDIF (THIRDPARTY_BUILD_TETGEN)
MARK_AS_ADVANCED(TETGEN_LIBRARY)
MARK_AS_ADVANCED(TETGEN_INCLUDE_DIR)
INCLUDE_DIRECTORIES(SYSTEM ${TETGEN_INCLUDE_DIR})
ENDIF(NEKTAR_USE_MESHGEN)
......@@ -43,22 +43,13 @@ IF (THIRDPARTY_BUILD_TINYXML)
-DCMAKE_INSTALL_PREFIX:PATH=${TPDIST}
-DCMAKE_CXX_FLAGS:STRING=-DTIXML_USE_STL
${TPSRC}/tinyxml-2.6.2
)
SET(TINYXML_LIBRARY tinyxml CACHE FILEPATH
"TinyXML library" FORCE)
)
THIRDPARTY_LIBRARY(TINYXML_LIBRARY STATIC tinyxml
DESCRIPTION "TinyXML library")
SET(TINYXML_INCLUDE_DIR ${TPDIST}/include CACHE FILEPATH
"TinyXML include" FORCE)
LINK_DIRECTORIES(${TPDIST}/lib)
IF (WIN32)
MESSAGE(STATUS
"Build TinyXML: ${TPDIST}/${LIB_DIR}/${TINYXML_LIBRARY}.dll")
ELSE ()
MESSAGE(STATUS
"Build TinyXML: ${TPDIST}/${LIB_DIR}/lib${TINYXML_LIBRARY}.a")
ENDIF ()
MESSAGE(STATUS "Build TinyXML: ${TINYXML_LIBRARY}")
SET(TINYXML_CONFIG_INCLUDE_DIR ${TPINC})
ELSE()
ADD_CUSTOM_TARGET(tinyxml-2.6.2 ALL)
......
......@@ -62,25 +62,23 @@ IF (THIRDPARTY_BUILD_ZLIB)
ENDIF ()
IF (WIN32)
SET(ZLIB_LIBRARY zlib CACHE FILEPATH
"Zlib library" FORCE)
SET(ZLIB_LIBRARY_DEBUG zlibd CACHE FILEPATH
"Zlib library" FORCE)
SET(ZLIB_LIBRARY_RELEASE zlib CACHE FILEPATH
"Zlib library" FORCE)
MESSAGE(STATUS "Build Zlib: ${TPDIST}/${LIB_DIR}/${ZLIB_LIBRARY}.dll")
THIRDPARTY_LIBRARY(ZLIB_LIBRARY SHARED zlib
DESCRIPTION "Zlib library")
THIRDPARTY_LIBRARY(ZLIB_LIBRARY_DEBUG SHARED zlibd
DESCRIPTION "Zlib library")
THIRDPARTY_LIBRARY(ZLIB_LIBRARY_RELEASE SHARED zlib
DESCRIPTION "Zlib library")
ELSE ()
SET(ZLIB_LIBRARY z CACHE FILEPATH
"Zlib library" FORCE)
SET(ZLIB_LIBRARY_DEBUG z CACHE FILEPATH
"Zlib library" FORCE)
SET(ZLIB_LIBRARY_RELEASE z CACHE FILEPATH
"Zlib library" FORCE)
MESSAGE(STATUS "Build Zlib: ${TPDIST}/${LIB_DIR}/lib${ZLIB_LIBRARY}.a")
THIRDPARTY_LIBRARY(ZLIB_LIBRARY SHARED z
DESCRIPTION "Zlib library")
THIRDPARTY_LIBRARY(ZLIB_LIBRARY_DEBUG SHARED z
DESCRIPTION "Zlib library")
THIRDPARTY_LIBRARY(ZLIB_LIBRARY_RELEASE SHARED z
DESCRIPTION "Zlib library")
ENDIF ()
MESSAGE(STATUS "Build Zlib: ${ZLIB_LIBRARY}")
SET(ZLIB_INCLUDE_DIR ${TPDIST}/include CACHE PATH "Zlib include" FORCE)
LINK_DIRECTORIES(${TPDIST}/lib)
SET(ZLIB_CONFIG_INCLUDE_DIR ${TPINC})
ELSE (THIRDPARTY_BUILD_ZLIB)
ADD_CUSTOM_TARGET(zlib-1.2.7 ALL)
......@@ -88,4 +86,8 @@ ELSE (THIRDPARTY_BUILD_ZLIB)
SET(ZLIB_CONFIG_INCLUDE_DIR ${ZLIB_INCLUDE_DIR})
ENDIF (THIRDPARTY_BUILD_ZLIB)
MARK_AS_ADVANCED(ZLIB_LIBRARY)
MARK_AS_ADVANCED(ZLIB_LIBRARY_DEBUG)
MARK_AS_ADVANCED(ZLIB_LIBRARY_RELEASE)
MARK_AS_ADVANCED(ZLIB_INCLUDE_DIR)
INCLUDE_DIRECTORIES(SYSTEM ${ZLIB_INCLUDE_DIR})
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