Commit Graph

11 Commits

Author SHA1 Message Date
Lucie Gérard
32df595275 Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-23 23:58:42 +02:00
Joerg Bornemann
55af91f822 CMake: Put Qt-internal targets into a dedicated FOLDER
When loading a Qt CMake project in an IDE like Visual Studio, many
Qt-internal targets are visible, right next to the user's targets.  This
is inconvenient and confusing.

Use CMake's FOLDER concept, and put Qt-internal targets into a dedicated
FOLDER.

For that we introduce the new global property QT_TARGETS_FOLDER that,
analoguous to AUTOGEN_TARGETS_FOLDER, is the folder name for Qt-internal
targets.  By default, it's not set, nor is folder support enabled.

Change qt_standard_project_setup() to
- enable folder support
- initialize QT_TARGETS_FOLDER if unset
- initialize AUTOGEN_TARGETS_FOLDER to the same value if unset

Set the FOLDER property of qtbase's internal targets for user projects
to the value of QT_TARGETS_FOLDER.

Task-number: QTBUG-99808
Change-Id: I880ac7731f88faa83a384dcdec98b1b88ac6cc2e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-11 13:47:15 +02:00
Lucie Gérard
fb1b20eab3 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-03 17:14:55 +02:00
Alexandru Croitor
38354d7d61 Rename / prefix all our private API functions with qt_
Rename internal APIs like extend_target to qt_extend_target.
Prefix apis with qt_ where required.

Keep old names for compatibility until all their usages are removed.

Change-Id: I9a13515a01857257a4c5be3a89253749d46a4f41
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-14 09:05:33 +00:00
Jean-Michaël Celerier
d1542e8a73 Match qt_import_plugin API with qt5's
Some work was needed to make the plug-in types,
and which plug-ins are available for each type
in client code.

Change-Id: Ib71feca31069deca3d3f54c8613054f5f8ae410c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-09 09:05:39 +00:00
Simon Hausmann
73ba2ba2de Simplify resource embedding for qml modules
* Add support for a QT_RESOURCE_PREFIX target property, that
      add_qt_resource respects. This makes it convenient to add files
      to the resource system for a project without the need to repeat
      prefixes. In qmake land with multiple resources they're repeated
      in the foo.prefix variables or in the prefix attribute in .qrc
      files.

    * Since /qt-project.org/imports is in the default QML import search path
       and the hierarchy under the import search paths is "regulated",
       we might as well make add_qml_module set QT_RESOURCE_PREFIX on
       the target. We can compute the correct value for that. This
       allows removing the redundant prefix from the add_qt_resource()
       calls for the qml files.

Change-Id: Ic15130dc9e432340fc3edf93e35f2a803b4b40eb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-08-09 11:47:25 +00:00
Leander Beernaert
97b76704ea Refactor QML_FILES for add_qml_module
It has been decided, that going forward all qml files are to be added
to a module via the resource system. This patch does the ground work
to make sure all qml modules in the qt codebase follow these new
conventions.

New properties on targets have been added so that we can't track all the
qml related information for later use.

To make sure it is still possible to install qml files we added the
qt_install_qml_files() command.

Pro2cmake has been adjusted to handle the special cases of versioned
qml modules (e.g: QtQuick.2). It will now insert a TARGET_PATH
override to avoid the default conversion from the URI parameter.

Finally, this patch temporarliy disables the quick compiler by moving
all relevant code into a dummy function. This will be removed in a
follow up patch where the quick compiler will be enable for all
qml files present in resource files.

Change-Id: I09fe4517fad26ec96122d9c7c777dbfbd214905c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-01 14:07:01 +00:00
Jean-Michaël Celerier
a5b78a3660 cmake: implement default qpa plugin behavior for static builds
This is done by adding a DEFAULT_IF argument to add_qt_plugin, which accepts
if-evaluated expressions.

e.g.

    add_qt_plugin(myplugin
	DEFAULT_IF ${foo} STREQUAL ${bar}
        ...
    )

so that this mechanism can be reused later if necessary.

Change-Id: I7eba9adaaa28e55a4f0f94cf206e868b990027e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-05 14:58:52 +00:00
Leander Beernaert
152b22a7b0 Android: Generate deployment-settings.json
Generate the android deployment settings json for android apk
targets. QtPlatformAndroid is now also deployed as a public
build dependency of QtCore. Some minor refactoring has been
performed to the naming of variables and functions to
better match the public facing apis.

Extra settings for the file can be configured using the
following target properties:

set_target_properties(Core
    PROPERTIES QT_ANDROID_DEPLOYMENT_DEPENDENCIES "foo;bar"
    QT_ANDROID_EXTRA_LIBS "foo;bar"
    QT_ANDROID_EXTRA_PLUGINS "foo;bar"
    QT_ANDROID_PACKAGE_SOURCE_DIR "/foo/bar/"
    )

The file is generated using the function
qt_android_generate_depoyment_settings().

We need to install the android template files and jar
files during the android build as the androiddeployqt tool
wont work if parts of it are split between the host
install and the android install.

Added QT_BUILD_QT variable to check whether we are building
Qt from source.

Finally, we also force the stdlib to shared via cmake
configuration with -DANDROID_STL="c++_shared"

Change-Id: I063c47e11749d56ba4c6f02101dbcc09e1b9fe87
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-12 07:21:01 +00:00
Jean-Michaël Celerier
fecd9d90da Fix static usage requirements for XcbQpa
In particular, Qt targets extended with other qt targets
(eg. Qt::VulkanSupport or Qt::LinuxAccessibilitySupport)
after the first add_qt_module were not taken into account when generating
Depends files.

Note that this patch updates the minimum required version
to CMake 3.15

Change-Id: I747deedd4d59e385876bc1a834ef9bdb6078911b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 08:53:34 +00:00
Jean-Michaël Celerier
0900298d46 cmake: register plug-ins, create dependencies file
This commit introduces infrastructure work to allow static builds of Qt
to handle importing of plug-ins.

Change-Id: Ife0ca3ca7276ea8ec96fe0eb6adf934fad7620ec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 10:08:07 +00:00