2022-07-05 11:26:52 +00:00
|
|
|
# Copyright (C) 2022 The Qt Company Ltd.
|
2022-08-19 13:21:34 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
2022-07-05 11:26:52 +00:00
|
|
|
|
2020-08-13 15:37:47 +00:00
|
|
|
macro(qt_find_apple_system_frameworks)
|
|
|
|
if(APPLE)
|
2020-09-07 14:44:45 +00:00
|
|
|
qt_internal_find_apple_system_framework(FWAppKit AppKit)
|
2023-01-18 11:51:23 +00:00
|
|
|
qt_internal_find_apple_system_framework(FWCFNetwork CFNetwork)
|
2020-09-07 14:44:45 +00:00
|
|
|
qt_internal_find_apple_system_framework(FWAssetsLibrary AssetsLibrary)
|
2023-03-24 09:53:11 +00:00
|
|
|
qt_internal_find_apple_system_framework(FWPhotos Photos)
|
2020-09-07 14:44:45 +00:00
|
|
|
qt_internal_find_apple_system_framework(FWAudioToolbox AudioToolbox)
|
|
|
|
qt_internal_find_apple_system_framework(FWApplicationServices ApplicationServices)
|
|
|
|
qt_internal_find_apple_system_framework(FWCarbon Carbon)
|
|
|
|
qt_internal_find_apple_system_framework(FWCoreFoundation CoreFoundation)
|
|
|
|
qt_internal_find_apple_system_framework(FWCoreServices CoreServices)
|
|
|
|
qt_internal_find_apple_system_framework(FWCoreGraphics CoreGraphics)
|
|
|
|
qt_internal_find_apple_system_framework(FWCoreText CoreText)
|
|
|
|
qt_internal_find_apple_system_framework(FWCoreVideo CoreVideo)
|
2021-12-20 22:58:17 +00:00
|
|
|
qt_internal_find_apple_system_framework(FWCryptoTokenKit CryptoTokenKit)
|
2020-09-07 14:44:45 +00:00
|
|
|
qt_internal_find_apple_system_framework(FWDiskArbitration DiskArbitration)
|
|
|
|
qt_internal_find_apple_system_framework(FWFoundation Foundation)
|
|
|
|
qt_internal_find_apple_system_framework(FWIOBluetooth IOBluetooth)
|
|
|
|
qt_internal_find_apple_system_framework(FWIOKit IOKit)
|
|
|
|
qt_internal_find_apple_system_framework(FWIOSurface IOSurface)
|
|
|
|
qt_internal_find_apple_system_framework(FWImageIO ImageIO)
|
|
|
|
qt_internal_find_apple_system_framework(FWMetal Metal)
|
|
|
|
qt_internal_find_apple_system_framework(FWMobileCoreServices MobileCoreServices)
|
|
|
|
qt_internal_find_apple_system_framework(FWQuartzCore QuartzCore)
|
|
|
|
qt_internal_find_apple_system_framework(FWSecurity Security)
|
|
|
|
qt_internal_find_apple_system_framework(FWSystemConfiguration SystemConfiguration)
|
|
|
|
qt_internal_find_apple_system_framework(FWUIKit UIKit)
|
2021-01-15 11:59:14 +00:00
|
|
|
qt_internal_find_apple_system_framework(FWCoreLocation CoreLocation)
|
2021-04-14 08:04:12 +00:00
|
|
|
qt_internal_find_apple_system_framework(FWCoreMotion CoreMotion)
|
2020-09-07 14:44:45 +00:00
|
|
|
qt_internal_find_apple_system_framework(FWWatchKit WatchKit)
|
|
|
|
qt_internal_find_apple_system_framework(FWGameController GameController)
|
2021-11-09 11:24:35 +00:00
|
|
|
qt_internal_find_apple_system_framework(FWCoreBluetooth CoreBluetooth)
|
2022-05-10 13:02:43 +00:00
|
|
|
qt_internal_find_apple_system_framework(FWAVFoundation AVFoundation)
|
|
|
|
qt_internal_find_apple_system_framework(FWContacts Contacts)
|
|
|
|
qt_internal_find_apple_system_framework(FWEventKit EventKit)
|
|
|
|
qt_internal_find_apple_system_framework(FWHealthKit HealthKit)
|
2020-08-13 15:37:47 +00:00
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2020-09-07 14:44:45 +00:00
|
|
|
# Given framework_name == 'IOKit', sets non-cache variable 'FWIOKit' to '-framework IOKit' in
|
|
|
|
# the calling directory scope if the framework is found, or 'IOKit-NOTFOUND'.
|
|
|
|
function(qt_internal_find_apple_system_framework out_var framework_name)
|
|
|
|
# To avoid creating many FindFoo.cmake files for each apple system framework, populate each
|
|
|
|
# FWFoo variable with '-framework Foo' instead of an absolute path to the framework. This makes
|
|
|
|
# the generated CMake target files relocatable, so that Xcode SDK absolute paths are not
|
|
|
|
# hardcoded, like with Xcode11.app on the CI.
|
|
|
|
# We might revisit this later.
|
|
|
|
set(cache_var_name "${out_var}Internal")
|
|
|
|
|
|
|
|
find_library(${cache_var_name} "${framework_name}")
|
|
|
|
|
|
|
|
if(${cache_var_name} AND ${cache_var_name} MATCHES ".framework$")
|
|
|
|
set(${out_var} "-framework ${framework_name}" PARENT_SCOPE)
|
|
|
|
else()
|
|
|
|
set(${out_var} "${out_var}-NOTFOUND" PARENT_SCOPE)
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
2022-12-16 15:34:31 +00:00
|
|
|
# Copy header files to the framework's Headers directory
|
2020-08-13 15:37:47 +00:00
|
|
|
# Use this function for header files that
|
|
|
|
# - are not added as source files to the target
|
|
|
|
# - are not marked as PUBLIC_HEADER
|
|
|
|
# - or are private and supposed to end up in the 6.7.8/QtXYZ/private subdir.
|
|
|
|
function(qt_copy_framework_headers target)
|
|
|
|
get_target_property(is_fw ${target} FRAMEWORK)
|
|
|
|
if(NOT "${is_fw}")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2022-05-20 14:12:56 +00:00
|
|
|
set(options)
|
2020-08-13 15:37:47 +00:00
|
|
|
set(oneValueArgs)
|
rhi: Make it a QPA-style private but semi-public API
qrhi.h, qshader.h, qshaderdescription.h (and qshaderbaker.h from
shadertools; done separately) become "RHI APIs", following the concept
of QPA APIs.
Mirror completely what is done for QPA headers, but using the "rhi"
prefix for the headers. This involves updating syncqt to handle the
new category of headers. (a note on the regex: matching everything
starting with "qrhi" is not acceptable due to incorrectly matching
existing and future headers, hence specifying the four header names
explicitly)
There is going to be one difference to QPA: the documentation for
everything RHI is going to be public and part of the regular docs, not
hidden with \internal.
In addition to the header renaming and adding the comments and
documentation notes and warnings, there is one significant change
here: there is no longer a need to do API-specific includes, such as
qrhid3d11[_p].h, qrhivulkan[_p].h, etc. These are simply merged into a
single header that is then included from qrhi.h. This means that users
within Qt, and any future applications can just do #include
<rhi/qrhi.h> (or rhi/qshader.h if the QRhi stuff is not relevant), no
other headers are needed.
There are no changes to functionality in this patch. Only the
documentation is expanded, quite a lot, to eliminate all qdoc warnings
and make the generated API docs complete. An example, with a quite
extensive doc page is added as well.
Task-number: QTBUG-113331
Change-Id: I91c749826348f14320cb335b1c83e9d1ea2b1d8b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-27 11:16:29 +00:00
|
|
|
set(multiValueArgs PUBLIC PRIVATE QPA RHI)
|
2022-05-20 14:12:56 +00:00
|
|
|
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
2020-08-13 15:37:47 +00:00
|
|
|
|
2021-05-26 18:48:58 +00:00
|
|
|
qt_internal_get_framework_info(fw ${target})
|
|
|
|
get_target_property(output_dir ${target} LIBRARY_OUTPUT_DIRECTORY)
|
2022-05-20 14:12:56 +00:00
|
|
|
set(output_dir_PUBLIC "${output_dir}/${fw_versioned_header_dir}")
|
|
|
|
set(output_dir_PRIVATE "${output_dir}/${fw_private_module_header_dir}/private")
|
|
|
|
set(output_dir_QPA "${output_dir}/${fw_private_module_header_dir}/qpa")
|
rhi: Make it a QPA-style private but semi-public API
qrhi.h, qshader.h, qshaderdescription.h (and qshaderbaker.h from
shadertools; done separately) become "RHI APIs", following the concept
of QPA APIs.
Mirror completely what is done for QPA headers, but using the "rhi"
prefix for the headers. This involves updating syncqt to handle the
new category of headers. (a note on the regex: matching everything
starting with "qrhi" is not acceptable due to incorrectly matching
existing and future headers, hence specifying the four header names
explicitly)
There is going to be one difference to QPA: the documentation for
everything RHI is going to be public and part of the regular docs, not
hidden with \internal.
In addition to the header renaming and adding the comments and
documentation notes and warnings, there is one significant change
here: there is no longer a need to do API-specific includes, such as
qrhid3d11[_p].h, qrhivulkan[_p].h, etc. These are simply merged into a
single header that is then included from qrhi.h. This means that users
within Qt, and any future applications can just do #include
<rhi/qrhi.h> (or rhi/qshader.h if the QRhi stuff is not relevant), no
other headers are needed.
There are no changes to functionality in this patch. Only the
documentation is expanded, quite a lot, to eliminate all qdoc warnings
and make the generated API docs complete. An example, with a quite
extensive doc page is added as well.
Task-number: QTBUG-113331
Change-Id: I91c749826348f14320cb335b1c83e9d1ea2b1d8b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-27 11:16:29 +00:00
|
|
|
set(output_dir_RHI "${output_dir}/${fw_private_module_header_dir}/rhi")
|
2022-05-20 14:12:56 +00:00
|
|
|
|
2021-05-26 18:48:58 +00:00
|
|
|
|
2020-08-13 15:37:47 +00:00
|
|
|
set(out_files)
|
rhi: Make it a QPA-style private but semi-public API
qrhi.h, qshader.h, qshaderdescription.h (and qshaderbaker.h from
shadertools; done separately) become "RHI APIs", following the concept
of QPA APIs.
Mirror completely what is done for QPA headers, but using the "rhi"
prefix for the headers. This involves updating syncqt to handle the
new category of headers. (a note on the regex: matching everything
starting with "qrhi" is not acceptable due to incorrectly matching
existing and future headers, hence specifying the four header names
explicitly)
There is going to be one difference to QPA: the documentation for
everything RHI is going to be public and part of the regular docs, not
hidden with \internal.
In addition to the header renaming and adding the comments and
documentation notes and warnings, there is one significant change
here: there is no longer a need to do API-specific includes, such as
qrhid3d11[_p].h, qrhivulkan[_p].h, etc. These are simply merged into a
single header that is then included from qrhi.h. This means that users
within Qt, and any future applications can just do #include
<rhi/qrhi.h> (or rhi/qshader.h if the QRhi stuff is not relevant), no
other headers are needed.
There are no changes to functionality in this patch. Only the
documentation is expanded, quite a lot, to eliminate all qdoc warnings
and make the generated API docs complete. An example, with a quite
extensive doc page is added as well.
Task-number: QTBUG-113331
Change-Id: I91c749826348f14320cb335b1c83e9d1ea2b1d8b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-27 11:16:29 +00:00
|
|
|
foreach(type IN ITEMS PUBLIC PRIVATE QPA RHI)
|
2022-05-20 14:12:56 +00:00
|
|
|
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})
|
|
|
|
endforeach()
|
2020-08-13 15:37:47 +00:00
|
|
|
endforeach()
|
|
|
|
|
2022-05-20 14:12:56 +00:00
|
|
|
set_property(TARGET ${target} APPEND PROPERTY
|
|
|
|
QT_COPIED_FRAMEWORK_HEADERS "${out_files}")
|
2020-08-13 15:37:47 +00:00
|
|
|
endfunction()
|
|
|
|
|
2022-08-15 16:29:41 +00:00
|
|
|
function(qt_internal_generate_fake_framework_header target)
|
|
|
|
# Hack to create the "Headers" symlink in the framework:
|
|
|
|
# Create a fake header file and copy it into the framework by marking it as PUBLIC_HEADER.
|
|
|
|
# CMake now takes care of creating the symlink.
|
|
|
|
set(fake_header "${CMAKE_CURRENT_BINARY_DIR}/${target}_fake_header.h")
|
|
|
|
qt_internal_get_main_cmake_configuration(main_config)
|
|
|
|
file(GENERATE OUTPUT "${fake_header}" CONTENT "// ignore this file\n"
|
|
|
|
CONDITION "$<CONFIG:${main_config}>")
|
|
|
|
target_sources(${target} PRIVATE "${fake_header}")
|
|
|
|
set_source_files_properties("${fake_header}" PROPERTIES GENERATED ON)
|
|
|
|
set_property(TARGET ${target} APPEND PROPERTY PUBLIC_HEADER "${fake_header}")
|
|
|
|
endfunction()
|
|
|
|
|
2020-08-13 15:37:47 +00:00
|
|
|
function(qt_finalize_framework_headers_copy target)
|
|
|
|
get_target_property(target_type ${target} TYPE)
|
|
|
|
if(${target_type} STREQUAL "INTERFACE_LIBRARY")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
get_target_property(is_fw ${target} FRAMEWORK)
|
|
|
|
if(NOT "${is_fw}")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
get_target_property(headers ${target} QT_COPIED_FRAMEWORK_HEADERS)
|
|
|
|
if(headers)
|
2022-08-15 16:29:41 +00:00
|
|
|
qt_internal_generate_fake_framework_header(${target})
|
2020-08-13 15:37:47 +00:00
|
|
|
|
|
|
|
# Add a target, e.g. Core_framework_headers, that triggers the header copy.
|
|
|
|
add_custom_target(${target}_framework_headers DEPENDS ${headers})
|
|
|
|
add_dependencies(${target} ${target}_framework_headers)
|
|
|
|
endif()
|
|
|
|
endfunction()
|
2021-05-26 18:48:58 +00:00
|
|
|
|
|
|
|
# Collects the framework related information and paths from the target properties.
|
|
|
|
# Output variables:
|
|
|
|
# <out_var>_name framework base name, e.g. 'QtCore'.
|
|
|
|
# <out_var>_dir framework base directory, e.g. 'QtCore.framework'.
|
|
|
|
# <out_var>_version framework version, e.g. 'A', 'B' etc.
|
|
|
|
# <out_var>_bundle_version framework bundle version, same as the PROJECT_VERSION, e.g. '6.0.0'.
|
|
|
|
# <out_var>_header_dir top-level header directory, e.g. 'QtCore.framework/Headers'.
|
|
|
|
# <out_var>_versioned_header_dir header directory for specific framework version,
|
|
|
|
# e.g. 'QtCore.framework/Versions/A/Headers'
|
|
|
|
# <out_var>_private_header_dir header directory for the specific framework version and
|
|
|
|
# framework bundle version e.g. 'QtCore.framework/Versions/A/Headers/6.0.0'
|
2021-06-01 09:25:41 +00:00
|
|
|
# <out_var>_private_module_header_dir private header directory for the specific framework
|
|
|
|
# version, framework bundle version and tailing module name, e.g.
|
|
|
|
# 'QtCore.framework/Versions/A/Headers/6.0.0/Core'
|
2021-05-26 18:48:58 +00:00
|
|
|
function(qt_internal_get_framework_info out_var target)
|
|
|
|
get_target_property(${out_var}_version ${target} FRAMEWORK_VERSION)
|
|
|
|
get_target_property(${out_var}_bundle_version ${target} MACOSX_FRAMEWORK_BUNDLE_VERSION)
|
|
|
|
|
2021-06-01 09:25:41 +00:00
|
|
|
# The module name might be different of the actual target name
|
|
|
|
# and we want to use the Qt'fied module name as a framework identifier.
|
|
|
|
get_target_property(module_interface_name ${target} _qt_module_interface_name)
|
|
|
|
if(module_interface_name)
|
|
|
|
qt_internal_qtfy_target(module ${module_interface_name})
|
|
|
|
else()
|
|
|
|
qt_internal_qtfy_target(module ${target})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(${out_var}_name "${module}")
|
2021-05-26 18:48:58 +00:00
|
|
|
set(${out_var}_dir "${${out_var}_name}.framework")
|
|
|
|
set(${out_var}_header_dir "${${out_var}_dir}/Headers")
|
2022-12-16 15:34:31 +00:00
|
|
|
if(UIKIT)
|
|
|
|
# iOS frameworks do not version their headers
|
|
|
|
set(${out_var}_versioned_header_dir "${${out_var}_header_dir}")
|
|
|
|
else()
|
|
|
|
set(${out_var}_versioned_header_dir "${${out_var}_dir}/Versions/${${out_var}_version}/Headers")
|
|
|
|
endif()
|
2022-12-16 15:11:05 +00:00
|
|
|
set(${out_var}_private_header_dir "${${out_var}_versioned_header_dir}/${${out_var}_bundle_version}")
|
2021-06-01 09:25:41 +00:00
|
|
|
set(${out_var}_private_module_header_dir "${${out_var}_private_header_dir}/${module}")
|
2021-05-26 18:48:58 +00:00
|
|
|
|
|
|
|
set(${out_var}_name "${${out_var}_name}" PARENT_SCOPE)
|
|
|
|
set(${out_var}_dir "${${out_var}_dir}" PARENT_SCOPE)
|
|
|
|
set(${out_var}_header_dir "${${out_var}_header_dir}" PARENT_SCOPE)
|
|
|
|
set(${out_var}_version "${${out_var}_version}" PARENT_SCOPE)
|
|
|
|
set(${out_var}_bundle_version "${${out_var}_bundle_version}" PARENT_SCOPE)
|
|
|
|
set(${out_var}_versioned_header_dir "${${out_var}_versioned_header_dir}" PARENT_SCOPE)
|
|
|
|
set(${out_var}_private_header_dir "${${out_var}_private_header_dir}" PARENT_SCOPE)
|
2021-06-01 09:25:41 +00:00
|
|
|
set(${out_var}_private_module_header_dir "${${out_var}_private_module_header_dir}" PARENT_SCOPE)
|
2021-05-26 18:48:58 +00:00
|
|
|
endfunction()
|