From 05a1b2a6e8a048ae2c893e541e7d09ab46ec62e8 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 20 Nov 2020 11:21:56 +0100 Subject: [PATCH] cmake build: Remove unused component "Dependencies" We don't use it for packaging, nor for github anymore, it duplicates a whole lot of logic, and that only partially (as an example fixing the RPATH for clang tools on macOS is missing), and the Clang part only works with CMake >= 3.14 ("file(READ_SYMLINK"), which was the final trigger of this patch. Change-Id: I21ff6b01297009eff15bda36963e729dea4927c8 Reviewed-by: Cristian Adam --- CMakeLists.txt | 5 - cmake/CMakeLists.txt | 88 ----------- cmake/InstallDependentSharedObjects.cmake.in | 151 ------------------- cmake/QtCreatorAPI.cmake | 55 ------- src/libs/clangsupport/CMakeLists.txt | 23 --- 5 files changed, 322 deletions(-) delete mode 100644 cmake/CMakeLists.txt delete mode 100644 cmake/InstallDependentSharedObjects.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a34f1c9183..4de127c8a66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,11 +107,6 @@ endif() add_subdirectory(doc) -# CMake will include in a cmake_install.cmake at the end the subdirectories -# At this point all the previous install scripts have been included -# Deployment is being done in cmake/CMakeLists.txt -add_subdirectory(cmake) - feature_summary(INCLUDE_QUIET_PACKAGES WHAT PACKAGES_FOUND PACKAGES_NOT_FOUND ENABLED_FEATURES DISABLED_FEATURES diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt deleted file mode 100644 index a005ce71e8c..00000000000 --- a/cmake/CMakeLists.txt +++ /dev/null @@ -1,88 +0,0 @@ -# Deployment of Qt, Clang, C++ Runtime libraries is being done in this script. -# -# It should be included as a subdirectory as last because of CMake's -# cmake_install.cmake script behviour of including subdirectories at the end -# of the script, not respecting the order of install commands from CMakeLists.txt -# -# This way we are sure that all the binaries have been installed before. - -if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16) - get_target_property(moc_binary Qt5::moc IMPORTED_LOCATION) - get_filename_component(moc_dir "${moc_binary}" DIRECTORY) - get_filename_component(QT_BASE_DIR "${moc_dir}/../" ABSOLUTE) - - if (MSVC AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - set(exclusion_mask PATTERN "*d.dll" EXCLUDE) - endif() - - foreach(plugin - assetimporters designer iconengines imageformats platforminputcontexts - platforms platformthemes printsupport qmltooling sqldrivers styles - xcbglintegrations) - if(NOT EXISTS "${QT_BASE_DIR}/plugins/${plugin}") - continue() - endif() - install( - DIRECTORY "${QT_BASE_DIR}/plugins/${plugin}" - DESTINATION ${QT_DEST_PLUGIN_PATH} - COMPONENT Dependencies - EXCLUDE_FROM_ALL - ${exclusion_mask} - ) - list(APPEND QT_PLUGIN_DIRECTORIES "${QT_DEST_PLUGIN_PATH}/${plugin}") - endforeach() - - install( - DIRECTORY "${QT_BASE_DIR}/qml/" - DESTINATION ${QT_DEST_QML_PATH} - COMPONENT Dependencies - EXCLUDE_FROM_ALL - PATTERN "qml/*" - ${exclusion_mask} - ) - - # QtCreator's "System Information..." needs qtdiag - set(qtdiag_destination ${IDE_BIN_PATH}) - if (NOT APPLE AND NOT WIN32) - set(qtdiag_destination ${IDE_LIBRARY_BASE_PATH}/Qt/bin) - endif() - install(PROGRAMS - "${QT_BASE_DIR}/bin/qtdiag${CMAKE_EXECUTABLE_SUFFIX}" - DESTINATION ${qtdiag_destination} - COMPONENT Dependencies - EXCLUDE_FROM_ALL - ) - - # Analyze the binaries and install missing dependencies if they are - # found the CMAKE_PREFIX_PATH e.g. Qt, Clang - configure_file(InstallDependentSharedObjects.cmake.in InstallDependentSharedObjects.cmake @ONLY) - install( - SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/InstallDependentSharedObjects.cmake - COMPONENT Dependencies - EXCLUDE_FROM_ALL - ) - - if (MSVC) - set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP ON) - include(InstallRequiredsystemLibraries) - - # For Qt Creator - install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} - DESTINATION ${IDE_APP_PATH} - COMPONENT Dependencies - EXCLUDE_FROM_ALL - ) - - # For qtcreatorcdbext - set(ArchSuffix 32) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - set(ArchSuffix 64) - endif() - - install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} - DESTINATION lib/qtcreatorcdbext${ArchSuffix} - COMPONENT Dependencies - EXCLUDE_FROM_ALL - ) - endif() -endif() diff --git a/cmake/InstallDependentSharedObjects.cmake.in b/cmake/InstallDependentSharedObjects.cmake.in deleted file mode 100644 index a54e1fa5427..00000000000 --- a/cmake/InstallDependentSharedObjects.cmake.in +++ /dev/null @@ -1,151 +0,0 @@ -if (MINGW AND @CMAKE_CXX_COMPILER_ID@ MATCHES "Clang") - set(CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL objdump) -endif() -if (WIN32) - set(filter_regex PRE_EXCLUDE_REGEXES "api-ms-.*|ext-ms-.*") -elseif (APPLE) - set(filter_regex PRE_EXCLUDE_REGEXES "libiodbc.*|libpq.*") -endif() - -get_filename_component(install_prefix "${CMAKE_INSTALL_PREFIX}" ABSOLUTE) - -# Get the dependencies of Qt's plugins -set(qt_plugin_directories "@QT_PLUGIN_DIRECTORIES@") -foreach(plugin IN LISTS qt_plugin_directories) - file(GLOB plugin_files "${install_prefix}/${plugin}/*@CMAKE_SHARED_LIBRARY_SUFFIX@") - list(APPEND qt_plugin_files "${plugin_files}") -endforeach() - -# Get the qml module dependencies -file(GLOB_RECURSE qml_plugin_files "${install_prefix}/@QT_DEST_QML_PATH@/*/*@CMAKE_SHARED_LIBRARY_SUFFIX@") -list(APPEND qt_plugin_files "${qml_plugin_files}") - -set(installed_EXECUTABLES_NOT_PREFIXED "@__QTC_INSTALLED_EXECUTABLES@") -set(installed_LIBRARIES_NOT_PREFIXED "@__QTC_INSTALLED_LIBRARIES@") -set(installed_MODULES_NOT_PREFIXED "@__QTC_INSTALLED_PLUGINS@") - -foreach(binary_type EXECUTABLES LIBRARIES MODULES) - foreach(element IN LISTS installed_${binary_type}_NOT_PREFIXED) - if (EXISTS "${install_prefix}/${element}") - list(APPEND installed_${binary_type} "${install_prefix}/${element}") - endif() - endforeach() -endforeach() - -# Install first the dependencies, and continue to install the dependencies -# of the installed dependencies e.g. libicu for libQt5Core on Linux. - -list(LENGTH installed_LIBRARIES installed_libraries_size) -unset(qt_plugins_installed) - -while(installed_libraries_size GREATER 0) - foreach(binary_type EXECUTABLES LIBRARIES MODULES) - list(LENGTH installed_${binary_type} list_size) - if (NOT list_size EQUAL 0) - set(${binary_type}_TO_ANALYZE ${binary_type} "${installed_${binary_type}}") - else() - set(${binary_type}_TO_ANALYZE "") - endif() - endforeach() - - file(GET_RUNTIME_DEPENDENCIES - UNRESOLVED_DEPENDENCIES_VAR unresolved_deps - RESOLVED_DEPENDENCIES_VAR resolved_deps - CONFLICTING_DEPENDENCIES_PREFIX conflicts - ${EXECUTABLES_TO_ANALYZE} - ${LIBRARIES_TO_ANALYZE} - ${MODULES_TO_ANALYZE} - DIRECTORIES - "${install_prefix}/@IDE_BIN_PATH@" - "${install_prefix}/@IDE_PLUGIN_PATH@" - "${install_prefix}/@IDE_LIBRARY_PATH@" - "${install_prefix}/@IDE_LIBRARY_BASE_PATH@/Qt/lib" - ${filter_regex} - ) - - # Clear for next step - set(installed_EXECUTABLES "") - set(installed_LIBRARIES "") - set(installed_MODULES "") - - if (NOT qt_plugins_installed) - if (WIN32) - # Needed by QmlDesigner, QmlProfiler, but they are not referenced directly. - list(APPEND unresolved_deps libEGL.dll libGLESv2.dll) - endif() - - set(qt_plugins_installed TRUE) - set(installed_MODULES "${qt_plugin_files}") - endif() - - list(REMOVE_DUPLICATES unresolved_deps) - list(REMOVE_DUPLICATES resolved_deps) - - file(TO_CMAKE_PATH "@CMAKE_PREFIX_PATH@" prefix_path) - - # Add parent link directory paths. Needed for e.g. MinGW choco libstdc++-6.dll - if (WIN32) - foreach(path "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@") - get_filename_component(parent_path "${path}" DIRECTORY) - list(APPEND prefix_path "${parent_path}") - endforeach() - endif() - - # On Linux the Qt libraries might exist in the system, and they are passed - # as resolved, therefore scan the resolved dependencies too - if (NOT WIN32 AND NOT APPLE) - list(APPEND unresolved_deps "${resolved_deps}") - endif() - - foreach(so IN LISTS unresolved_deps) - - # Skip the installed dependencies - string(FIND "${so}" "${install_prefix}" found_prefix_path) - if (NOT found_prefix_path EQUAL -1) - continue() - endif() - - # On Linux get the name of the resolved Qt dependency, this would come from ldconfig - # with the full path on the system - if (NOT APPLE AND NOT WIN32) - get_filename_component(so "${so}" NAME) - endif() - - if (APPLE) - string(REPLACE "@rpath/" "" so "${so}") - get_filename_component(so_dir "${so}" DIRECTORY) - endif() - - message(STATUS "Dependency: ${so}") - foreach(p IN LISTS prefix_path) - if (WIN32) - set(so_src "${p}/bin/${so}") - set(so_dest "${install_prefix}/@IDE_BIN_PATH@") - elseif(APPLE) - set(so_src "${p}/lib/${so}") - set(so_dest "${install_prefix}/@IDE_LIBRARY_PATH@/${so_dir}") - else() - set(so_src "${p}/lib/${so}") - if (p STREQUAL "@QT_BASE_DIR@") - set(so_dest "${install_prefix}/@IDE_LIBRARY_BASE_PATH@/Qt/lib") - else() - set(so_dest "${install_prefix}/@IDE_LIBRARY_PATH@") - endif() - endif() - - message(STATUS "Looking at: ${so_src}") - if (EXISTS "${so_src}") - file(INSTALL "${so_src}" DESTINATION "${so_dest}" FOLLOW_SYMLINK_CHAIN) - if (APPLE) - get_filename_component(so "${so}" NAME) - endif() - list(APPEND installed_LIBRARIES "${so_dest}/${so}") - break() - endif() - - endforeach() - endforeach() - - list(LENGTH installed_LIBRARIES installed_libraries_size) - -endwhile() diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index 3b02eeda2db..6d0ebdd715a 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -724,61 +724,6 @@ function(add_qtc_executable name) update_cached_list(__QTC_INSTALLED_EXECUTABLES "${_DESTINATION}/${name}${CMAKE_EXECUTABLE_SUFFIX}") - - install(CODE " - function(create_qt_conf location base_dir) - get_filename_component(install_prefix \"\${CMAKE_INSTALL_PREFIX}\" ABSOLUTE) - file(RELATIVE_PATH qt_conf_binaries - \"\${install_prefix}/\${location}\" - \"\${install_prefix}/\${base_dir}\" - ) - if (NOT qt_conf_binaries) - set(qt_conf_binaries .) - endif() - file(RELATIVE_PATH qt_conf_plugins - \"\${install_prefix}/\${base_dir}\" - \"\${install_prefix}/${QT_DEST_PLUGIN_PATH}\" - ) - file(RELATIVE_PATH qt_conf_qml - \"\${install_prefix}/\${base_dir}\" - \"\${install_prefix}/${QT_DEST_QML_PATH}\" - ) - file(WRITE \"\${CMAKE_INSTALL_PREFIX}/\${location}/qt.conf\" - \"[Paths]\n\" - \"Plugins=\${qt_conf_plugins}\n\" - \"Qml2Imports=\${qt_conf_qml}\n\" - ) - # For Apple for Qt Creator do not add a Prefix - if (NOT APPLE OR NOT qt_conf_binaries STREQUAL \"../\") - file(APPEND \"\${CMAKE_INSTALL_PREFIX}/\${location}/qt.conf\" - \"Prefix=\${qt_conf_binaries}\n\" - ) - endif() - if (WIN32 OR APPLE) - file(RELATIVE_PATH qt_binaries - \"\${install_prefix}/\${base_dir}\" - \"\${install_prefix}/${IDE_BIN_PATH}\" - ) - if (NOT qt_binaries) - set(qt_binaries .) - endif() - file(APPEND \"\${CMAKE_INSTALL_PREFIX}/\${location}/qt.conf\" - \"# Needed by QtCreator for qtdiag\n\" - \"Binaries=\${qt_binaries}\n\") - endif() - endfunction() - if(APPLE) - create_qt_conf(\"${_EXECUTABLE_PATH}\" \"${IDE_DATA_PATH}/..\") - elseif (WIN32) - create_qt_conf(\"${_EXECUTABLE_PATH}\" \"${IDE_APP_PATH}\") - else() - create_qt_conf(\"${_EXECUTABLE_PATH}\" \"${IDE_LIBRARY_BASE_PATH}/Qt\") - endif() - " - COMPONENT Dependencies - EXCLUDE_FROM_ALL - ) - endif() endfunction() diff --git a/src/libs/clangsupport/CMakeLists.txt b/src/libs/clangsupport/CMakeLists.txt index 7117066ac17..dcaa4647101 100644 --- a/src/libs/clangsupport/CMakeLists.txt +++ b/src/libs/clangsupport/CMakeLists.txt @@ -159,28 +159,5 @@ foreach(executable clang clang-cl clangd clang-tidy clazy-standalone) FILES "${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION "${IDE_LIBEXEC_PATH}/clang/bin/" ) - # For the install directory - install(PROGRAMS - "${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}" - DESTINATION "${IDE_LIBEXEC_PATH}/clang/bin" - COMPONENT Dependencies - EXCLUDE_FROM_ALL - ) - if (IS_SYMLINK "${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}") - file(READ_SYMLINK - "${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}" real_executable) - install(PROGRAMS - "${LLVM_TOOLS_BINARY_DIR}/${real_executable}${CMAKE_EXECUTABLE_SUFFIX}" - DESTINATION "${IDE_LIBEXEC_PATH}/clang/bin" - COMPONENT Dependencies - EXCLUDE_FROM_ALL - ) - endif() endif() endforeach() - -install(DIRECTORY ${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}/include - DESTINATION "${IDE_LIBEXEC_PATH}/clang/lib/clang/${CLANG_VERSION}" - COMPONENT Dependencies - EXCLUDE_FROM_ALL -)