From a1865f01204f2e266a9e3fbe0336bcaecd86993b Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Wed, 8 Sep 2021 16:56:14 +1000 Subject: Move CMake-related doc files into their own subdirectory This is in preparation for splitting up the cmake-macros.qdoc file into one file per command. Task-number: QTBUG-95712 Change-Id: I9e56b88139cc6a53cd03cbed3d14404577f89faa Reviewed-by: Alexandru Croitor (cherry picked from commit 5b58fbf9a2aa1027fdbe4ade0f796775cc4b0a24) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/doc/src/cmake-macros.qdoc | 633 ------------------------ src/corelib/doc/src/cmake-properties.qdoc | 317 ------------ src/corelib/doc/src/cmake-variables.qdoc | 100 ---- src/corelib/doc/src/cmake/cmake-macros.qdoc | 633 ++++++++++++++++++++++++ src/corelib/doc/src/cmake/cmake-properties.qdoc | 317 ++++++++++++ src/corelib/doc/src/cmake/cmake-variables.qdoc | 100 ++++ 6 files changed, 1050 insertions(+), 1050 deletions(-) delete mode 100644 src/corelib/doc/src/cmake-macros.qdoc delete mode 100644 src/corelib/doc/src/cmake-properties.qdoc delete mode 100644 src/corelib/doc/src/cmake-variables.qdoc create mode 100644 src/corelib/doc/src/cmake/cmake-macros.qdoc create mode 100644 src/corelib/doc/src/cmake/cmake-properties.qdoc create mode 100644 src/corelib/doc/src/cmake/cmake-variables.qdoc (limited to 'src') diff --git a/src/corelib/doc/src/cmake-macros.qdoc b/src/corelib/doc/src/cmake-macros.qdoc deleted file mode 100644 index 02d33dc445..0000000000 --- a/src/corelib/doc/src/cmake-macros.qdoc +++ /dev/null @@ -1,633 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! -\page qt_wrap_cpp.html -\ingroup cmake-macros-qtcore - -\title qt_wrap_cpp -\target qt6_wrap_cpp - -\brief Creates \c{.moc} files from sources. - -\section1 Synopsis - -\badcode -qt_wrap_cpp( src_file1 [src_file2 ...] - [TARGET target] - [OPTIONS ...] - [DEPENDS ...]) - -\endcode - -\versionlessCMakeCommandsNote qt6_wrap_cpp() - -\section1 Description - -Creates rules for calling the \l{moc}{Meta-Object Compiler (moc)} on the given -source files. For each input file, an output file is generated in the build -directory. The paths of the generated files are added to \c{}. - -\note This is a low-level macro. See the \l{CMake AUTOMOC Documentation} for a -more convenient way to let source files be processed with \c{moc}. - -\section1 Arguments - -You can set an explicit \c{TARGET}. This will make sure that the target -properties \c{INCLUDE_DIRECTORIES} and \c{COMPILE_DEFINITIONS} are also used -when scanning the source files with \c{moc}. - -You can set additional \c{OPTIONS} that should be added to the \c{moc} calls. -You can find possible options in the \l{moc}{moc documentation}. - -\c{DEPENDS} allows you to add additional dependencies for recreation of the -generated files. This is useful when the sources have implicit dependencies, -like code for a Qt plugin that includes a \c{.json} file using the -Q_PLUGIN_METADATA() macro. - -\section1 Examples - -\snippet cmake-macros/examples.cmake qt_wrap_cpp -*/ - -/*! -\page qt_add_resources.html -\ingroup cmake-macros-qtcore - -\title qt_add_resources -\target qt6_add_resources - -\brief Compiles binary resources into source code. - -\section1 Synopsis - -\badcode -qt_add_resources( file1.qrc [file2.qrc ...] - [OPTIONS ...]) -\endcode - -\versionlessCMakeCommandsNote qt6_add_resources() - -Since 6.0: - -\badcode -qt_add_resources( - [PREFIX ] - [LANG ] - [BASE ] - [FILES ...] [OPTIONS ...]) -\endcode - -\versionlessCMakeCommandsNote qt6_add_resources() - -\section1 Description - -To add resources, you can pass either a variable name or a target as the first -argument of the command. - -When passing a variable name as first argument, \c qt_add_resources creates -source code from Qt resource files using the \l{Resource Compiler (rcc)}. Paths -to the generated source files are added to \c{}. - -When passing a target as first argument, the function creates a resource with -the name \c{RESOURCE_NAME}, containing the specified \c{FILES}. The resource is -automatically linked into \c{TARGET}. - -For embedding bigger resources, see \l qt_add_big_resources. - -See \l{The Qt Resource System} for a general description of Qt resources. - -\section1 Arguments of the target-based variant - -\c PREFIX specifies a path prefix under which all files of this resource are -accessible from C++ code. This corresponds to the XML attribute \c prefix of the -\c .qrc file format. If \c PREFIX is not given, the target property -\l{cmake-target-property-QT_RESOURCE_PREFIX}{QT_RESOURCE_PREFIX} is used. - -\c LANG specifies the locale of this resource. This corresponds to the XML -attribute \c lang of the \c .qrc file format. - -\c BASE is a path prefix that denotes the root point of the file's alias. For -example, if \c BASE is \c{"assets"} and \c FILES is -\c{"assets/images/logo.png"}, then the alias of that file is -\c{"images/logo.png"}. - -Alias settings for files need to be set via the \c QT_RESOURCE_ALIAS source file -property. - -\section1 Arguments of both variants - -You can set additional \c{OPTIONS} that should be added to the \c{rcc} calls. -You can find possible options in the \l{rcc}{rcc documentation}. - -\section1 Examples - -Variable variant, using a .qrc file: -\snippet cmake-macros/examples.cmake qt_add_resources - -Target variant, using immediate resources: -\snippet cmake-macros/examples.cmake qt_add_resources_target - -\section1 Caveats - -When adding multiple resources, \c{RESOURCE_NAME} must be unique across all -resources linked into the final target. - -This especially affects static builds. There, the same resource name in -different static libraries conflict in the consuming target. -*/ - -/*! -\page qt_add_bigresources.html -\ingroup cmake-macros-qtcore - -\title qt_add_big_resources -\target qt6_add_big_resources - -\brief Compiles big binary resources into object code. - -\section1 Synopsis - -\badcode -qt_add_big_resources( file1.qrc [file2.qrc ...] - [OPTIONS ...]) -\endcode - -\versionlessCMakeCommandsNote qt6_add_big_resources() - -\section1 Description - -Creates compiled object files from Qt resource files using the -\l{Resource Compiler (rcc)}. Paths to the generated files are added to -\c{}. - -This is similar to \l qt_add_resources, but directly -generates object files (\c .o, \c .obj) files instead of C++ source code. -This allows to embed bigger resources, where compiling to C++ sources and then -to binaries would be too time consuming or memory intensive. - -\note This macro is only available if using \c{CMake} 3.9 or later. - -\section1 Arguments - -You can set additional \c{OPTIONS} that should be added to the \c{rcc} calls. -You can find possible options in the \l{rcc}{rcc documentation}. - -\section1 Examples - -\snippet cmake-macros/examples.cmake qt_add_big_resources -*/ - -/*! -\page qt_add_binary_resources.html -\ingroup cmake-macros-qtcore - -\title qt_add_binary_resources -\target qt6_add_binary_resources - -\brief Creates an \c{RCC} file from a list of Qt resource files. - -\section1 Synopsis - -\badcode -qt_add_binary_resources(target file1.qrc [file2.qrc ...] - [DESTINATION ...] - [OPTIONS ...]) -\endcode - -\versionlessCMakeCommandsNote qt6_add_binary_resources() - -\section1 Description - -Adds a custom \c target that compiles Qt resource files into a binary \c{.rcc} -file. - -\section1 Arguments - -\c{DESTINATION} sets the path of the generated \c{.rcc} file. The default is -\c{${CMAKE_CURRENT_BINARY_DIR}/${target}.rcc}. - -You can set additional \c{OPTIONS} that should be added to the \c{rcc} calls. -You can find possible options in the \l{rcc}{rcc documentation}. - -\section1 Examples - -\snippet cmake-macros/examples.cmake qt_add_binary_resources -*/ - -/*! -\page qt_generate_moc.html -\ingroup cmake-macros-qtcore - -\title qt_generate_moc -\target qt6_generate_moc - -\brief Calls moc on an input file. - -\section1 Synopsis - -\badcode -qt_generate_moc(src_file dest_file - [TARGET target]) -\endcode - -\versionlessCMakeCommandsNote qt6_generate_moc() - -\section1 Description - -Creates a rule to call the \l{moc}{Meta-Object Compiler (moc)} on \c src_file -and store the output in \c dest_file. - -\note This is a low-level macro. See the \l{CMake AUTOMOC Documentation} for a -more convenient way to let source files be processed with \c{moc}. -\l qt_wrap_cpp is also similar, but automatically generates a temporary file -path for you. - -\section1 Arguments - -You can set an explicit \c{TARGET}. This will make sure that the target -properties \c{INCLUDE_DIRECTORIES} and \c{COMPILE_DEFINITIONS} are also used -when scanning the source files with \c{moc}. - -\section1 Examples - -\snippet cmake-macros/examples.cmake qt_generate_moc -*/ - -/*! -\page qt_import_plugins.html -\ingroup cmake-macros-qtcore - -\title qt_import_plugins -\target qt6_import_plugins - -\brief Specifies a custom set of plugins to import for a static Qt build. - -\section1 Synopsis - -\badcode -qt_import_plugins(target - [INCLUDE plugin ...] - [EXCLUDE plugin ...] - [INCLUDE_BY_TYPE plugin_type plugin ...] - [EXCLUDE_BY_TYPE plugin_type]) -\endcode - -\versionlessCMakeCommandsNote qt6_import_plugins() - -\section1 Description - -Specifies a custom set of plugins to import. The optional arguments: -\c INCLUDE, \c EXCLUDE, \c INCLUDE_BY_TYPE, and \c EXCLUDE_BY_TYPE, -can be used more than once. - -\list -\li \c INCLUDE -- can be used to specify a list of plugins to import. -\li \c EXCLUDE -- can be used to specify a list of plugins to exclude. -\li \c INCLUDE_BY_TYPE -- can be used to override the list of plugins to - import for a certain plugin type. -\li \c EXCLUDE_BY_TYPE -- can be used to specify a plugin type to exclude; - then no plugins of that type are imported. -\endlist - -Qt provides plugin types such as \c imageformats, \c platforms, -and \c sqldrivers. - -If the command isn't used the target automatically links against -a sane set of default plugins, for each Qt module that the target is linked -against. For more information, see -\l{CMake target_link_libraries Documentation}{target_link_libraries}. - -Each plugin comes with a C++ stub file that automatically -initializes the plugin. Consequently, any target that links against a plugin -has this C++ file added to its \c SOURCES. - -\note This command imports plugins from static Qt builds only. -On shared builds, it does nothing. - -\section1 Examples - -\snippet cmake-macros/examples.cmake qt_import_plugins - -In the snippet above, the following occurs with the executable \c myapp: - -\list -\li The \c Qt6::QCocoaIntegrationPlugin is imported into myapp. -\li The \c Qt6::QMinimalIntegrationPlugin plugin is - excluded from being automatically imported into myapp. -\li The default list of plugins for \c imageformats is - overridden to only include Qt6::QGifPlugin and Qt6::QJpegPlugin. -\li All \c sqldrivers plugins are excluded from automatic importing. -\endlist -*/ - -/*! -\page qt_add_executable.html -\ingroup cmake-macros-qtcore - -\title qt_add_executable -\target qt6_add_executable - -\brief Creates and finalizes an application target of a platform-specific type. - -\preliminarycmakecommand - -\section1 Synopsis - -\badcode -qt_add_executable(target - [WIN32] [MACOSX_BUNDLE] - [MANUAL_FINALIZATION] - sources...) -\endcode - -\versionlessCMakeCommandsNote qt6_add_executable() - -\section1 Description - -This command performs the following tasks: - -\list -\li Create a CMake target of the appropriate type for the target platform. -\li Link the target to the \c{Qt::Core} library. -\li Handle finalization of the CMake target. -\endlist - -\section2 Target Creation - -On all platforms except Android, an executable target will be created. -All arguments will be passed through to the standard CMake \c{add_executable()} -command, except \c{MANUAL_FINALIZATION} (if present). On Android, a \c{MODULE} -library will be created and any \c{WIN32} or \c{MACOSX_BUNDLE} options will be -ignored. Some target properties will also be set for Android: - -\list -\li The \c{SUFFIX} target property will be set to give the library file name an - architecture-specific suffix. -\li Various \c{_VISIBILITY_PRESET} target properties will be set to - \c{default} to ensure that the \c{main()} function is visible in the - resultant binary. -\endlist - -\section2 Linking Qt::Core - -Since all Qt applications need to link to the \c{Qt::Core} library, this is done -for you as a convenience. - -\section2 Finalization - -After a target is created, further processing or \e{finalization} steps are -commonly needed. The steps to perform depend on the platform and on various -properties of the target. The finalization processing is implemented by the -\l{qt6_finalize_target}{qt_finalize_target()} command. - -Finalization can occur either as part of this call or be deferred to sometime -after this command returns (but it should still be in the same directory scope). -When using CMake 3.19 or later, finalization is automatically deferred to the -end of the current directory scope. This gives the caller an opportunity to -modify properties of the created target before it is finalized. When using -CMake versions earlier than 3.19, automatic deferral isn't supported. In that -case, finalization is performed immediately before this command returns. - -Regardless of the CMake version, the \c{MANUAL_FINALIZATION} keyword can be given to -indicate that you will explicitly call \l{qt6_finalize_target}{qt_finalize_target()} -yourself instead at some later time. In general, \c MANUAL_FINALIZATION should -not be needed unless the project has to support CMake 3.18 or earlier. - -\sa {qt6_finalize_target}{qt_finalize_target()} - -\section1 Examples - -In the following simple case, finalization is handled automatically. If using a -CMake version earlier than 3.19, finalization will be performed immediately as -part of the call. When using CMake 3.19 or later, finalization will occur at the -end of the current directory scope. - -\snippet cmake-macros/examples.cmake qt_add_executable_simple - -The following example shows a scenario where finalization must be deferred. -The \c OUTPUT_NAME target property affects deployment settings on Android, but -those settings are written out as part of finalizing the target. In order to -support using CMake versions earlier than 3.19, we take over responsibility -for finalizing the target by adding the \c{MANUAL_FINALIZATION} keyword. - -\snippet cmake-macros/examples.cmake qt_add_executable_deferred -*/ - -/*! -\page qt_finalize_target.html -\ingroup cmake-macros-qtcore - -\title qt_finalize_target -\target qt6_finalize_target - -\brief Handles various common platform-specific tasks associated with Qt targets. - -\preliminarycmakecommand - -\section1 Synopsis - -\badcode -qt_finalize_target(target) -\endcode - -\versionlessCMakeCommandsNote qt6_finalize_target() - -\section1 Description - -After a target is created, further processing or \e{finalization} steps are -commonly needed. The steps to perform depend on the platform and on various -properties of the target. These steps are expected to be performed within the -same directory scope as the one in which the \c{target} was created, so this -command should also be called from that same directory scope. - -This command implements the following, as appropriate for the platform and -target provided: - -\list -\li When targeting Android, generate a deployment settings file for the target. -\li Create a build target for generating an APK if building for Android. -\endlist - -This command is ordinarily invoked as part of a call to -\l{qt6_add_executable}{qt_add_executable()}. The timing of when that call takes -place and when it might need to be called explicitly by a project is discussed -in the documentation of that command. -*/ - -/*! -\page qt_android_apply_arch_suffix.html -\ingroup cmake-macros-qtcore - -\title qt_android_apply_arch_suffix -\target qt6_android_apply_arch_suffix - -\brief Configures the target binary's name to include an architecture-specific suffix. - -\preliminarycmakecommand -\cmakecommandandroidonly - -\section1 Synopsis - -\badcode -qt_android_apply_arch_suffix(target) -\endcode - -\versionlessCMakeCommandsNote qt6_android_apply_arch_suffix() - -\section1 Description - -The CMake \c{SUFFIX} target property controls the suffix used on the file name -of the target's built binary. This command is a convenience for setting that -property to an architecture-specific value. This is useful when installing -multiple builds for different Android architectures into the same install -location, as it prevents the libraries for different architectures from -overwriting each other. -*/ - -/*! -\page qt_android_generate_deployment_settings.html -\ingroup cmake-macros-qtcore - -\title qt_android_generate_deployment_settings -\target qt6_android_generate_deployment_settings - -\brief Generates the deployment settings file needed by androiddeployqt. - -\preliminarycmakecommand -\cmakecommandandroidonly - -\section1 Synopsis - -\badcode -qt_android_generate_deployment_settings(target) -\endcode - -\versionlessCMakeCommandsNote qt6_android_generate_deployment_settings() - -\section1 Description - -The \c{androiddeployqt} tool expects a deployment settings file as input. This -command reads CMake variables and properties of the \c{target} to generate such -a file in the target's binary directory. Upon return, the full path to this file -is available in the target's \c{QT_ANDROID_DEPLOYMENT_SETTINGS_FILE} property. - -\section2 CMake Variables - -A number of variables are used while generating the deployment settings file. -Some are provided by Qt, others by CMake or the Android NDK. - -\list -\li \l{cmake-variable-ANDROID_NDK_HOST_SYSTEM_NAME}{ANDROID_NDK_HOST_SYSTEM_NAME} -\li \l{cmake-variable-ANDROID_SDK_ROOT}{ANDROID_SDK_ROOT} -\li \c{CMAKE_ANDROID_ARCH_ABI} -\li \c{CMAKE_ANDROID_NDK} -\li \c{CMAKE_SYSROOT} -\li \l{cmake-variable-QT_ANDROID_APPLICATION_ARGUMENTS}{QT_ANDROID_APPLICATION_ARGUMENTS} -\li \l{cmake-variable-QT_HOST_PATH}{QT_HOST_PATH} -\endlist - -\section2 Target Properties - -The properties below will be read from the specified \c{target}. Note that this -command is called as part of target finalization (see -\l{qt6_finalize_target}{qt_finalize_target()}). If you are using -\l{qt6_add_executable}{qt_add_executable()} to create the target and you need to -modify some of these target properties, you need to ensure that target -finalization is deferred. See \l{qt6_add_executable}{qt_add_executable()} for -how to accomplish this. - -\list -\li \l{cmake-target-property-QT_ANDROID_DEPLOYMENT_DEPENDENCIES}{QT_ANDROID_DEPLOYMENT_DEPENDENCIES} -\li \l{cmake-target-property-QT_ANDROID_EXTRA_LIBS}{QT_ANDROID_EXTRA_LIBS} -\li \l{cmake-target-property-QT_ANDROID_EXTRA_PLUGINS}{QT_ANDROID_EXTRA_PLUGINS} -\li \l{cmake-target-property-QT_ANDROID_MIN_SDK_VERSION}{QT_ANDROID_MIN_SDK_VERSION} -\li \l{cmake-target-property-QT_ANDROID_PACKAGE_SOURCE_DIR}{QT_ANDROID_PACKAGE_SOURCE_DIR} -\li \l{cmake-target-property-QT_ANDROID_TARGET_SDK_VERSION}{QT_ANDROID_TARGET_SDK_VERSION} -\li \l{cmake-target-property-QT_ANDROID_VERSION_NAME}{QT_ANDROID_VERSION_NAME} -\li \l{cmake-target-property-QT_ANDROID_VERSION_CODE}{QT_ANDROID_VERSION_CODE} -\li \l{cmake-target-property-QT_QML_IMPORT_PATH}{QT_QML_IMPORT_PATH} -\li \l{cmake-target-property-QT_QML_ROOT_PATH}{QT_QML_ROOT_PATH} -\li \l{cmake-target-property-qt_no_entrypoint}{qt_no_entrypoint} -\endlist - -Upon return, the \c{QT_ANDROID_DEPLOYMENT_SETTINGS_FILE} target property will -contain the location of the generated deployment settings file. - -\sa {qt6_android_add_apk_target}{qt_android_add_apk_target()}, - {qt6_finalize_target}{qt_finalize_target()} - -\section1 Example - -\snippet cmake-macros/examples.cmake qt_android_deploy_basic -*/ - -/*! -\page qt_android_add_apk_target.html -\ingroup cmake-macros-qtcore - -\title qt_android_add_apk_target -\target qt6_android_add_apk_target - -\brief Defines a build target that runs androiddeployqt to produce an APK. - -\preliminarycmakecommand -\cmakecommandandroidonly - -\section1 Synopsis - -\badcode -qt_android_add_apk_target(target) -\endcode - -\versionlessCMakeCommandsNote qt6_android_add_apk_target() - -\section1 Description - -The \c{_make_apk} custom target created by this command takes an Android -deployment settings file and generates an APK by running \c{androiddeployqt}. -The location of the settings file is taken from the \c{target}'s -\c{QT_ANDROID_DEPLOYMENT_SETTINGS_FILE} property. This file is typically created by -\l{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}. -The \c{.apk} file will be generated in an \c{android-build} subdirectory below -the CMake build directory of the \c{target}. - -The \c{_make_apk} target will be automatically added as a dependency of -the \c{apk} build target, which will be created if it doesn't already exist. -This can be disabled by setting the \c{QT_NO_GLOBAL_APK_TARGET} variable to true. - -\sa {qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}, - {qt6_finalize_target}{qt_finalize_target()} - -\section1 Example - -\snippet cmake-macros/examples.cmake qt_android_deploy_basic - -The above commands define the build targets \c{myapp_make_apk} and \c{apk}, -which can be used to generate just the \c{myapp} APK or all APKs in the project -respectively. -*/ diff --git a/src/corelib/doc/src/cmake-properties.qdoc b/src/corelib/doc/src/cmake-properties.qdoc deleted file mode 100644 index 9627187bec..0000000000 --- a/src/corelib/doc/src/cmake-properties.qdoc +++ /dev/null @@ -1,317 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! -\page cmake-target-property-QT_ANDROID_DEPLOYMENT_DEPENDENCIES.html -\ingroup cmake-properties-qtcore -\ingroup cmake-target-properties-qtcore - -\title QT_ANDROID_DEPLOYMENT_DEPENDENCIES -\target cmake-target-property-QT_ANDROID_DEPLOYMENT_DEPENDENCIES - -\brief Overrides the Qt dependencies added to the target's deployment. - -\preliminarycmakeproperty -\cmakepropertyandroidonly - -By default, \l androiddeployqt will detect the dependencies of your -application. However, since run-time usage of plugins cannot be detected, -there could be false positives, as your application might depend on any -plugin that is a potential dependency. If you want to minimize the size of -your \c APK, it's possible to override the automatic detection using this -property. This should contain a list of all Qt files which need to be -included, with paths relative to the Qt install root. - -\note Only the Qt files specified with this variable are included. Failing -to include all the correct files can result in crashes. It's also important -to make sure the files are listed in the correct loading order. This variable -provides a way to override the automatic detection entirely, so if a library -is listed before its dependencies, it will fail to load on some devices. - -\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} -*/ - -/*! -\page cmake-target-property-QT_ANDROID_EXTRA_LIBS.html -\ingroup cmake-properties-qtcore -\ingroup cmake-target-properties-qtcore - -\title QT_ANDROID_EXTRA_LIBS -\target cmake-target-property-QT_ANDROID_EXTRA_LIBS - -\brief Extra libraries to deploy with the target. - -\preliminarycmakeproperty -\cmakepropertyandroidonly - -A list of external libraries that will be copied into your application's -\c libs folder and loaded on start-up. This can be used, for instance, -to enable OpenSSL in your application. For more information, see -\l{Adding OpenSSL Support for Android}. - -\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} -*/ - -/*! -\page cmake-target-property-QT_ANDROID_EXTRA_PLUGINS.html -\ingroup cmake-properties-qtcore -\ingroup cmake-target-properties-qtcore - -\title QT_ANDROID_EXTRA_PLUGINS -\target cmake-target-property-QT_ANDROID_EXTRA_PLUGINS - -\brief Extra Qt plugins to deploy with the target. - -\preliminarycmakeproperty -\cmakepropertyandroidonly - -Specifies a path to C++ plugins or resources that your application has to bundle -but that cannot be delivered through the assets system, such as QML plugins. -With this variable, \l androiddeployqt will make sure everything is packaged -and deployed properly. - -\c QT_ANDROID_EXTRA_PLUGINS must point to the directory where the extra plugin(s) -are built. In addition, the build directory structure must follow a naming -convention similar to Qt plugins, that is, \e {plugins/}. -\c QT_ANDROID_EXTRA_PLUGINS should point to the \e {plugins} part of that path. - -The plugins libraries should have the name format -\e {libplugins___.so}. This will ensure that the correct name -mangling is applied to the plugin library. -\omit -TODO: Not yet documented, API still under review - see QTBUG-88763 -See the \l{qt6_add_plugin}{qt_add_plugin()} command for the easiest way to achieve -that. -\endomit - -\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} -*/ - -/*! -\page cmake-target-property-QT_ANDROID_MIN_SDK_VERSION.html -\ingroup cmake-properties-qtcore -\ingroup cmake-target-properties-qtcore - -\title QT_ANDROID_MIN_SDK_VERSION -\target cmake-target-property-QT_ANDROID_MIN_SDK_VERSION - -\brief Minimum Android SDK version. - -\preliminarycmakeproperty -\cmakepropertyandroidonly - -Specifies the minimum Android API level for the target. - -\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} -*/ - -/*! -\page cmake-target-property-QT_ANDROID_PACKAGE_SOURCE_DIR.html -\ingroup cmake-properties-qtcore -\ingroup cmake-target-properties-qtcore - -\title QT_ANDROID_PACKAGE_SOURCE_DIR -\target cmake-target-property-QT_ANDROID_PACKAGE_SOURCE_DIR - -\brief Path to a custom Android package template. - -\preliminarycmakeproperty -\cmakepropertyandroidonly - -Specifies the path for a custom Android package template. The Android package -template contains: -\list - \li AndroidManifest.xml file - \li build.gradle file and other Gradle scripts - \li res/values/libs.xml file -\endlist - -The path specified by this variable can contain custom Java classes under -\c src directory. By default, the \l androiddeployqt tool copies the -application template from the Qt for Android installation path into your -project's build directory, then it copies the contents of the path specified -by this variable on top of that, overwriting any existing files. For -instance, you can make a custom \c {AndroidManifest.xml} for your application, -then place this directly into the directory specified by this variable. - -\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} -*/ - -/*! -\page cmake-target-property-QT_ANDROID_TARGET_SDK_VERSION.html -\ingroup cmake-properties-qtcore -\ingroup cmake-target-properties-qtcore - -\title QT_ANDROID_TARGET_SDK_VERSION -\target cmake-target-property-QT_ANDROID_TARGET_SDK_VERSION - -\brief Android target SDK version. - -\preliminarycmakeproperty -\cmakepropertyandroidonly - -Specifies the target Android API level for the target. - -\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} -*/ - -/*! -\page cmake-target-property-QT_ANDROID_VERSION_CODE.html -\ingroup cmake-properties-qtcore -\ingroup cmake-target-properties-qtcore - -\title QT_ANDROID_VERSION_CODE -\target cmake-target-property-QT_ANDROID_VERSION_CODE - -\brief Internal Android app version. - -\preliminarycmakeproperty -\cmakepropertyandroidonly - -Specifies the app's version number. This is usually a number that -increments monotonically with each release of your project. - -For more information, see \l{Android: App Versioning}{Android App Versioning}. - -\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} -*/ - -/*! -\page cmake-target-property-QT_ANDROID_VERSION_NAME.html -\ingroup cmake-properties-qtcore -\ingroup cmake-target-properties-qtcore - -\title QT_ANDROID_VERSION_NAME -\target cmake-target-property-QT_ANDROID_VERSION_NAME - -\brief Human-readable Android app version. - -\preliminarycmakeproperty -\cmakepropertyandroidonly - -Specifies the app's version as a human readable string, usually three -numbers, separated by dots. - -For more information, see \l{Android: App Versioning}{Android App Versioning}. - -\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} -*/ - -/*! -\page cmake-target-property-QT_QML_ROOT_PATH.html -\ingroup cmake-properties-qtcore -\ingroup cmake-target-properties-qtcore - -\title QT_QML_ROOT_PATH -\target cmake-target-property-QT_QML_ROOT_PATH - -\brief Overrides the location of the application's qml directory. - -\preliminarycmakeproperty - -This property is currently only used when generating a deployment settings file -for Android. If the property is set, it specifies the path to the application's -\c{qml} directory. If it is not set, the \c{SOURCE_DIR} property of the target -will be used instead. - -\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} -*/ - -/*! -\page cmake-target-property-QT_QML_IMPORT_PATH.html -\ingroup cmake-properties-qtcore -\ingroup cmake-target-properties-qtcore - -\title QT_QML_IMPORT_PATH -\target cmake-target-property-QT_QML_IMPORT_PATH - -\brief Specifies a list of directories to search for QML imports. - -\preliminarycmakeproperty - -This property is currently only used when generating a deployment settings file -for Android. It typically contains just the path to Qt's \c{qml} directory, but -it can be a list that contains other locations to be searched as well. -For application-specific QML imports, use -\l{cmake-target-property-QT_QML_ROOT_PATH}{QT_QML_ROOT_PATH} instead. - -\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} -*/ - -/*! -\page cmake-target-property-QT_ANDROID_DEPLOYMENT_SETTINGS_FILE.html -\ingroup cmake-properties-qtcore -\ingroup cmake-target-properties-qtcore - -\title QT_ANDROID_DEPLOYMENT_SETTINGS_FILE -\target cmake-target-property-QT_ANDROID_DEPLOYMENT_SETTINGS_FILE - -\brief Specifies the location of a target's generated deployment settings file. - -\preliminarycmakeproperty -\cmakepropertyandroidonly - -This property will be set by -\l{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}. -Projects should not try to set this property themselves, as it will be ignored -and overwritten by that command. -*/ - -/*! -\page cmake-target-property-qt_no_entrypoint.html -\ingroup cmake-properties-qtcore -\ingroup cmake-target-properties-qtcore - -\title qt_no_entrypoint -\target cmake-target-property-qt_no_entrypoint - -\brief Specifies to inhibit linking against Qt's entrypoint lib. - -\preliminarycmakeproperty - -On certain platforms, Qt applications link against Qt's entrypoint lib by default. -That library provides implementations of main (or WinMain). - -On targets that must provide their own entry point, set the property \c qt_no_entrypoint to inhibit linking against Qt's entrypoint library. -*/ - -/*! -\page cmake-target-property-qt_resource_prefix.html -\ingroup cmake-properties-qtcore -\ingroup cmake-target-properties-qtcore - -\title QT_RESOURCE_PREFIX -\target cmake-target-property-QT_RESOURCE_PREFIX - -\brief Specifies the default Qt resource prefix. - -\preliminarycmakeproperty - -When using \l{qt6_add_resources}{qt_add_resources} without a \c PREFIX -argument, then the value of this target property will be used as -resource prefix. -*/ diff --git a/src/corelib/doc/src/cmake-variables.qdoc b/src/corelib/doc/src/cmake-variables.qdoc deleted file mode 100644 index d3f73ab918..0000000000 --- a/src/corelib/doc/src/cmake-variables.qdoc +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! -\page cmake-variable-ANDROID_NDK_HOST_SYSTEM_NAME.html -\ingroup cmake-variables -\ingroup cmake-variables-qtcore - -\title ANDROID_NDK_HOST_SYSTEM_NAME -\target cmake-variable-ANDROID_NDK_HOST_SYSTEM_NAME - -\brief Android-specific architecture of the host system. - -\preliminarycmakevariable -\cmakevariableandroidonly - -This is normally set by the Android NDK toolchain file. It is written out as -part of the deployment settings for a target. - -\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} -*/ - -/*! -\page cmake-variable-ANDROID_SDK_ROOT.html -\ingroup cmake-variables -\ingroup cmake-variables-qtcore - -\title ANDROID_SDK_ROOT -\target cmake-variable-ANDROID_SDK_ROOT - -\brief Location of the Android SDK. - -\preliminarycmakevariable -\cmakevariableandroidonly - -This specifies the location of the Android SDK when building for the Android platform. -It is written out as part of the deployment settings for a target. - -\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}. -*/ - -/*! -\page cmake-variable-QT_ANDROID_APPLICATION_ARGUMENTS.html -\ingroup cmake-variables -\ingroup cmake-variables-qtcore - -\title QT_ANDROID_APPLICATION_ARGUMENTS -\target cmake-variable-QT_ANDROID_APPLICATION_ARGUMENTS - -\brief List of arguments to pass to Android applications. - -\preliminarycmakevariable -\cmakevariableandroidonly - -This contains a list of arguments to be passed to Android applications. It is written -out as part of the deployment settings for a target. - -\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} -*/ - -/*! -\page cmake-variable-QT_HOST_PATH.html -\ingroup cmake-variables -\ingroup cmake-variables-qtcore - -\title QT_HOST_PATH -\target cmake-variable-QT_HOST_PATH - -\brief Location of the host Qt installation when cross-compiling. - -\preliminarycmakevariable - -When cross-compiling, this must be set to the install location of Qt for the host -platform. It is used to locate tools to be run on the host (\l{moc}, \l{rcc}, -\l{androiddeployqt}, and so on). -*/ diff --git a/src/corelib/doc/src/cmake/cmake-macros.qdoc b/src/corelib/doc/src/cmake/cmake-macros.qdoc new file mode 100644 index 0000000000..02d33dc445 --- /dev/null +++ b/src/corelib/doc/src/cmake/cmake-macros.qdoc @@ -0,0 +1,633 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qt_wrap_cpp.html +\ingroup cmake-macros-qtcore + +\title qt_wrap_cpp +\target qt6_wrap_cpp + +\brief Creates \c{.moc} files from sources. + +\section1 Synopsis + +\badcode +qt_wrap_cpp( src_file1 [src_file2 ...] + [TARGET target] + [OPTIONS ...] + [DEPENDS ...]) + +\endcode + +\versionlessCMakeCommandsNote qt6_wrap_cpp() + +\section1 Description + +Creates rules for calling the \l{moc}{Meta-Object Compiler (moc)} on the given +source files. For each input file, an output file is generated in the build +directory. The paths of the generated files are added to \c{}. + +\note This is a low-level macro. See the \l{CMake AUTOMOC Documentation} for a +more convenient way to let source files be processed with \c{moc}. + +\section1 Arguments + +You can set an explicit \c{TARGET}. This will make sure that the target +properties \c{INCLUDE_DIRECTORIES} and \c{COMPILE_DEFINITIONS} are also used +when scanning the source files with \c{moc}. + +You can set additional \c{OPTIONS} that should be added to the \c{moc} calls. +You can find possible options in the \l{moc}{moc documentation}. + +\c{DEPENDS} allows you to add additional dependencies for recreation of the +generated files. This is useful when the sources have implicit dependencies, +like code for a Qt plugin that includes a \c{.json} file using the +Q_PLUGIN_METADATA() macro. + +\section1 Examples + +\snippet cmake-macros/examples.cmake qt_wrap_cpp +*/ + +/*! +\page qt_add_resources.html +\ingroup cmake-macros-qtcore + +\title qt_add_resources +\target qt6_add_resources + +\brief Compiles binary resources into source code. + +\section1 Synopsis + +\badcode +qt_add_resources( file1.qrc [file2.qrc ...] + [OPTIONS ...]) +\endcode + +\versionlessCMakeCommandsNote qt6_add_resources() + +Since 6.0: + +\badcode +qt_add_resources( + [PREFIX ] + [LANG ] + [BASE ] + [FILES ...] [OPTIONS ...]) +\endcode + +\versionlessCMakeCommandsNote qt6_add_resources() + +\section1 Description + +To add resources, you can pass either a variable name or a target as the first +argument of the command. + +When passing a variable name as first argument, \c qt_add_resources creates +source code from Qt resource files using the \l{Resource Compiler (rcc)}. Paths +to the generated source files are added to \c{}. + +When passing a target as first argument, the function creates a resource with +the name \c{RESOURCE_NAME}, containing the specified \c{FILES}. The resource is +automatically linked into \c{TARGET}. + +For embedding bigger resources, see \l qt_add_big_resources. + +See \l{The Qt Resource System} for a general description of Qt resources. + +\section1 Arguments of the target-based variant + +\c PREFIX specifies a path prefix under which all files of this resource are +accessible from C++ code. This corresponds to the XML attribute \c prefix of the +\c .qrc file format. If \c PREFIX is not given, the target property +\l{cmake-target-property-QT_RESOURCE_PREFIX}{QT_RESOURCE_PREFIX} is used. + +\c LANG specifies the locale of this resource. This corresponds to the XML +attribute \c lang of the \c .qrc file format. + +\c BASE is a path prefix that denotes the root point of the file's alias. For +example, if \c BASE is \c{"assets"} and \c FILES is +\c{"assets/images/logo.png"}, then the alias of that file is +\c{"images/logo.png"}. + +Alias settings for files need to be set via the \c QT_RESOURCE_ALIAS source file +property. + +\section1 Arguments of both variants + +You can set additional \c{OPTIONS} that should be added to the \c{rcc} calls. +You can find possible options in the \l{rcc}{rcc documentation}. + +\section1 Examples + +Variable variant, using a .qrc file: +\snippet cmake-macros/examples.cmake qt_add_resources + +Target variant, using immediate resources: +\snippet cmake-macros/examples.cmake qt_add_resources_target + +\section1 Caveats + +When adding multiple resources, \c{RESOURCE_NAME} must be unique across all +resources linked into the final target. + +This especially affects static builds. There, the same resource name in +different static libraries conflict in the consuming target. +*/ + +/*! +\page qt_add_bigresources.html +\ingroup cmake-macros-qtcore + +\title qt_add_big_resources +\target qt6_add_big_resources + +\brief Compiles big binary resources into object code. + +\section1 Synopsis + +\badcode +qt_add_big_resources( file1.qrc [file2.qrc ...] + [OPTIONS ...]) +\endcode + +\versionlessCMakeCommandsNote qt6_add_big_resources() + +\section1 Description + +Creates compiled object files from Qt resource files using the +\l{Resource Compiler (rcc)}. Paths to the generated files are added to +\c{}. + +This is similar to \l qt_add_resources, but directly +generates object files (\c .o, \c .obj) files instead of C++ source code. +This allows to embed bigger resources, where compiling to C++ sources and then +to binaries would be too time consuming or memory intensive. + +\note This macro is only available if using \c{CMake} 3.9 or later. + +\section1 Arguments + +You can set additional \c{OPTIONS} that should be added to the \c{rcc} calls. +You can find possible options in the \l{rcc}{rcc documentation}. + +\section1 Examples + +\snippet cmake-macros/examples.cmake qt_add_big_resources +*/ + +/*! +\page qt_add_binary_resources.html +\ingroup cmake-macros-qtcore + +\title qt_add_binary_resources +\target qt6_add_binary_resources + +\brief Creates an \c{RCC} file from a list of Qt resource files. + +\section1 Synopsis + +\badcode +qt_add_binary_resources(target file1.qrc [file2.qrc ...] + [DESTINATION ...] + [OPTIONS ...]) +\endcode + +\versionlessCMakeCommandsNote qt6_add_binary_resources() + +\section1 Description + +Adds a custom \c target that compiles Qt resource files into a binary \c{.rcc} +file. + +\section1 Arguments + +\c{DESTINATION} sets the path of the generated \c{.rcc} file. The default is +\c{${CMAKE_CURRENT_BINARY_DIR}/${target}.rcc}. + +You can set additional \c{OPTIONS} that should be added to the \c{rcc} calls. +You can find possible options in the \l{rcc}{rcc documentation}. + +\section1 Examples + +\snippet cmake-macros/examples.cmake qt_add_binary_resources +*/ + +/*! +\page qt_generate_moc.html +\ingroup cmake-macros-qtcore + +\title qt_generate_moc +\target qt6_generate_moc + +\brief Calls moc on an input file. + +\section1 Synopsis + +\badcode +qt_generate_moc(src_file dest_file + [TARGET target]) +\endcode + +\versionlessCMakeCommandsNote qt6_generate_moc() + +\section1 Description + +Creates a rule to call the \l{moc}{Meta-Object Compiler (moc)} on \c src_file +and store the output in \c dest_file. + +\note This is a low-level macro. See the \l{CMake AUTOMOC Documentation} for a +more convenient way to let source files be processed with \c{moc}. +\l qt_wrap_cpp is also similar, but automatically generates a temporary file +path for you. + +\section1 Arguments + +You can set an explicit \c{TARGET}. This will make sure that the target +properties \c{INCLUDE_DIRECTORIES} and \c{COMPILE_DEFINITIONS} are also used +when scanning the source files with \c{moc}. + +\section1 Examples + +\snippet cmake-macros/examples.cmake qt_generate_moc +*/ + +/*! +\page qt_import_plugins.html +\ingroup cmake-macros-qtcore + +\title qt_import_plugins +\target qt6_import_plugins + +\brief Specifies a custom set of plugins to import for a static Qt build. + +\section1 Synopsis + +\badcode +qt_import_plugins(target + [INCLUDE plugin ...] + [EXCLUDE plugin ...] + [INCLUDE_BY_TYPE plugin_type plugin ...] + [EXCLUDE_BY_TYPE plugin_type]) +\endcode + +\versionlessCMakeCommandsNote qt6_import_plugins() + +\section1 Description + +Specifies a custom set of plugins to import. The optional arguments: +\c INCLUDE, \c EXCLUDE, \c INCLUDE_BY_TYPE, and \c EXCLUDE_BY_TYPE, +can be used more than once. + +\list +\li \c INCLUDE -- can be used to specify a list of plugins to import. +\li \c EXCLUDE -- can be used to specify a list of plugins to exclude. +\li \c INCLUDE_BY_TYPE -- can be used to override the list of plugins to + import for a certain plugin type. +\li \c EXCLUDE_BY_TYPE -- can be used to specify a plugin type to exclude; + then no plugins of that type are imported. +\endlist + +Qt provides plugin types such as \c imageformats, \c platforms, +and \c sqldrivers. + +If the command isn't used the target automatically links against +a sane set of default plugins, for each Qt module that the target is linked +against. For more information, see +\l{CMake target_link_libraries Documentation}{target_link_libraries}. + +Each plugin comes with a C++ stub file that automatically +initializes the plugin. Consequently, any target that links against a plugin +has this C++ file added to its \c SOURCES. + +\note This command imports plugins from static Qt builds only. +On shared builds, it does nothing. + +\section1 Examples + +\snippet cmake-macros/examples.cmake qt_import_plugins + +In the snippet above, the following occurs with the executable \c myapp: + +\list +\li The \c Qt6::QCocoaIntegrationPlugin is imported into myapp. +\li The \c Qt6::QMinimalIntegrationPlugin plugin is + excluded from being automatically imported into myapp. +\li The default list of plugins for \c imageformats is + overridden to only include Qt6::QGifPlugin and Qt6::QJpegPlugin. +\li All \c sqldrivers plugins are excluded from automatic importing. +\endlist +*/ + +/*! +\page qt_add_executable.html +\ingroup cmake-macros-qtcore + +\title qt_add_executable +\target qt6_add_executable + +\brief Creates and finalizes an application target of a platform-specific type. + +\preliminarycmakecommand + +\section1 Synopsis + +\badcode +qt_add_executable(target + [WIN32] [MACOSX_BUNDLE] + [MANUAL_FINALIZATION] + sources...) +\endcode + +\versionlessCMakeCommandsNote qt6_add_executable() + +\section1 Description + +This command performs the following tasks: + +\list +\li Create a CMake target of the appropriate type for the target platform. +\li Link the target to the \c{Qt::Core} library. +\li Handle finalization of the CMake target. +\endlist + +\section2 Target Creation + +On all platforms except Android, an executable target will be created. +All arguments will be passed through to the standard CMake \c{add_executable()} +command, except \c{MANUAL_FINALIZATION} (if present). On Android, a \c{MODULE} +library will be created and any \c{WIN32} or \c{MACOSX_BUNDLE} options will be +ignored. Some target properties will also be set for Android: + +\list +\li The \c{SUFFIX} target property will be set to give the library file name an + architecture-specific suffix. +\li Various \c{_VISIBILITY_PRESET} target properties will be set to + \c{default} to ensure that the \c{main()} function is visible in the + resultant binary. +\endlist + +\section2 Linking Qt::Core + +Since all Qt applications need to link to the \c{Qt::Core} library, this is done +for you as a convenience. + +\section2 Finalization + +After a target is created, further processing or \e{finalization} steps are +commonly needed. The steps to perform depend on the platform and on various +properties of the target. The finalization processing is implemented by the +\l{qt6_finalize_target}{qt_finalize_target()} command. + +Finalization can occur either as part of this call or be deferred to sometime +after this command returns (but it should still be in the same directory scope). +When using CMake 3.19 or later, finalization is automatically deferred to the +end of the current directory scope. This gives the caller an opportunity to +modify properties of the created target before it is finalized. When using +CMake versions earlier than 3.19, automatic deferral isn't supported. In that +case, finalization is performed immediately before this command returns. + +Regardless of the CMake version, the \c{MANUAL_FINALIZATION} keyword can be given to +indicate that you will explicitly call \l{qt6_finalize_target}{qt_finalize_target()} +yourself instead at some later time. In general, \c MANUAL_FINALIZATION should +not be needed unless the project has to support CMake 3.18 or earlier. + +\sa {qt6_finalize_target}{qt_finalize_target()} + +\section1 Examples + +In the following simple case, finalization is handled automatically. If using a +CMake version earlier than 3.19, finalization will be performed immediately as +part of the call. When using CMake 3.19 or later, finalization will occur at the +end of the current directory scope. + +\snippet cmake-macros/examples.cmake qt_add_executable_simple + +The following example shows a scenario where finalization must be deferred. +The \c OUTPUT_NAME target property affects deployment settings on Android, but +those settings are written out as part of finalizing the target. In order to +support using CMake versions earlier than 3.19, we take over responsibility +for finalizing the target by adding the \c{MANUAL_FINALIZATION} keyword. + +\snippet cmake-macros/examples.cmake qt_add_executable_deferred +*/ + +/*! +\page qt_finalize_target.html +\ingroup cmake-macros-qtcore + +\title qt_finalize_target +\target qt6_finalize_target + +\brief Handles various common platform-specific tasks associated with Qt targets. + +\preliminarycmakecommand + +\section1 Synopsis + +\badcode +qt_finalize_target(target) +\endcode + +\versionlessCMakeCommandsNote qt6_finalize_target() + +\section1 Description + +After a target is created, further processing or \e{finalization} steps are +commonly needed. The steps to perform depend on the platform and on various +properties of the target. These steps are expected to be performed within the +same directory scope as the one in which the \c{target} was created, so this +command should also be called from that same directory scope. + +This command implements the following, as appropriate for the platform and +target provided: + +\list +\li When targeting Android, generate a deployment settings file for the target. +\li Create a build target for generating an APK if building for Android. +\endlist + +This command is ordinarily invoked as part of a call to +\l{qt6_add_executable}{qt_add_executable()}. The timing of when that call takes +place and when it might need to be called explicitly by a project is discussed +in the documentation of that command. +*/ + +/*! +\page qt_android_apply_arch_suffix.html +\ingroup cmake-macros-qtcore + +\title qt_android_apply_arch_suffix +\target qt6_android_apply_arch_suffix + +\brief Configures the target binary's name to include an architecture-specific suffix. + +\preliminarycmakecommand +\cmakecommandandroidonly + +\section1 Synopsis + +\badcode +qt_android_apply_arch_suffix(target) +\endcode + +\versionlessCMakeCommandsNote qt6_android_apply_arch_suffix() + +\section1 Description + +The CMake \c{SUFFIX} target property controls the suffix used on the file name +of the target's built binary. This command is a convenience for setting that +property to an architecture-specific value. This is useful when installing +multiple builds for different Android architectures into the same install +location, as it prevents the libraries for different architectures from +overwriting each other. +*/ + +/*! +\page qt_android_generate_deployment_settings.html +\ingroup cmake-macros-qtcore + +\title qt_android_generate_deployment_settings +\target qt6_android_generate_deployment_settings + +\brief Generates the deployment settings file needed by androiddeployqt. + +\preliminarycmakecommand +\cmakecommandandroidonly + +\section1 Synopsis + +\badcode +qt_android_generate_deployment_settings(target) +\endcode + +\versionlessCMakeCommandsNote qt6_android_generate_deployment_settings() + +\section1 Description + +The \c{androiddeployqt} tool expects a deployment settings file as input. This +command reads CMake variables and properties of the \c{target} to generate such +a file in the target's binary directory. Upon return, the full path to this file +is available in the target's \c{QT_ANDROID_DEPLOYMENT_SETTINGS_FILE} property. + +\section2 CMake Variables + +A number of variables are used while generating the deployment settings file. +Some are provided by Qt, others by CMake or the Android NDK. + +\list +\li \l{cmake-variable-ANDROID_NDK_HOST_SYSTEM_NAME}{ANDROID_NDK_HOST_SYSTEM_NAME} +\li \l{cmake-variable-ANDROID_SDK_ROOT}{ANDROID_SDK_ROOT} +\li \c{CMAKE_ANDROID_ARCH_ABI} +\li \c{CMAKE_ANDROID_NDK} +\li \c{CMAKE_SYSROOT} +\li \l{cmake-variable-QT_ANDROID_APPLICATION_ARGUMENTS}{QT_ANDROID_APPLICATION_ARGUMENTS} +\li \l{cmake-variable-QT_HOST_PATH}{QT_HOST_PATH} +\endlist + +\section2 Target Properties + +The properties below will be read from the specified \c{target}. Note that this +command is called as part of target finalization (see +\l{qt6_finalize_target}{qt_finalize_target()}). If you are using +\l{qt6_add_executable}{qt_add_executable()} to create the target and you need to +modify some of these target properties, you need to ensure that target +finalization is deferred. See \l{qt6_add_executable}{qt_add_executable()} for +how to accomplish this. + +\list +\li \l{cmake-target-property-QT_ANDROID_DEPLOYMENT_DEPENDENCIES}{QT_ANDROID_DEPLOYMENT_DEPENDENCIES} +\li \l{cmake-target-property-QT_ANDROID_EXTRA_LIBS}{QT_ANDROID_EXTRA_LIBS} +\li \l{cmake-target-property-QT_ANDROID_EXTRA_PLUGINS}{QT_ANDROID_EXTRA_PLUGINS} +\li \l{cmake-target-property-QT_ANDROID_MIN_SDK_VERSION}{QT_ANDROID_MIN_SDK_VERSION} +\li \l{cmake-target-property-QT_ANDROID_PACKAGE_SOURCE_DIR}{QT_ANDROID_PACKAGE_SOURCE_DIR} +\li \l{cmake-target-property-QT_ANDROID_TARGET_SDK_VERSION}{QT_ANDROID_TARGET_SDK_VERSION} +\li \l{cmake-target-property-QT_ANDROID_VERSION_NAME}{QT_ANDROID_VERSION_NAME} +\li \l{cmake-target-property-QT_ANDROID_VERSION_CODE}{QT_ANDROID_VERSION_CODE} +\li \l{cmake-target-property-QT_QML_IMPORT_PATH}{QT_QML_IMPORT_PATH} +\li \l{cmake-target-property-QT_QML_ROOT_PATH}{QT_QML_ROOT_PATH} +\li \l{cmake-target-property-qt_no_entrypoint}{qt_no_entrypoint} +\endlist + +Upon return, the \c{QT_ANDROID_DEPLOYMENT_SETTINGS_FILE} target property will +contain the location of the generated deployment settings file. + +\sa {qt6_android_add_apk_target}{qt_android_add_apk_target()}, + {qt6_finalize_target}{qt_finalize_target()} + +\section1 Example + +\snippet cmake-macros/examples.cmake qt_android_deploy_basic +*/ + +/*! +\page qt_android_add_apk_target.html +\ingroup cmake-macros-qtcore + +\title qt_android_add_apk_target +\target qt6_android_add_apk_target + +\brief Defines a build target that runs androiddeployqt to produce an APK. + +\preliminarycmakecommand +\cmakecommandandroidonly + +\section1 Synopsis + +\badcode +qt_android_add_apk_target(target) +\endcode + +\versionlessCMakeCommandsNote qt6_android_add_apk_target() + +\section1 Description + +The \c{_make_apk} custom target created by this command takes an Android +deployment settings file and generates an APK by running \c{androiddeployqt}. +The location of the settings file is taken from the \c{target}'s +\c{QT_ANDROID_DEPLOYMENT_SETTINGS_FILE} property. This file is typically created by +\l{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}. +The \c{.apk} file will be generated in an \c{android-build} subdirectory below +the CMake build directory of the \c{target}. + +The \c{_make_apk} target will be automatically added as a dependency of +the \c{apk} build target, which will be created if it doesn't already exist. +This can be disabled by setting the \c{QT_NO_GLOBAL_APK_TARGET} variable to true. + +\sa {qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}, + {qt6_finalize_target}{qt_finalize_target()} + +\section1 Example + +\snippet cmake-macros/examples.cmake qt_android_deploy_basic + +The above commands define the build targets \c{myapp_make_apk} and \c{apk}, +which can be used to generate just the \c{myapp} APK or all APKs in the project +respectively. +*/ diff --git a/src/corelib/doc/src/cmake/cmake-properties.qdoc b/src/corelib/doc/src/cmake/cmake-properties.qdoc new file mode 100644 index 0000000000..9627187bec --- /dev/null +++ b/src/corelib/doc/src/cmake/cmake-properties.qdoc @@ -0,0 +1,317 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page cmake-target-property-QT_ANDROID_DEPLOYMENT_DEPENDENCIES.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_ANDROID_DEPLOYMENT_DEPENDENCIES +\target cmake-target-property-QT_ANDROID_DEPLOYMENT_DEPENDENCIES + +\brief Overrides the Qt dependencies added to the target's deployment. + +\preliminarycmakeproperty +\cmakepropertyandroidonly + +By default, \l androiddeployqt will detect the dependencies of your +application. However, since run-time usage of plugins cannot be detected, +there could be false positives, as your application might depend on any +plugin that is a potential dependency. If you want to minimize the size of +your \c APK, it's possible to override the automatic detection using this +property. This should contain a list of all Qt files which need to be +included, with paths relative to the Qt install root. + +\note Only the Qt files specified with this variable are included. Failing +to include all the correct files can result in crashes. It's also important +to make sure the files are listed in the correct loading order. This variable +provides a way to override the automatic detection entirely, so if a library +is listed before its dependencies, it will fail to load on some devices. + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} +*/ + +/*! +\page cmake-target-property-QT_ANDROID_EXTRA_LIBS.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_ANDROID_EXTRA_LIBS +\target cmake-target-property-QT_ANDROID_EXTRA_LIBS + +\brief Extra libraries to deploy with the target. + +\preliminarycmakeproperty +\cmakepropertyandroidonly + +A list of external libraries that will be copied into your application's +\c libs folder and loaded on start-up. This can be used, for instance, +to enable OpenSSL in your application. For more information, see +\l{Adding OpenSSL Support for Android}. + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} +*/ + +/*! +\page cmake-target-property-QT_ANDROID_EXTRA_PLUGINS.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_ANDROID_EXTRA_PLUGINS +\target cmake-target-property-QT_ANDROID_EXTRA_PLUGINS + +\brief Extra Qt plugins to deploy with the target. + +\preliminarycmakeproperty +\cmakepropertyandroidonly + +Specifies a path to C++ plugins or resources that your application has to bundle +but that cannot be delivered through the assets system, such as QML plugins. +With this variable, \l androiddeployqt will make sure everything is packaged +and deployed properly. + +\c QT_ANDROID_EXTRA_PLUGINS must point to the directory where the extra plugin(s) +are built. In addition, the build directory structure must follow a naming +convention similar to Qt plugins, that is, \e {plugins/}. +\c QT_ANDROID_EXTRA_PLUGINS should point to the \e {plugins} part of that path. + +The plugins libraries should have the name format +\e {libplugins___.so}. This will ensure that the correct name +mangling is applied to the plugin library. +\omit +TODO: Not yet documented, API still under review - see QTBUG-88763 +See the \l{qt6_add_plugin}{qt_add_plugin()} command for the easiest way to achieve +that. +\endomit + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} +*/ + +/*! +\page cmake-target-property-QT_ANDROID_MIN_SDK_VERSION.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_ANDROID_MIN_SDK_VERSION +\target cmake-target-property-QT_ANDROID_MIN_SDK_VERSION + +\brief Minimum Android SDK version. + +\preliminarycmakeproperty +\cmakepropertyandroidonly + +Specifies the minimum Android API level for the target. + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} +*/ + +/*! +\page cmake-target-property-QT_ANDROID_PACKAGE_SOURCE_DIR.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_ANDROID_PACKAGE_SOURCE_DIR +\target cmake-target-property-QT_ANDROID_PACKAGE_SOURCE_DIR + +\brief Path to a custom Android package template. + +\preliminarycmakeproperty +\cmakepropertyandroidonly + +Specifies the path for a custom Android package template. The Android package +template contains: +\list + \li AndroidManifest.xml file + \li build.gradle file and other Gradle scripts + \li res/values/libs.xml file +\endlist + +The path specified by this variable can contain custom Java classes under +\c src directory. By default, the \l androiddeployqt tool copies the +application template from the Qt for Android installation path into your +project's build directory, then it copies the contents of the path specified +by this variable on top of that, overwriting any existing files. For +instance, you can make a custom \c {AndroidManifest.xml} for your application, +then place this directly into the directory specified by this variable. + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} +*/ + +/*! +\page cmake-target-property-QT_ANDROID_TARGET_SDK_VERSION.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_ANDROID_TARGET_SDK_VERSION +\target cmake-target-property-QT_ANDROID_TARGET_SDK_VERSION + +\brief Android target SDK version. + +\preliminarycmakeproperty +\cmakepropertyandroidonly + +Specifies the target Android API level for the target. + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} +*/ + +/*! +\page cmake-target-property-QT_ANDROID_VERSION_CODE.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_ANDROID_VERSION_CODE +\target cmake-target-property-QT_ANDROID_VERSION_CODE + +\brief Internal Android app version. + +\preliminarycmakeproperty +\cmakepropertyandroidonly + +Specifies the app's version number. This is usually a number that +increments monotonically with each release of your project. + +For more information, see \l{Android: App Versioning}{Android App Versioning}. + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} +*/ + +/*! +\page cmake-target-property-QT_ANDROID_VERSION_NAME.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_ANDROID_VERSION_NAME +\target cmake-target-property-QT_ANDROID_VERSION_NAME + +\brief Human-readable Android app version. + +\preliminarycmakeproperty +\cmakepropertyandroidonly + +Specifies the app's version as a human readable string, usually three +numbers, separated by dots. + +For more information, see \l{Android: App Versioning}{Android App Versioning}. + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} +*/ + +/*! +\page cmake-target-property-QT_QML_ROOT_PATH.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_QML_ROOT_PATH +\target cmake-target-property-QT_QML_ROOT_PATH + +\brief Overrides the location of the application's qml directory. + +\preliminarycmakeproperty + +This property is currently only used when generating a deployment settings file +for Android. If the property is set, it specifies the path to the application's +\c{qml} directory. If it is not set, the \c{SOURCE_DIR} property of the target +will be used instead. + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} +*/ + +/*! +\page cmake-target-property-QT_QML_IMPORT_PATH.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_QML_IMPORT_PATH +\target cmake-target-property-QT_QML_IMPORT_PATH + +\brief Specifies a list of directories to search for QML imports. + +\preliminarycmakeproperty + +This property is currently only used when generating a deployment settings file +for Android. It typically contains just the path to Qt's \c{qml} directory, but +it can be a list that contains other locations to be searched as well. +For application-specific QML imports, use +\l{cmake-target-property-QT_QML_ROOT_PATH}{QT_QML_ROOT_PATH} instead. + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} +*/ + +/*! +\page cmake-target-property-QT_ANDROID_DEPLOYMENT_SETTINGS_FILE.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_ANDROID_DEPLOYMENT_SETTINGS_FILE +\target cmake-target-property-QT_ANDROID_DEPLOYMENT_SETTINGS_FILE + +\brief Specifies the location of a target's generated deployment settings file. + +\preliminarycmakeproperty +\cmakepropertyandroidonly + +This property will be set by +\l{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}. +Projects should not try to set this property themselves, as it will be ignored +and overwritten by that command. +*/ + +/*! +\page cmake-target-property-qt_no_entrypoint.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title qt_no_entrypoint +\target cmake-target-property-qt_no_entrypoint + +\brief Specifies to inhibit linking against Qt's entrypoint lib. + +\preliminarycmakeproperty + +On certain platforms, Qt applications link against Qt's entrypoint lib by default. +That library provides implementations of main (or WinMain). + +On targets that must provide their own entry point, set the property \c qt_no_entrypoint to inhibit linking against Qt's entrypoint library. +*/ + +/*! +\page cmake-target-property-qt_resource_prefix.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_RESOURCE_PREFIX +\target cmake-target-property-QT_RESOURCE_PREFIX + +\brief Specifies the default Qt resource prefix. + +\preliminarycmakeproperty + +When using \l{qt6_add_resources}{qt_add_resources} without a \c PREFIX +argument, then the value of this target property will be used as +resource prefix. +*/ diff --git a/src/corelib/doc/src/cmake/cmake-variables.qdoc b/src/corelib/doc/src/cmake/cmake-variables.qdoc new file mode 100644 index 0000000000..d3f73ab918 --- /dev/null +++ b/src/corelib/doc/src/cmake/cmake-variables.qdoc @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page cmake-variable-ANDROID_NDK_HOST_SYSTEM_NAME.html +\ingroup cmake-variables +\ingroup cmake-variables-qtcore + +\title ANDROID_NDK_HOST_SYSTEM_NAME +\target cmake-variable-ANDROID_NDK_HOST_SYSTEM_NAME + +\brief Android-specific architecture of the host system. + +\preliminarycmakevariable +\cmakevariableandroidonly + +This is normally set by the Android NDK toolchain file. It is written out as +part of the deployment settings for a target. + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} +*/ + +/*! +\page cmake-variable-ANDROID_SDK_ROOT.html +\ingroup cmake-variables +\ingroup cmake-variables-qtcore + +\title ANDROID_SDK_ROOT +\target cmake-variable-ANDROID_SDK_ROOT + +\brief Location of the Android SDK. + +\preliminarycmakevariable +\cmakevariableandroidonly + +This specifies the location of the Android SDK when building for the Android platform. +It is written out as part of the deployment settings for a target. + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}. +*/ + +/*! +\page cmake-variable-QT_ANDROID_APPLICATION_ARGUMENTS.html +\ingroup cmake-variables +\ingroup cmake-variables-qtcore + +\title QT_ANDROID_APPLICATION_ARGUMENTS +\target cmake-variable-QT_ANDROID_APPLICATION_ARGUMENTS + +\brief List of arguments to pass to Android applications. + +\preliminarycmakevariable +\cmakevariableandroidonly + +This contains a list of arguments to be passed to Android applications. It is written +out as part of the deployment settings for a target. + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} +*/ + +/*! +\page cmake-variable-QT_HOST_PATH.html +\ingroup cmake-variables +\ingroup cmake-variables-qtcore + +\title QT_HOST_PATH +\target cmake-variable-QT_HOST_PATH + +\brief Location of the host Qt installation when cross-compiling. + +\preliminarycmakevariable + +When cross-compiling, this must be set to the install location of Qt for the host +platform. It is used to locate tools to be run on the host (\l{moc}, \l{rcc}, +\l{androiddeployqt}, and so on). +*/ -- cgit v1.2.3