From bfe62b0224d38a5b214de97e51dd60c9393222f7 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Wed, 20 Sep 2023 18:29:44 +0200 Subject: [PATCH] Remove framework-related functionality from syncqt The files generated by syncqt should land not only in module include directory, but also in framework directory. Before syncqt made two copies of the generated files one in staging directory and the second one in module framework directory. This commit moves all logic related to framework header files to cmake scripts. This is done for both consistency and simlifying the logic. The whole module .syncqt_staging directory is copying to the framework library in cmake. [ChangeLog][Tools][syncqt] '-framework' and '-frameworkIncludeDir' arguments were removed. The related logic is moved to cmake scripts. Task-number: QTBUG-116483 Pick-to: 6.6 6.5 Change-Id: If79c5470d2ab51eb7fc083bce6fb01858bed76ba Reviewed-by: Alexandru Croitor --- cmake/QtFrameworkHelpers.cmake | 31 ++++++++++++++++++++++++------- cmake/QtSyncQtHelpers.cmake | 8 -------- src/tools/syncqt/main.cpp | 34 ++++------------------------------ 3 files changed, 28 insertions(+), 45 deletions(-) diff --git a/cmake/QtFrameworkHelpers.cmake b/cmake/QtFrameworkHelpers.cmake index 513cebf57c..c546dcd5b8 100644 --- a/cmake/QtFrameworkHelpers.cmake +++ b/cmake/QtFrameworkHelpers.cmake @@ -83,24 +83,41 @@ function(qt_copy_framework_headers target) set(output_dir_RHI "${output_dir}/${fw_private_module_header_dir}/rhi") set(output_dir_SSG "${output_dir}/${fw_private_module_header_dir}/ssg") + qt_internal_module_info(module "${target}") - set(out_files) + set(out_files "") + set(in_files "") + set(copy_commands "") foreach(type IN ITEMS PUBLIC PRIVATE QPA RHI SSG) + set(in_files_${type} "") set(fw_output_header_dir "${output_dir_${type}}") foreach(hdr IN LISTS arg_${type}) get_filename_component(in_file_path ${hdr} ABSOLUTE) get_filename_component(in_file_name ${hdr} NAME) set(out_file_path "${fw_output_header_dir}/${in_file_name}") - add_custom_command( - OUTPUT ${out_file_path} - DEPENDS ${in_file_path} - COMMAND ${CMAKE_COMMAND} -E make_directory "${fw_output_header_dir}" - COMMAND ${CMAKE_COMMAND} -E copy "${in_file_path}" "${fw_output_header_dir}" - VERBATIM) list(APPEND out_files ${out_file_path}) + list(APPEND in_files_${type} "${in_file_path}") endforeach() + if(in_files_${type}) + list(APPEND copy_commands + COMMAND ${CMAKE_COMMAND} -E copy ${in_files_${type}} "${fw_output_header_dir}") + list(APPEND in_files ${in_files_${type}}) + endif() endforeach() + list(REMOVE_DUPLICATES out_files) + list(REMOVE_DUPLICATES in_files) + add_custom_command( + OUTPUT "${output_dir}/${fw_versioned_header_dir}" ${out_files} + DEPENDS ${in_files} ${target}_sync_headers + COMMAND + ${CMAKE_COMMAND} -E copy_directory + "${module_build_interface_include_dir}/.syncqt_staging" + "${output_dir}/${fw_versioned_header_dir}" + ${copy_commands} + VERBATIM + COMMENT "Copy the ${target} header files to the framework directory" + ) set_property(TARGET ${target} APPEND PROPERTY QT_COPIED_FRAMEWORK_HEADERS "${out_files}") endfunction() diff --git a/cmake/QtSyncQtHelpers.cmake b/cmake/QtSyncQtHelpers.cmake index ee9a23610e..0188b87c6a 100644 --- a/cmake/QtSyncQtHelpers.cmake +++ b/cmake/QtSyncQtHelpers.cmake @@ -61,13 +61,6 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge set(is_framework FALSE) if(NOT is_interface_lib) get_target_property(is_framework ${target} FRAMEWORK) - if(is_framework) - qt_internal_get_framework_info(fw ${target}) - get_target_property(fw_output_base_dir ${target} LIBRARY_OUTPUT_DIRECTORY) - set(framework_args "-framework" - "-frameworkIncludeDir" "${fw_output_base_dir}/${fw_versioned_header_dir}" - ) - endif() endif() qt_internal_get_qt_all_known_modules(known_modules) @@ -160,7 +153,6 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge -headers ${module_headers} -stagingDir "${syncqt_staging_dir}" -knownModules ${known_modules} - ${framework_args} ${version_script_args} ) list(JOIN syncqt_args "\n" syncqt_args_string) diff --git a/src/tools/syncqt/main.cpp b/src/tools/syncqt/main.cpp index bc5533029b..b989277054 100644 --- a/src/tools/syncqt/main.cpp +++ b/src/tools/syncqt/main.cpp @@ -7,8 +7,7 @@ * - Header file that contains the module version information, and named as Vesion * - LD version script if applicable * - Aliases or copies of the header files sorted by the generic Qt-types: public/private/qpa - * and stored in the corresponding directories. Also copies the aliases to the framework-specific - * directories. + * and stored in the corresponding directories. * Also the tool executes conformity checks on each header file if applicable, to make sure they * follow rules that are relevant for their header type. * The tool can be run in two modes: with either '-all' or '-headers' options specified. Depending @@ -201,8 +200,6 @@ public: const std::string &privateIncludeDir() const { return m_privateIncludeDir; } - const std::string &frameworkIncludeDir() const { return m_frameworkIncludeDir; } - const std::string &qpaIncludeDir() const { return m_qpaIncludeDir; } const std::string &rhiIncludeDir() const { return m_rhiIncludeDir; } @@ -231,8 +228,6 @@ public: bool scanAllMode() const { return m_scanAllMode; } - bool isFramework() const { return m_isFramework; } - bool isInternal() const { return m_isInternal; } bool isNonQtModule() const { return m_isNonQtModule; } @@ -255,7 +250,6 @@ public: " -includeDir -privateIncludeDir -qpaIncludeDir -rhiIncludeDir -ssgIncludeDir " " -stagingDir <-headers
|-all> [-debug]" " [-versionScript ] [-qpaHeadersFilter ] [-rhiHeadersFilter ]" - " [-framework [-frameworkIncludeDir ]]" " [-knownModules ... ]" " [-nonQt] [-internal] [-copy]\n" "" @@ -303,10 +297,6 @@ public: " -versionScript Generate linker version script by\n" " provided path.\n" " -debug Enable debug output.\n" - " -framework Indicates that module is framework.\n" - " -frameworkIncludeDir The directory to store the framework\n" - " header files.\n" - " E.g. QtCore.framework/Versions/A/Headers\n" " -copy Copy header files instead of creating\n" " aliases.\n" " -minimal Do not create CaMeL case headers for the\n" @@ -353,7 +343,6 @@ private: { "-ssgIncludeDir", { &m_ssgIncludeDir } }, { "-stagingDir", { &m_stagingDir, true } }, { "-versionScript", { &m_versionScriptFile, true } }, - { "-frameworkIncludeDir", { &m_frameworkIncludeDir, true } }, { "-publicNamespaceFilter", { &publicNamespaceFilter, true } }, }; @@ -366,7 +355,7 @@ private: static const std::unordered_map> boolArgumentMap = { { "-nonQt", { &m_isNonQtModule, true } }, { "-debug", { &m_debug, true } }, - { "-help", { &m_printHelpOnly, true } }, { "-framework", { &m_isFramework, true } }, + { "-help", { &m_printHelpOnly, true } }, { "-internal", { &m_isInternal, true } }, { "-all", { &m_scanAllMode, true } }, { "-copy", { &m_copy, true } }, { "-minimal", { &m_minimal, true } }, { "-showonly", { &m_showOnly, true } }, { "-showOnly", { &m_showOnly, true } }, @@ -503,10 +492,10 @@ private: // Convert all paths from command line to a generic one. void normilizePaths() { - static std::array paths = { + static std::array paths = { &m_sourceDir, &m_binaryDir, &m_includeDir, &m_privateIncludeDir, &m_qpaIncludeDir, &m_rhiIncludeDir, &m_stagingDir, - &m_versionScriptFile, &m_frameworkIncludeDir + &m_versionScriptFile, }; for (auto path : paths) { if (!path->empty()) @@ -524,13 +513,11 @@ private: std::string m_ssgIncludeDir; std::string m_stagingDir; std::string m_versionScriptFile; - std::string m_frameworkIncludeDir; std::set m_knownModules; std::set m_headers; std::set m_generatedHeaders; bool m_scanAllMode = false; bool m_copy = false; - bool m_isFramework = false; bool m_isNonQtModule = false; bool m_isInternal = false; bool m_printHelpOnly = false; @@ -759,13 +746,6 @@ public: // process eaiser. if (!copyGeneratedHeadersToStagingDirectory(m_commandLineArgs->stagingDir())) error = SyncFailed; - // We also need to have a copy of the generated header files in framework include - // directories when building with '-framework'. - if (m_commandLineArgs->isFramework()) { - if (!copyGeneratedHeadersToStagingDirectory( - m_commandLineArgs->frameworkIncludeDir(), true)) - error = SyncFailed; - } } return error; } @@ -1637,12 +1617,6 @@ public: if (isCrossModuleDeprecation) { const std::string stagingDir = outputDir + "/.syncqt_staging/"; writeIfDifferent(stagingDir + headerName, buffer.str()); - if (m_commandLineArgs->isFramework()) { - const std::string frameworkStagingDir = stagingDir + moduleName - + ".framework/Versions/A/Headers/" QT_VERSION_STR "/" - + moduleName.substr(2) + '/'; - writeIfDifferent(frameworkStagingDir + headerName, buffer.str()); - } } m_producedHeaders.insert(headerName); }