Commit 3c9917d0 authored by Chris Cantwell's avatar Chris Cantwell
Browse files

Tidy up packaging system and added option to cmake advanced list.

parent f70c16a3
......@@ -50,8 +50,8 @@ SET(NEKTAR_LIBRARY_TYPE "SHARED")
# Set up RPATH
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
#SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
#SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
SET(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
......@@ -68,6 +68,8 @@ OPTION(NEKTAR_BUILD_UTILITIES "Build utilities." ON)
OPTION(NEKTAR_BUILD_UNIT_TESTS "Build unit tests." ON)
OPTION(NEKTAR_BUILD_TESTS "Build regression tests." ON)
OPTION(NEKTAR_BUILD_TIMINGS "Build benchmark timing codes." OFF)
OPTION(NEKTAR_BUILD_PACKAGES "Build Nektar++ binary packages" OFF)
MARK_AS_ADVANCED(NEKTAR_BUILD_PACKAGES)
OPTION(NEKTAR_TEST_ALL "Include full set of regression tests to this build." OFF)
......@@ -315,4 +317,6 @@ INSTALL(FILES ${CMAKE_BINARY_DIR}/Nektar++Config.cmake
SET(NEKTAR_PASSED_FIRST_CONFIGURE ON CACHE BOOL INTERNAL)
MARK_AS_ADVANCED(NEKTAR_PASSED_FIRST_CONFIGURE)
add_subdirectory(pkg)
IF(NEKTAR_BUILD_PACKAGES)
add_subdirectory(pkg)
ENDIF(NEKTAR_BUILD_PACKAGES)
function (find_lib_files PKG_INSTALL_LIBS PKG_INSTALL_LIBS_FILES)
# Find library file and add the versioned form of each library
set(PKG_INSTALL_LIBS_FILES)
foreach(l ${PKG_INSTALL_LIBS})
get_target_property(TARGET_LOCATION ${l} LOCATION)
if (NOT TARGET_LOCATION)
message(FATAL_ERROR "Target '${l}' could not be found.")
endif ()
list(APPEND PKG_INSTALL_LIBS_FILES ${TARGET_LOCATION})
if (APPLE)
list(APPEND PKG_INSTALL_LIBS_FILES
${TARGET_LOCATION}.${VERSION_MAJOR_MINOR})
else ()
list(APPEND PKG_INSTALL_LIBS_FILES
${TARGET_LOCATION}.${NEKTAR_VERSION})
endif()
endforeach()
set(PKG_INSTALL_LIBS_FILES ${PKG_INSTALL_LIBS_FILES} PARENT_SCOPE)
endfunction ()
function (find_bin_files PKG_INSTALL_BINS PKG_INSTALL_BINS_FILES)
# Find binary files
set(PKG_INSTALL_BINS_FILES)
foreach(b ${PKG_INSTALL_BINS})
get_target_property(TARGET_LOCATION ${b} LOCATION)
if (NOT TARGET_LOCATION)
message(FATAL_ERROR "Target '${l}' could not be found.")
endif ()
list(APPEND PKG_INSTALL_BINS_FILES ${TARGET_LOCATION})
list(APPEND PKG_INSTALL_BINS_FILES
${TARGET_LOCATION}-${NEKTAR_VERSION})
endforeach()
set(PKG_INSTALL_BINS_FILES ${PKG_INSTALL_BINS_FILES} PARENT_SCOPE)
endfunction ()
macro (add_deb_package)
set(options "")
set(oneValueArgs NAME SUMMARY DESCRIPTION)
......@@ -6,8 +41,14 @@ macro (add_deb_package)
"${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/${PKG_NAME}-deb)
find_lib_files("${PKG_INSTALL_LIBS}" PKG_INSTALL_LIBS_FILES)
find_bin_files("${PKG_INSTALL_BINS}" PKG_INSTALL_BINS_FILES)
# Configure project for this package
configure_file(CMakeListsDpkg.txt.in
${BUILD_DIR}/CMakeLists.txt @ONLY)
add_custom_target(
pkg-deb-${PKG_NAME}
rm -f ${BUILD_DIR}/CPackConfig.cmake
......@@ -15,6 +56,8 @@ macro (add_deb_package)
COMMAND ${CMAKE_CPACK_COMMAND}
WORKING_DIRECTORY ${BUILD_DIR}
)
add_dependencies(pkg-deb-${PKG_NAME}
${PKG_INSTALL_LIBS} ${PKG_INSTALL_BINS})
add_dependencies(pkg-deb pkg-deb-${PKG_NAME})
endmacro (add_deb_package)
......@@ -26,6 +69,10 @@ macro (add_rpm_package)
"${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/${PKG_NAME}-rpm)
find_lib_files("${PKG_INSTALL_LIBS}" PKG_INSTALL_LIBS_FILES)
find_bin_files("${PKG_INSTALL_BINS}" PKG_INSTALL_BINS_FILES)
configure_file(CMakeListsRpm.txt.in
${BUILD_DIR}/CMakeLists.txt @ONLY)
add_custom_target(
......@@ -35,6 +82,8 @@ macro (add_rpm_package)
COMMAND ${CMAKE_CPACK_COMMAND}
WORKING_DIRECTORY ${BUILD_DIR}
)
add_dependencies(pkg-rpm-${PKG_NAME}
${PKG_INSTALL_LIBS} ${PKG_INSTALL_BINS})
add_dependencies(pkg-rpm pkg-rpm-${PKG_NAME})
endmacro (add_rpm_package)
......@@ -46,6 +95,10 @@ macro (add_tgz_package)
"${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/${PKG_NAME}-tgz)
find_lib_files("${PKG_INSTALL_LIBS}" PKG_INSTALL_LIBS_FILES)
find_bin_files("${PKG_INSTALL_BINS}" PKG_INSTALL_BINS_FILES)
configure_file(CMakeListsTgz.txt.in
${BUILD_DIR}/CMakeLists.txt @ONLY)
add_custom_target(
......@@ -55,6 +108,8 @@ macro (add_tgz_package)
COMMAND ${CMAKE_CPACK_COMMAND}
WORKING_DIRECTORY ${BUILD_DIR}
)
add_dependencies(pkg-tgz-${PKG_NAME}
${PKG_INSTALL_LIBS} ${PKG_INSTALL_BINS})
add_dependencies(pkg-tgz pkg-tgz-${PKG_NAME})
endmacro (add_tgz_package)
......
......@@ -3,37 +3,44 @@ include (CMakeCommon.cmake)
add_custom_target(pkg)
# LibUtilities
get_target_property(TARGET_LOCATION LibUtilities LOCATION)
list(APPEND libnektar++-utilities_LIBS ${TARGET_LOCATION})
list(APPEND nektar++_LIBS ${TARGET_LOCATION})
list(APPEND libnektar++-utilities_LIBS LibUtilities)
list(APPEND nektar++_LIBS LibUtilities)
# StdRegions
get_target_property(TARGET_LOCATION StdRegions LOCATION)
list(APPEND libnektar++-stdregions_LIBS ${TARGET_LOCATION})
list(APPEND nektar++_LIBS ${TARGET_LOCATION})
list(APPEND libnektar++-stdregions_LIBS StdRegions)
list(APPEND nektar++_LIBS StdRegions)
# SpatialDomains
get_target_property(TARGET_LOCATION SpatialDomains LOCATION)
list(APPEND libnektar++-spatialdomains_LIBS ${TARGET_LOCATION})
list(APPEND nektar++_LIBS ${TARGET_LOCATION})
list(APPEND libnektar++-spatialdomains_LIBS SpatialDomains)
list(APPEND nektar++_LIBS SpatialDomains)
# LocalRegions
get_target_property(TARGET_LOCATION LocalRegions LOCATION)
list(APPEND libnektar++-localregions_LIBS ${TARGET_LOCATION})
list(APPEND nektar++_LIBS ${TARGET_LOCATION})
list(APPEND libnektar++-localregions_LIBS LocalRegions)
list(APPEND nektar++_LIBS LocalRegions)
# MultiRegions
get_target_property(TARGET_LOCATION MultiRegions LOCATION)
list(APPEND libnektar++-multiregions_LIBS ${TARGET_LOCATION})
list(APPEND nektar++_LIBS ${TARGET_LOCATION})
list(APPEND libnektar++-multiregions_LIBS MultiRegions)
list(APPEND nektar++_LIBS MultiRegions)
# SolverUtils
get_target_property(TARGET_LOCATION SolverUtils LOCATION)
list(APPEND libnektar++-solverutils_LIBS ${TARGET_LOCATION})
list(APPEND nektar++_LIBS ${TARGET_LOCATION})
list(APPEND libnektar++-solverutils_LIBS SolverUtils)
list(APPEND nektar++_LIBS SolverUtils)
# IncNavierStokesSolver
list(APPEND nektar++-incnavierstokes-solver_BINS IncNavierStokesSolver)
list(APPEND nektar++_BINS IncNavierStokesSolver)
# CardiacEPSolver
list(APPEND nektar++-cardiacep-solver_BINS CardiacEPSolver)
list(APPEND nektar++-BINS CardiacEPSolver)
# CompressibleFlowSolver
list(APPEND nektar++-compressibleflow-solver_BINS CompressibleFlowSolver)
list(APPEND nektar++-BINS CompressibleFlowSolver)
# Check if we can build debian files
find_program(DPKG "dpkg")
mark_as_advanced(DPKG)
if (DPKG)
add_custom_target(pkg-deb)
add_dependencies(pkg pkg-deb)
......@@ -84,11 +91,19 @@ if (DPKG)
complete spectral/hp element solvers."
DEPENDS "libnektar++-stdregions (= ${NEKTAR_VERSION}), libnektar++-utilities (= ${NEKTAR_VERSION}), libnektar++-spatialdomains (= ${NEKTAR_VERSION}), libnektar++-localregions (= ${NEKTAR_VERSION}), libnektar++-multiregions (= ${NEKTAR_VERSION})"
INSTALL_LIBS "${libnektar++-solverutils_LIBS}")
#add_deb_package(
# NAME nektar++-incnavierstokes-solver
# SUMMARY "Nektar++ incompressible Navier-Stokes flow solver"
# DESCRIPTION
# "Solves the incompressible Navier-Stokes equations using the Nektar++
# high-order spectral/hp element framework"
# DEPENDS "libnektar++-stdregions (= ${NEKTAR_VERSION}), libnektar++- utilities (= ${NEKTAR_VERSION}), libnektar++-spatialdomains (= ${NEKTAR_VERSION}), libnektar++-localregions (= ${NEKTAR_VERSION}), libnektar++-multiregions (= ${NEKTAR_VERSION})"
# INSTALL_BINS "${nektar++-incnavierstokes-solver_BINS}")
endif (DPKG)
find_program(RPMBUILD "rpmbuild")
mark_as_advanced(RPMBUILD)
if (RPMBUILD)
add_custom_target(pkg-rpm)
add_dependencies(pkg pkg-rpm)
......@@ -146,4 +161,5 @@ add_tgz_package(
NAME nektar++
SUMMARY "Nektar++ libraries and solvers"
DESCRIPTION "This is all of Nektar++"
INSTALL_LIBS "${nektar++_LIBS}")
INSTALL_LIBS "${nektar++_LIBS}"
)
......@@ -38,22 +38,13 @@ set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-1_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
# Files to go in the package
set(INSTALL_BINS "@PKG_INSTALL_BINS@")
set(INSTALL_LIBS "@PKG_INSTALL_LIBS@")
# Add the versioned form of each library
foreach(l ${INSTALL_LIBS})
if (APPLE)
list(APPEND INSTALL_LIBS ${l}.${VERSION_MAJOR_MINOR})
else ()
list(APPEND INSTALL_LIBS ${l}.${CPACK_PACKAGE_VERSION})
endif()
endforeach()
set(INSTALL_BINS_FILES "@PKG_INSTALL_BINS_FILES@")
set(INSTALL_LIBS_FILES "@PKG_INSTALL_LIBS_FILES@")
# Install any libraries in the lib directory
if(INSTALL_LIBS)
message(STATUS "Packaging libraries: ${INSTALL_LIBS}")
install(FILES ${INSTALL_LIBS} DESTINATION lib
if(INSTALL_LIBS_FILES)
message(STATUS "Packaging libraries: ${INSTALL_LIBS_FILES}")
install(FILES ${INSTALL_LIBS_FILES} DESTINATION lib
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
......@@ -62,9 +53,9 @@ if(INSTALL_LIBS)
endif()
# Install any binaries in the bin directory
if(INSTALL_BINS)
message(STATUS "Packaging binaries: ${INSTALL_BINS}")
install(FILES ${INSTALL_BINS} DESTINATION bin
if(INSTALL_BINS_FILES)
message(STATUS "Packaging binaries: ${INSTALL_BINS_FILES}")
install(FILES ${INSTALL_BINS_FILES} DESTINATION bin
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
......
......@@ -34,21 +34,12 @@ set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-1.${CPACK_RPM_PACKAGE_ARCHITECTURE}")
# Files to go in the package
set(INSTALL_BINS "@PKG_INSTALL_BINS@")
set(INSTALL_LIBS "@PKG_INSTALL_LIBS@")
# Add the versioned form of each library
foreach(l ${INSTALL_LIBS})
if (APPLE)
list(APPEND INSTALL_LIBS ${l}.${VERSION_MAJOR_MINOR})
else ()
list(APPEND INSTALL_LIBS ${l}.${CPACK_PACKAGE_VERSION})
endif()
endforeach()
set(INSTALL_BINS_FILES "@PKG_INSTALL_BINS_FILES@")
set(INSTALL_LIBS_FILES "@PKG_INSTALL_LIBS_FILES@")
# Install any libraries in the lib directory
if(INSTALL_LIBS)
install(FILES ${INSTALL_LIBS} DESTINATION lib
if(INSTALL_LIBS_FILES)
install(FILES ${INSTALL_LIBS_FILES} DESTINATION lib
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
......@@ -57,8 +48,8 @@ if(INSTALL_LIBS)
endif()
# Install any binaries in the bin directory
if(INSTALL_BINS)
install(FILES ${INSTALL_BINS} DESTINATION bin
if(INSTALL_BINS_FILES)
install(FILES ${INSTALL_BINS_FILES} DESTINATION bin
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
......
......@@ -23,21 +23,12 @@ set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
# Files to go in the package
set(INSTALL_BINS "@PKG_INSTALL_BINS@")
set(INSTALL_LIBS "@PKG_INSTALL_LIBS@")
# Add the versioned form of each library
foreach(l ${INSTALL_LIBS})
if (APPLE)
list(APPEND INSTALL_LIBS ${l}.${VERSION_MAJOR_MINOR})
else ()
list(APPEND INSTALL_LIBS ${l}.${CPACK_PACKAGE_VERSION})
endif()
endforeach()
set(INSTALL_BINS_FILES "@PKG_INSTALL_BINS_FILES@")
set(INSTALL_LIBS_FILES "@PKG_INSTALL_LIBS_FILES@")
# Install any libraries in the lib directory
if(INSTALL_LIBS)
install(FILES ${INSTALL_LIBS} DESTINATION lib
if(INSTALL_LIBS_FILES)
install(FILES ${INSTALL_LIBS_FILES} DESTINATION lib
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
......@@ -46,8 +37,8 @@ if(INSTALL_LIBS)
endif()
# Install any binaries in the bin directory
if(INSTALL_BINS)
install(FILES ${INSTALL_BINS} DESTINATION bin
if(INSTALL_BINS_FILES)
install(FILES ${INSTALL_BINS_FILES} DESTINATION bin
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
......
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