Commit ca1bc497 authored by Dave Moxey's avatar Dave Moxey

Fix some Debian-specific packaing things (libraries prefixed with lib)

parent f4e284aa
......@@ -198,7 +198,7 @@ show :
else (WIN32)
set (libname ${name})
endif (WIN32)
find_library (PETSC_LIBRARY_${suffix} NAMES ${libname} HINTS ${petsc_lib_dir} NO_DEFAULT_PATH)
find_library (PETSC_LIBRARY_${suffix} NAMES ${libname} ${libname}_real HINTS ${petsc_lib_dir} NO_DEFAULT_PATH)
set (PETSC_LIBRARIES_${suffix} "${PETSC_LIBRARY_${suffix}}")
mark_as_advanced (PETSC_LIBRARY_${suffix})
endmacro (PETSC_FIND_LIBRARY suffix name)
......
......@@ -25,7 +25,7 @@
# Always runs the given test, use this when you need to re-run tests
# because parent variables have made old cache entries stale. The LANGUAGE
# variable is either C or CXX indicating which compiler the test should
# use.
# use.
# MULTIPASS_C_SOURCE_RUNS (Name INCLUDES LIBRARIES SOURCE RUNS)
# DEPRECATED! This is only included for backwards compatability. Use
# the more general MULTIPASS_SOURCE_RUNS instead.
......@@ -46,7 +46,7 @@ macro (FIND_PACKAGE_MULTIPASS _name _current)
# The name of the stored value for the given state
set (_stored_var PACKAGE_MULTIPASS_${_NAME}_${_state})
if (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}")
set (_states_current "NO")
set (_states_current "NO")
endif (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}")
set (${_stored_var} "${${_NAME}_${_state}}" CACHE INTERNAL "Stored state for ${_name}." FORCE)
list (REMOVE_AT _args 0)
......@@ -68,7 +68,7 @@ macro (FIND_PACKAGE_MULTIPASS _name _current)
if (_cmd STREQUAL "DEPENDENTS")
list (REMOVE_AT _args 0)
foreach (dep ${_args})
set (${_NAME}_${dep} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
set (${_NAME}_${dep} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
endforeach (dep)
endif (_cmd STREQUAL "DEPENDENTS")
set (${_NAME}_FOUND "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
......
......@@ -39,9 +39,3 @@ if(NOT DEFINED ARCHITECTURE)
OUTPUT_VARIABLE ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
# Override the output filename to comply with Debian naming policy
if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${ARCHITECTURE}")
endif()
......@@ -4,6 +4,14 @@
## Frequently used Nektar++ CMake configuration macros and functions
##
# Attempt to determine architecture for debian/RPM packages
execute_process(COMMAND dpkg --print-architecture
OUTPUT_VARIABLE DPKG_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND rpm --eval %{_arch}
OUTPUT_VARIABLE RPM_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE)
#
# CONSTRUCT_DEBIAN_DEPS(depends outvar)
#
......@@ -19,9 +27,17 @@
MACRO(CONSTRUCT_DEBIAN_DEPS depends outvar)
SET(${outvar} "")
#MESSAGE(STATUS ${NEKTAR_LIBS})
FOREACH (pkg ${depends})
STRING(TOLOWER ${pkg} pkg_lower)
SET(${outvar} "${DEB_DEPS}, nektar++-${pkg_lower} (>= ${NEKTAR_VERSION})")
LIST(FIND NEKTAR_LIBS ${pkg_lower} islib)
IF(islib EQUAL -1)
SET(${outvar} "${DEB_DEPS}, nektar++-${pkg_lower} (>= ${NEKTAR_VERSION})")
ELSE()
SET(${outvar} "${DEB_DEPS}, libnektar++-${pkg_lower} (>= ${NEKTAR_VERSION})")
ENDIF()
ENDFOREACH()
# Remove starting ", "
......@@ -33,9 +49,10 @@ ENDMACRO()
#
# FINALISE_CPACK_COMPONENT(name DESCRIPTION <description>)
#
# Finalises the variables needed for a component in order to be packaged by
# CPack. This should be called once all executables and libraries have been
# added to the component. This routine will:
# Finalises the variables needed for a component (and only really a component
# containing executables) in order to be packaged by CPack. This should be
# called once all executables and libraries have been added to the
# component. This routine will:
#
# - setup the component's name and description
# - compile a unique list of dependencies
......@@ -52,7 +69,7 @@ MACRO(FINALISE_CPACK_COMPONENT name)
IF (NEKTAR_BUILD_PACKAGES)
CMAKE_PARSE_ARGUMENTS(COMP "" "DESCRIPTION" "" ${ARGN})
# Component names are stored as upper ase in the CPack variable names.
# Component names are stored as upper case in the CPack variable names.
STRING(TOUPPER ${name} COMPVAR)
# Set the component name to `nektar++-<name>`
......@@ -69,6 +86,12 @@ MACRO(FINALISE_CPACK_COMPONENT name)
# Construct list of Debian dependencies
CONSTRUCT_DEBIAN_DEPS(${CPACK_COMPONENT_${COMPVAR}_DEPENDS} "tmp")
SET(CPACK_DEBIAN_${COMPVAR}_PACKAGE_DEPENDS ${tmp} CACHE INTERNAL "")
# Other Debian details
SET(CPACK_DEBIAN_${COMPVAR}_FILE_NAME
"nektar++-${name}-${NEKTAR_VERSION}-${DPKG_ARCHITECTURE}.deb"
CACHE INTERNAL "")
ENDIF()
ENDMACRO()
......@@ -238,6 +261,7 @@ MACRO(ADD_NEKTAR_EXECUTABLE name)
STRING(TOLOWER ${dep} tmp2)
LIST(APPEND tmp ${tmp2})
ENDFOREACH()
LIST(REMOVE_DUPLICATES tmp)
SET(CPACK_COMPONENT_${NEKEXE_COMPVAR}_DEPENDS ${tmp} CACHE INTERNAL "")
ENDMACRO()
......@@ -271,6 +295,9 @@ MACRO(ADD_NEKTAR_LIBRARY name)
STRING(TOLOWER ${name} NEKLIB_COMPONENT)
STRING(TOUPPER ${name} NEKLIB_COMPVAR)
# Add name to a list so that we know for constructing dependencies.
SET(NEKTAR_LIBS ${NEKTAR_LIBS} ${NEKLIB_COMPONENT} CACHE INTERNAL "")
SET_PROPERTY(TARGET ${name} PROPERTY FOLDER ${NEKLIB_COMPONENT})
SET_PROPERTY(TARGET ${name} PROPERTY VERSION ${NEKTAR_VERSION})
......@@ -290,12 +317,19 @@ MACRO(ADD_NEKTAR_LIBRARY name)
ENDFOREACH()
# Add CPack information
SET(CPACK_COMPONENT_${NEKLIB_COMPVAR}_DISPLAY_NAME nektar++-${NEKLIB_COMPONENT}
SET(CPACK_COMPONENT_${NEKLIB_COMPVAR}_DISPLAY_NAME libnektar++-${NEKLIB_COMPONENT}
CACHE INTERNAL "")
SET(CPACK_COMPONENT_${NEKLIB_COMPVAR}_DISPLAY_GROUP lib CACHE INTERNAL "")
SET(CPACK_COMPONENT_${NEKLIB_COMPVAR}_DESCRIPTION ${NEKLIB_DESCRIPTION}
CACHE INTERNAL "")
# Debian specific information
SET(CPACK_DEBIAN_${NEKLIB_COMPVAR}_FILE_NAME
"libnektar++-${NEKLIB_COMPONENT}-${NEKTAR_VERSION}-${DPKG_ARCHITECTURE}.deb"
CACHE INTERNAL "")
SET(CPACK_DEBIAN_${NEKLIB_COMPVAR}_PACKAGE_NAME
"libnektar++-${NEKLIB_COMPONENT}" CACHE INTERNAL "")
# If we have dependencies then link against them, and also configure CPack
# Debian dependencies, which are a special case for some reason. Then set up
# standard CPack components.
......
......@@ -42,8 +42,8 @@ include (CorrectWindowsPaths)
macro (RESOLVE_LIBRARIES LIBS LINK_LINE)
string (REGEX MATCHALL "((-L|-l|-Wl)([^\" ]+|\"[^\"]+\")|[^\" ]+\\.(a|so|dll|lib))" _all_tokens "${LINK_LINE}")
set (_libs_found)
set (_directory_list)
set (_libs_found "")
set (_directory_list "")
foreach (token ${_all_tokens})
if (token MATCHES "-L([^\" ]+|\"[^\"]+\")")
# If it's a library path, add it to the list
......@@ -58,7 +58,7 @@ macro (RESOLVE_LIBRARIES LIBS LINK_LINE)
else (WIN32)
string (REGEX REPLACE "^-l" "" token ${token})
endif (WIN32)
set (_root)
set (_root "")
if (token MATCHES "^/") # We have an absolute path
#separate into a path and a library name:
string (REGEX MATCH "[^/]*\\.(a|so|dll|lib)$" libname ${token})
......
......@@ -30,6 +30,19 @@ configure_file(${CMAKE_SOURCE_DIR}/cmake/NektarCPackConfig.cmake.in
${CMAKE_BINARY_DIR}/NektarCPackConfig.cmake @ONLY)
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_BINARY_DIR}/NektarCPackConfig.cmake)
# Finalise the -dev package
SET(CPACK_COMPONENT_DEV_DISPLAY_NAME libnektar++-dev CACHE INTERNAL "")
SET(CPACK_COMPONENT_DEV_DISPLAY_GROUP lib CACHE INTERNAL "")
SET(CPACK_COMPONENT_DEV_DESCRIPTION "Nektar++ development libraries"
CACHE INTERNAL "")
# Debian specific information
SET(CPACK_DEBIAN_DEV_FILE_NAME
"libnektar++-dev-${NEKTAR_VERSION}-${DPKG_ARCHITECTURE}.deb"
CACHE INTERNAL "")
SET(CPACK_DEBIAN_DEV_PACKAGE_NAME "libnektar++-dev" CACHE INTERNAL "")
# This lovely block of code is designed to patch up our executables ready for OS
# X deployment. The strategy is to create a piece of INSTALL code that will
# patch up each executable and copy any libraries that we depend on, so that
......
......@@ -6,20 +6,22 @@ IF (NEKTAR_USE_VTK)
ADD_UTILITIES_EXECUTABLE(VtkStripsToPolys COMPONENT utilities-extra SOURCES VtkStripsToPolys.cpp)
IF (VTK_MAJOR_VERSION LESS 6)
TARGET_LINK_LIBRARIES(VtkToFld vtkCommon vtkIO vtkGraphics)
TARGET_LINK_LIBRARIES(VtkStripsToPolys vtkCommon vtkIO vtkGraphics)
TARGET_LINK_LIBRARIES(VtkToFld LINK_PUBLIC vtkCommon vtkIO vtkGraphics)
TARGET_LINK_LIBRARIES(VtkStripsToPolys LINK_PUBLIC vtkCommon vtkIO vtkGraphics)
ELSE ()
TARGET_LINK_LIBRARIES(VtkToFld vtkCommonCore vtkIOLegacy
vtkFiltersGeometry)
TARGET_LINK_LIBRARIES(VtkStripsToPolys vtkCommonCore vtkIOLegacy)
TARGET_LINK_LIBRARIES(VtkToFld LINK_PUBLIC vtkCommonCore vtkIOLegacy
vtkFiltersGeometry)
TARGET_LINK_LIBRARIES(VtkStripsToPolys LINK_PUBLIC vtkCommonCore vtkIOLegacy)
ENDIF ()
ADD_UTILITIES_EXECUTABLE(VtkToPng COMPONENT utilities-extra SOURCES VtkToPng.cpp)
IF (VTK_MAJOR_VERSION LESS 6)
TARGET_LINK_LIBRARIES(VtkToPng vtkCommon vtksys vtkViews vtkWidgets
vtkRendering vtkIO)
TARGET_LINK_LIBRARIES(VtkToPng LINK_PUBLIC vtkCommon vtksys vtkViews vtkWidgets
vtkRendering vtkIO)
ELSE ()
TARGET_LINK_LIBRARIES(VtkToPng ${VTK_LIBRARIES})
TARGET_LINK_LIBRARIES(VtkToPng LINK_PUBLIC ${VTK_LIBRARIES})
ENDIF ()
ENDIF (NEKTAR_USE_VTK)
FINALISE_CPACK_COMPONENT(utilities DESCRIPTION "Nektar++ utilities")
FINALISE_CPACK_COMPONENT(utilities-extra DESCRIPTION "Nektar++ extra utilities")
ADD_UTILITIES_EXECUTABLE(FieldConvert
COMPONENT fieldconvert DEPENDS FieldUtils SOURCES FieldConvert.cpp)
FINALISE_CPACK_COMPONENT(fieldconvert DESCRIPTION "Nektar++ FieldConvert utility")
#ADD_NEKTAR_TEST(chan3D_tec) # This test is covered in bfs_tec
#ADD_NEKTAR_TEST(chan3D_vtu) # This does not currently work -- hash metric
......
......@@ -48,15 +48,17 @@ ADD_UTILITIES_EXECUTABLE(NekMesh COMPONENT nekmesh
SOURCES ${NekMeshSources}
DEPENDS NekMeshUtils FieldUtils)
FINALISE_CPACK_COMPONENT(nekmesh DESCRIPTION "Nektar++ NekMesh utility")
IF (NEKTAR_USE_CCM)
TARGET_LINK_LIBRARIES(NekMesh ${CCMIO_LIBRARIES})
ENDIF (NEKTAR_USE_CCM)
IF (NEKTAR_USE_VTK)
IF (VTK_MAJOR_VERSION LESS 6)
TARGET_LINK_LIBRARIES(NekMesh vtkCommon vtkIO vtkGraphics)
TARGET_LINK_LIBRARIES(NekMesh LINK_PUBLIC vtkCommon vtkIO vtkGraphics)
ELSE ()
TARGET_LINK_LIBRARIES(NekMesh vtkCommonCore vtkIOLegacy)
TARGET_LINK_LIBRARIES(NekMesh LINK_PUBLIC vtkCommonCore vtkIOLegacy)
ENDIF ()
ENDIF (NEKTAR_USE_VTK)
......
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