From 40a1e0b5fccd9227967dd0793a57da76ccbe35ac Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 15 Nov 2018 11:13:43 -0600 Subject: [PATCH] address JP's comments --- cmake/config/CMakeLists.txt | 50 ++++++++++++++----------------- cmake/config/config_base.pc.in | 10 ------- cmake/config/config_debug.pc.in | 14 +++++---- cmake/config/config_release.pc.in | 14 +++++---- 4 files changed, 41 insertions(+), 47 deletions(-) delete mode 100644 cmake/config/config_base.pc.in diff --git a/cmake/config/CMakeLists.txt b/cmake/config/CMakeLists.txt index 3f1bc23780..e16d77a111 100644 --- a/cmake/config/CMakeLists.txt +++ b/cmake/config/CMakeLists.txt @@ -231,13 +231,12 @@ ENDFOREACH() # # Set up the pkgconfig configuration files consisting of # -# deal.II_base # common part to all the rest -# deal.II_debug # generated when buildtype is debug -# deal.II_release # generated when buildtype is release +# deal.II_debug # for the debug variant of the library +# deal.II_release # for the release variant of the library # -# We support two configurations out of which deal.II can be used - directly -# from the build directory or after installation. So we have to prepare -# two distinct setups. +# Similarly to the CMake project configuration, we provide pkgconfig files +# directly for the build directory, as well as for the final installation. +# So we have to prepare two distinct setups. # # pkgconfig looks for *.pc files in an environmental variable called # PKG_CONFIG_PATH. So, to use the library in the build directory issue @@ -256,8 +255,8 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES}) SET(_name "${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX}") - SET(CONFIG_RPATH_${_build}_PC "") - SET(CONFIG_LIBRARIES_${_build}_PC "-l${_name}") + SET(CONFIG_RPATH_${_build}_PC "\\\${libdir}") + SET(CONFIG_LIBRARIES_${_build}_PC "-L\${libdir} -l${_name}") FOREACH(_lib ${DEAL_II_LIBRARIES_${_build}} ${DEAL_II_LIBRARIES}) @@ -275,7 +274,7 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES}) # Only append a library directory if it is new ... # - list (FIND CONFIG_RPATH_${_build}_PC "${_dir}" _index) + LIST(FIND CONFIG_RPATH_${_build}_PC "${_dir}" _index) IF (${_index} EQUAL -1) SET(_library_string "-L${_dir} ") LIST(APPEND CONFIG_RPATH_${_build}_PC ${_dir}) @@ -331,12 +330,6 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES}) ) ENDFOREACH() -CONFIGURE_FILE( - ${CMAKE_CURRENT_SOURCE_DIR}/config_base.pc.in - ${_config_directory}/${DEAL_II_PROJECT_CONFIG_NAME}_base.pc - @ONLY - ) - # # For installation: # @@ -352,6 +345,20 @@ TO_STRING_AND_ADD_PREFIX(CONFIG_INCLUDE_DIRS_PC "-I" FOREACH(_build ${DEAL_II_BUILD_TYPES}) STRING(TOLOWER ${_build} _build_lowercase) + # + # Only populate the pkgconf files for the install directory if + # CMAKE_INSTALL_RPATH_USE_LINK_PATH is true. + # + # We use this a heuristic for now to decide whether the user actually + # wants to have RPATHs in configuration files after installation. + # + # FIXME: Unify RPATH handling between cmake and pkgconf configuration and + # clearly document RPATH behavior. + # + IF(NOT CMAKE_INSTALL_RPATH_USE_LINK_PATH) + SET(CONFIG_RPATH_${_build}_PC "") + ENDIF() + CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/config_${_build_lowercase}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}_${_build_lowercase}.pc @@ -364,19 +371,8 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES}) ) ENDFOREACH() -CONFIGURE_FILE( - ${CMAKE_CURRENT_SOURCE_DIR}/config_base.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}_base.pc - @ONLY - ) -INSTALL(FILES - ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}_base.pc - DESTINATION ${DEAL_II_PKGCONF_RELDIR} - COMPONENT library - ) - # -# Jobs done. +# Job's done. # MESSAGE(STATUS "Setting up project configuration - Done") diff --git a/cmake/config/config_base.pc.in b/cmake/config/config_base.pc.in deleted file mode 100644 index aa87b27d83..0000000000 --- a/cmake/config/config_base.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@CONFIG_PATH_PC@ -includedir=${prefix}/@DEAL_II_INCLUDE_RELDIR@ -libdir=${prefix}/@DEAL_II_LIBRARY_RELDIR@ - -Name: deal.II_base -Description: base file used by the debug and release versions -Version: @DEAL_II_VERSION@ -URL: https://github.com/dealii/dealii -Cflags: @DEAL_II_CXX_FLAGS@ @CONFIG_INCLUDE_DIRS_PC@ -Libs: @DEAL_II_LINKER_FLAGS@ -L${libdir} -Wl,-rpath,${libdir} diff --git a/cmake/config/config_debug.pc.in b/cmake/config/config_debug.pc.in index 0cd2b153d5..5ea03885cd 100644 --- a/cmake/config/config_debug.pc.in +++ b/cmake/config/config_debug.pc.in @@ -1,7 +1,11 @@ -Name: deal.II compiled in debug mode +prefix=@CONFIG_PATH_PC@ +includedir=${prefix}/@DEAL_II_INCLUDE_RELDIR@ +libdir=${prefix}/@DEAL_II_LIBRARY_RELDIR@ + +Name: deal.II debug variant Description: A C++ software library supporting the creation of finite element codes and an open community of users and developers. Version: @DEAL_II_VERSION@ -URL: https://github.com/dealii/dealii -Requires: deal.II_base -Cflags: @DEAL_II_CXX_FLAGS_DEBUG@ -Libs: @DEAL_II_LINKER_FLAGS_DEBUG@ @CONFIG_LIBRARIES_DEBUG_PC@ @CONFIG_RPATH_DEBUG_PC@ +URL: https://dealii.org/ + +Cflags: @DEAL_II_CXX_FLAGS@ @DEAL_II_CXX_FLAGS_DEBUG@ @CONFIG_INCLUDE_DIRS_PC@ +Libs: @DEAL_II_LINKER_FLAGS@ @DEAL_II_LINKER_FLAGS_DEBUG@ @CONFIG_LIBRARIES_DEBUG_PC@ @CONFIG_RPATH_DEBUG_PC@ diff --git a/cmake/config/config_release.pc.in b/cmake/config/config_release.pc.in index 208e5e0556..726a35d040 100644 --- a/cmake/config/config_release.pc.in +++ b/cmake/config/config_release.pc.in @@ -1,7 +1,11 @@ -Name: deal.II compiled in debug mode +prefix=@CONFIG_PATH_PC@ +includedir=${prefix}/@DEAL_II_INCLUDE_RELDIR@ +libdir=${prefix}/@DEAL_II_LIBRARY_RELDIR@ + +Name: deal.II release variant Description: A C++ software library supporting the creation of finite element codes and an open community of users and developers. Version: @DEAL_II_VERSION@ -URL: https://github.com/dealii/dealii -Requires: deal.II_base -Cflags: @DEAL_II_CXX_FLAGS_RELEASE@ -Libs: @DEAL_II_LINKER_FLAGS_RELEASE@ @CONFIG_LIBRARIES_RELEASE_PC@ @CONFIG_RPATH_RELEASE_PC@ +URL: https://dealii.org/ + +Cflags: @DEAL_II_CXX_FLAGS@ @DEAL_II_CXX_FLAGS_RELEASE@ @CONFIG_INCLUDE_DIRS_PC@ +Libs: @DEAL_II_LINKER_FLAGS@ @DEAL_II_LINKER_FLAGS_RELEASE@ @CONFIG_LIBRARIES_RELEASE_PC@ @CONFIG_RPATH_RELEASE_PC@ -- 2.39.5