CMake: Rename some public API functions

Some of them have a different (hopefully better) name now.
Some are marked as Technical Preview.
Some are renamed to be internal.

Marking add_qt_gui_executable as TP with the intention to un-TP it
after we rename it and change its behavior as discussed in the API
review meeting.

Additional changes to add_qt_gui_executable and qt6_add_resources have
been filed as separate tasks that will be worked on separately.

See comments on PS1 for details.

Task-number: QTBUG-86827
Change-Id: I56a84a1943b0902bb807310dc620eb381824e8dd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-10-14 13:20:55 +02:00
parent d72ff6ffd0
commit 1f9ec097b2
6 changed files with 35 additions and 42 deletions

View File

@ -93,7 +93,7 @@ function(qt_internal_finalize_app target)
qt_internal_update_app_target_info_properties("${target}")
if(WIN32)
qt6_generate_win32_rc_file("${target}")
_qt_internal_generate_win32_rc_file("${target}")
endif()
# Rpaths need to be applied in the finalizer, because the MACOSX_BUNDLE property might be

View File

@ -68,7 +68,7 @@ function(qt_internal_add_executable name)
endif()
if (WIN32 AND NOT arg_DELAY_RC)
qt6_generate_win32_rc_file(${name})
_qt_internal_generate_win32_rc_file(${name})
endif()
qt_set_common_target_properties(${name})

View File

@ -146,7 +146,7 @@ function(qt_internal_add_module target)
qt_internal_apply_win_prefix_and_suffix("${target}")
if (WIN32 AND BUILD_SHARED_LIBS)
qt6_generate_win32_rc_file(${target})
_qt_internal_generate_win32_rc_file(${target})
endif()
endif()
@ -476,7 +476,7 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})")
else()
set(args INSTALL_DIR "${metatypes_install_dir}")
endif()
qt6_generate_meta_types_json_file(${target} ${args})
qt6_extract_metatypes(${target} ${args})
endif()
configure_package_config_file(
"${QT_CMAKE_DIR}/QtModuleConfig.cmake.in"

View File

@ -315,7 +315,7 @@ if (NOT QT_WILL_INSTALL)
set(core_qobject_metatypes_json_args INSTALL_DIR "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/metatypes")
endif()
qt6_generate_meta_types_json_file(Core_qobject
qt6_extract_metatypes(Core_qobject
MANUAL_MOC_JSON_FILES ${core_qobject_metatypes_json_list}
${core_qobject_metatypes_json_args}
)

View File

@ -1,7 +1,7 @@
# Generate deployment tool json
# Locate newest Android sdk build tools revision
function(qt6_android_get_sdk_build_tools_revision out_var)
function(_qt_internal_android_get_sdk_build_tools_revision out_var)
if (NOT QT_ANDROID_SDK_BUILD_TOOLS_REVISION)
file(GLOB android_build_tools
LIST_DIRECTORIES true
@ -17,12 +17,6 @@ function(qt6_android_get_sdk_build_tools_revision out_var)
set(${out_var} "${android_build_tools_latest}" PARENT_SCOPE)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
function(qt_android_get_sdk_build_tools_revision)
qt6_android_get_sdk_build_tools_revision(${ARGV})
endfunction()
endif()
# Generate the deployment settings json file for a cmake target.
function(qt6_android_generate_deployment_settings target)
# Information extracted from mkspecs/features/android/android_deployment_settings.prf
@ -84,7 +78,7 @@ Please recheck your build configuration.")
" \"sdk\": \"${android_sdk_root_native}\",\n")
# Android SDK Build Tools Revision
qt6_android_get_sdk_build_tools_revision(QT_ANDROID_SDK_BUILD_TOOLS_REVISION)
_qt_internal_android_get_sdk_build_tools_revision(QT_ANDROID_SDK_BUILD_TOOLS_REVISION)
string(APPEND file_contents
" \"sdkBuildToolsRevision\": \"${QT_ANDROID_SDK_BUILD_TOOLS_REVISION}\",\n")

View File

@ -39,7 +39,7 @@
include(CMakeParseArguments)
# macro used to create the names of output files preserving relative dirs
macro(qt6_make_output_file infile prefix ext outfile )
macro(_qt_internal_make_output_file infile prefix ext outfile )
string(LENGTH ${CMAKE_CURRENT_BINARY_DIR} _binlength)
string(LENGTH ${infile} _infileLength)
set(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR})
@ -71,8 +71,7 @@ macro(qt6_make_output_file infile prefix ext outfile )
set(${outfile} ${outpath}/${prefix}${_outfile}.${ext})
endmacro()
macro(qt6_get_moc_flags _moc_flags)
macro(_qt_internal_get_moc_flags _moc_flags)
set(${_moc_flags})
get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES)
@ -102,9 +101,8 @@ macro(qt6_get_moc_flags _moc_flags)
endif()
endmacro()
# helper macro to set up a moc rule
function(qt6_create_moc_command infile outfile moc_flags moc_options moc_target moc_depends)
function(_qt_internal_create_moc_command infile outfile moc_flags moc_options moc_target moc_depends)
# Pass the parameters in a file. Set the working directory to
# be that containing the parameters file and reference it by
# just the file name. This is necessary because the moc tool on
@ -149,10 +147,9 @@ function(qt6_create_moc_command infile outfile moc_flags moc_options moc_target
set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOUIC ON)
endfunction()
function(qt6_generate_moc infile outfile )
# get include dirs and flags
qt6_get_moc_flags(moc_flags)
_qt_internal_get_moc_flags(moc_flags)
get_filename_component(abs_infile ${infile} ABSOLUTE)
set(_outfile "${outfile}")
if(NOT IS_ABSOLUTE "${outfile}")
@ -161,7 +158,7 @@ function(qt6_generate_moc infile outfile )
if ("x${ARGV2}" STREQUAL "xTARGET")
set(moc_target ${ARGV3})
endif()
qt6_create_moc_command(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}" "")
_qt_internal_create_moc_command(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}" "")
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
@ -179,7 +176,7 @@ endif()
function(qt6_wrap_cpp outfiles )
# get include dirs
qt6_get_moc_flags(moc_flags)
_qt_internal_get_moc_flags(moc_flags)
set(options)
set(oneValueArgs TARGET)
@ -194,8 +191,9 @@ function(qt6_wrap_cpp outfiles )
foreach(it ${moc_files})
get_filename_component(it ${it} ABSOLUTE)
qt6_make_output_file(${it} moc_ cpp outfile)
qt6_create_moc_command(${it} ${outfile} "${moc_flags}" "${moc_options}" "${moc_target}" "${moc_depends}")
_qt_internal_make_output_file(${it} moc_ cpp outfile)
_qt_internal_create_moc_command(
${it} ${outfile} "${moc_flags}" "${moc_options}" "${moc_target}" "${moc_depends}")
list(APPEND ${outfiles} ${outfile})
endforeach()
set(${outfiles} ${${outfiles}} PARENT_SCOPE)
@ -235,7 +233,7 @@ function(_qt6_parse_qrc_file infile _out_depends _rc_depends)
# Since this cmake macro is doing the dependency scanning for these files,
# let's make a configured file and add it as a dependency so cmake is run
# again when dependencies need to be recomputed.
qt6_make_output_file("${infile}" "" "qrc.depends" out_depends)
_qt_internal_make_output_file("${infile}" "" "qrc.depends" out_depends)
configure_file("${infile}" "${out_depends}" COPYONLY)
else()
# The .qrc file does not exist (yet). Let's add a dependency and hope
@ -424,6 +422,10 @@ endif()
set(_Qt6_COMPONENT_PATH "${CMAKE_CURRENT_LIST_DIR}/..")
# This function is currently in Technical Preview.
# It's signature and behavior might change.
#
# Wrapper function that adds an executable with some Qt specific behavior.
function(add_qt_gui_executable target)
if(ANDROID)
add_library("${target}" MODULE ${ARGN})
@ -445,7 +447,7 @@ function(add_qt_gui_executable target)
endif()
if (WIN32)
qt6_generate_win32_rc_file(${target})
_qt_internal_generate_win32_rc_file(${target})
endif()
if(ANDROID)
@ -563,9 +565,10 @@ if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
endif()
# Generate Qt metatypes.json for a target. By default we check whether AUTOMOC
# has been enabled and we extract the information from that target. Should you
# not wish to use automoc you need to pass in all the generated json files via the
# Extracts metatypes from a Qt target and generates a metatypes.json for it.
# By default we check whether AUTOMOC has been enabled and we extract the information from the
# target's AUTOMOC supporting files.
# Should you not wish to use automoc you need to pass in all the generated json files via the
# MANUAL_MOC_JSON_FILES parameter. The latter can be obtained by running moc with
# the --output-json parameter.
# Params:
@ -574,7 +577,7 @@ endif()
# Executable metatypes files are never installed.
# COPY_OVER_INSTALL: (Qt Internal) When present will install the file via a post build step
# copy rather than using install.
function(qt6_generate_meta_types_json_file target)
function(qt6_extract_metatypes target)
get_target_property(existing_meta_types_file ${target} INTERFACE_QT_META_TYPES_BUILD_FILE)
if (existing_meta_types_file)
@ -820,8 +823,8 @@ function(qt6_generate_meta_types_json_file target)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
function(qt_generate_meta_types_json_file)
qt6_generate_meta_types_json_file(${ARGV})
function(qt_extract_metatypes)
qt6_extract_metatypes(${ARGV})
endfunction()
endif()
@ -842,7 +845,7 @@ endif()
# If you do not wish to auto-generate rc files, it's possible to provide your
# own RC file by setting the property QT_TARGET_WINDOWS_RC_FILE with a path to
# an existing rc file.
function(qt6_generate_win32_rc_file target)
function(_qt_internal_generate_win32_rc_file target)
set(prohibited_target_types INTERFACE_LIBRARY STATIC_LIBRARY OBJECT_LIBRARY)
get_target_property(target_type ${target} TYPE)
if(target_type IN_LIST prohibited_target_types)
@ -1031,12 +1034,6 @@ END
endif()
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
function(qt_generate_win32_rc_file)
qt6_generate_win32_rc_file(${ARGV})
endfunction()
endif()
function(__qt_get_relative_resource_path_for_file output_alias file)
get_property(alias SOURCE ${file} PROPERTY QT_RESOURCE_ALIAS)
if (NOT alias)
@ -1222,6 +1219,8 @@ function(_qt_internal_process_resource target resourceName)
endif()
endfunction()
# This function is currently in Technical Preview.
# It's signature and behavior might change.
function(qt6_add_plugin target)
cmake_parse_arguments(arg
"STATIC"
@ -1287,13 +1286,13 @@ endif()
# By default Qt6 forces usage of utf8 sources for consumers of Qt.
# Users can opt out of utf8 sources by calling this function with the target name of their
# application or library.
function(qt6_disable_utf8_sources target)
function(qt6_allow_non_utf8_sources target)
set_target_properties("${target}" PROPERTIES QT_NO_UTF8_SOURCE TRUE)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
function(qt_disable_utf8_sources)
qt6_disable_utf8_sources(${ARGV})
function(qt_allow_non_utf8_sources)
qt6_allow_non_utf8_sources(${ARGV})
endfunction()
endif()