From: Matthias Maier Date: Wed, 30 Nov 2022 16:09:21 +0000 (-0600) Subject: CMake: Remove pkg-config pc file generation X-Git-Tag: v9.5.0-rc1~781^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be9dbba9a997d7229e4b3db03f51c35dbab191aa;p=dealii.git CMake: Remove pkg-config pc file generation Let us remove the pkg-config configuration for the time being. This is necessary as a preparatory switch for changing over to import/interface targets. This has always been rarely used configuration with issues (for example for Debian and Ubuntu we cannot even install these pkg-config files due to distribution-specific QA violations). We can revisit the question how to (properly) create pkg-config files again after the changes to the build system are done. --- diff --git a/cmake/config/CMakeLists.txt b/cmake/config/CMakeLists.txt index c7be0c2ee1..947c9c596a 100644 --- a/cmake/config/CMakeLists.txt +++ b/cmake/config/CMakeLists.txt @@ -231,176 +231,6 @@ foreach(_name ${_deal_ii_features_sorted}) endforeach() endforeach() - -######################################################################## -# # -# pkgconfig files # -# # -######################################################################## - -# -# Set up the pkgconfig configuration files consisting of -# -# deal.II_debug # for the debug variant of the library -# deal.II_release # for the release variant of the library -# -# 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 -# export PKG_CONFIG_PATH=/path/to/BUILD_DIR/lib/pkgconfig:$PKG_CONFIG_PATH -# -# To use the library in the installed location -# export PKG_CONFIG_PATH=/path/to/INSTALL_DIR/lib/pkgconfig:$PKG_CONFIG_PATH -# - -# -# We need to gather some variables for the regex below to work. -# - -set(_library_prefixes "") -if (CMAKE_SHARED_LIBRARY_PREFIX) - list(APPEND _library_prefixes ${CMAKE_SHARED_LIBRARY_PREFIX}) -endif() -if (CMAKE_STATIC_LIBRARY_PREFIX) - list(APPEND _library_prefixes ${CMAKE_STATIC_LIBRARY_PREFIX}) -endif() -string(REPLACE ";" "|" _library_prefixes "${_library_prefixes}") - -set(_library_suffixes "") -if (CMAKE_SHARED_LIBRARY_SUFFIX) - list(APPEND _library_suffixes ${CMAKE_SHARED_LIBRARY_SUFFIX}) -endif() -if (CMAKE_STATIC_LIBRARY_SUFFIX) - list(APPEND _library_suffixes ${CMAKE_STATIC_LIBRARY_SUFFIX}) -endif() -string(REPLACE ";" "|" _library_suffixes "${_library_suffixes}") - -# -# Build up the link line from our list of libraries: -# - -foreach(_build ${DEAL_II_BUILD_TYPES}) - string(TOLOWER ${_build} _build_lowercase) - - set(_name "${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX}") - - set(CONFIG_RPATH_${_build}_PC "\\\${libdir}") - set(CONFIG_LIBRARIES_${_build}_PC "-L\${libdir} -l${_name}") - - foreach(_lib ${DEAL_II_LIBRARIES_${_build}} ${DEAL_II_LIBRARIES}) - - get_filename_component(_name ${_lib} NAME) - get_filename_component(_dir ${_lib} PATH) - - if("${_dir}" STREQUAL "") - # ${_lib} is a simple library name, just add it to the link line: - set(_library_string "-l${_lib}") - - else() - # ${_lib} is a full library path: - - # - # Only append a library directory if it is new ... - # - - list(FIND CONFIG_RPATH_${_build}_PC "${_dir}" _index) - if (${_index} EQUAL -1) - set(_library_string "-L${_dir} ") - list(APPEND CONFIG_RPATH_${_build}_PC ${_dir}) - else() - set(_library_string "") - endif() - - # Recover short name: - if(_library_prefixes) - string(REGEX REPLACE "^(${_library_prefixes})" "" _name "${_name}") - endif() - if(_library_suffixes) - string(REGEX REPLACE "(${_library_suffixes})$" "" _name "${_name}") - endif() - set(_library_string "${_library_string}-l${_name}") - endif() - - set(CONFIG_LIBRARIES_${_build}_PC - "${CONFIG_LIBRARIES_${_build}_PC} ${_library_string}" - ) - endforeach() - - to_string_and_add_prefix(CONFIG_RPATH_${_build}_PC - "-Wl,-rpath," ${CONFIG_RPATH_${_build}_PC} - ) -endforeach() - - -# -# For binary dir (aka build dir): -# - -set(CONFIG_PATH_PC "${CMAKE_BINARY_DIR}") - -to_string_and_add_prefix(CONFIG_INCLUDE_DIRS_PC "-I" - \\\${prefix}/include - ${CMAKE_SOURCE_DIR}/include - ${DEAL_II_BUNDLED_INCLUDE_DIRS} - ${DEAL_II_INCLUDE_DIRS} - ) - -foreach(_build ${DEAL_II_BUILD_TYPES}) - string(TOLOWER ${_build} _build_lowercase) - - set(_config_directory "${CMAKE_BINARY_DIR}/${DEAL_II_PKGCONF_RELDIR}") - - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/config_${_build_lowercase}.pc.in - ${_config_directory}/${DEAL_II_PROJECT_CONFIG_NAME}_${_build_lowercase}.pc - @ONLY - ) -endforeach() - -# -# For installation: -# - -set(CONFIG_PATH_PC "${CMAKE_INSTALL_PREFIX}") - -to_string_and_add_prefix(CONFIG_INCLUDE_DIRS_PC "-I" - \\\${includedir} - ${DEAL_II_BUNDLED_INCLUDE_DIRS} - ${DEAL_II_INCLUDE_DIRS} - ) - -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 - @ONLY - ) - install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}_${_build_lowercase}.pc - DESTINATION ${DEAL_II_PKGCONF_RELDIR} - COMPONENT library - ) -endforeach() - # # Job's done. # diff --git a/cmake/config/config_debug.pc.in b/cmake/config/config_debug.pc.in deleted file mode 100644 index 5ea03885cd..0000000000 --- a/cmake/config/config_debug.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -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://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 deleted file mode 100644 index 726a35d040..0000000000 --- a/cmake/config/config_release.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -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://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@