Commit Graph

332 Commits

Author SHA1 Message Date
Simon Hausmann
db61770566 Fix CMake errors around linker flags when targeting WASM
* The -no-undefined linker option only makes sense for shared
      libraries. The WASM build is a static build though.

    * The -gc-sections linker option is only relevant for host tools
      and certainly applicable to the WASM toolchain.

Change-Id: Ib8daec66a6d80f5025887448882dd891e6176268
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 13:23:59 +00:00
Simon Hausmann
4e5fc66c04 Fix architecture detection with WASM builds
This is a simple mis-understanding between try_compile assuming interest
in the launching part of the thing we try to compile and our
architecture test being interested in the binary.

Change-Id: Ie972b662b6f34699f566649bb2c1e29da35b58c3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 13:23:50 +00:00
Leander Beernaert
add4c4816c Add missing qml-root-path for Android
Add missing qml root path variable in the deployment configuration file.
Not having this variable will cause androiddeployqt not use the
qml dependency scanner to package all relevant dependencies.

This patch also fixes QT_ANDROID_BUNDLED_FILES files not being
processed.

Change-Id: I5bca33cdbb57098f283b38516b777571806da9e5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 12:29:12 +00:00
Alexandru Croitor
486da5a84d Fix qt_get_module_for_plugin to work with interface libraries
Assume that interface libraries can't have plugins for now, otherwise
we'll need to change the "MODULE_PLUGIN_TYPES" property name to
include INTERFACE_ as a prefix.

Change-Id: I21b64179ded5fd10216d843a21ee149e002793f3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-28 11:15:00 +00:00
Leander Beernaert
4260b1edc5 Add OUPUT_DIRECTORY option to add_qt_test
From all the observed cases, the parameters given to OUTPUT_DIRECTORY
tend to be CMAKE_CURRENT_BINARY_DIR, which was the default value. This
change is mainly to avoid add_qt_test failing if OUTPUT_DIRECTORY is
specified.

Change-Id: I26b931dd33ad1e991b64c14cc11b4b7a713fc858
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-26 09:39:47 +00:00
Leander Beernaert
753e7c1061 Do not use quick compiler with embedded test data
Prevent the quick compiler running on embedded test data for platforms
such as Android. This breaks certain assumptions about the test setup
otherwise.

Change-Id: I1026da3e16552256623de26b843ea32ed2c4260e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-23 13:50:49 +00:00
Leander Beernaert
acdc5dfaee Skip emebedding test data when there is no target
On android test data is embedded into to the binary via resources. This
will not work with sourceless tests such as the qml only test cases.

Change-Id: I3ecf28223b3c7c6dae4ca3f15519adc028082598
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-08-23 09:31:39 +00:00
Leander Beernaert
8b800dc384 Link against Qml when using quick compiler
When using the quick compiler to compile qml files, add an explicit
dependency on Qml. This will result in linker errors otherwise.

Change-Id: Ib7af0e8ec1b48822fd0d3c3556f10d24f10e7489
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-23 09:31:29 +00:00
Alexandru Croitor
54aeb4ccd7 Add support for Qt header_modules aka a header only INTERFACE library
Also add support for modules that have no private module counterpart.

Both are needed for Designer's QtUiPlugin in qttools.

Change-Id: Ia7e9d8837140e1de5cd59e196b4f63481ab68298
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-08-23 09:26:16 +00:00
Alexandru Croitor
0575f6b360 Add some clarifying documentation in QtPostProcess
Specifically what each of the list variables in
qt_internal_create_module_depends_file is used for.

Change-Id: Ie4f8c0d7387308518932d37e802ecaeb0572b955
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2019-08-23 09:25:59 +00:00
Alexandru Croitor
d9070833d5 Fix creation of ModuleDepends header file with correct dependencies
The content of the generated header files should reference both public
and private Qt module dependencies. This is the same as what qmake
does.

Change-Id: I2e47c93291d677b86af7bb80fb788b2acf939743
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-08-23 09:25:48 +00:00
Alexandru Croitor
bb2d1f8119 Abstract and fix usages of QT_KNOWN_MODULES
In some places of the build system we need to iterate over repo specific
Qt known modules (aka the ones that are built in the current project).
In other places we need to iterate over the whole list of known Qt
modules (those found via find_package + the ones built in the
current project).

Introduce two separate functions that provide access to either the
former or latter, and adjust all existing usages of QT_KNOWN_MODULES as
needed.

Change-Id: Ica96d0cfe690b9aaaa3f8c53bc84975bccad69c7
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2019-08-23 09:25:37 +00:00
Leander Beernaert
46603d655d Replace invalid symbols with underscore
When building tests for android some resources names had the "#"
character in them which triggered a CMake error when use in conjunction
with add_custom_target()

Change-Id: If5f471eebb027683e86b0c4e38c2f34ff8891b7a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-22 13:49:58 +00:00
Leander Beernaert
24bdc6e156 Fix missing prefix for test data on android
Add missing required resource prefix to add_qt_resource() call when
embedding test data as a resource.

Change-Id: I9130f9ae863daae80221a1475b077b1d2e501f6d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-22 13:49:33 +00:00
Leander Beernaert
7a1853dbe2 Extract add_qt_resource into reusable components
This patch moves all of the underlying code for add_qt_resource
into a common reusable snippet for both the Qt build and user projects.

For users, the new API is available under QT5_ADD_RESOURCES. If
outfiles is a CMAKE target we will use the new API, otherwise
we will fall back to the old behavior.

This patch also adds EXTRA_CMAKE_FILES and EXTRA_CMAKE_INCLUDES to
add_qt_module so that module specific cmake files can be installed
and loaded by the module's config.cmake.

The code will be installed under CMAKE_BINARY_DIR/Qt{}CoreResource.cmake
and is injected into Qt{}Core_Config.cmake via the extra cmake includes
passed into add_qt_module.

To make sure it still works with QtBuild, we do the actual generation
of the file from QtBaseGlobalTargets and include the generated file
there as well.

Change-Id: I85fefaa11dde01a6790d23c62d6a64cd157e2617
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-22 09:47:01 +00:00
Leander Beernaert
3cb9ee3a5b Fix Android build for other Qt modules
Install missing QtBuildInternalsAndroid to installation path.

Change-Id: I6141ff72b57a6445f1718bc17d64a7ed59a91620
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-16 15:58:38 +00:00
Leander Beernaert
87a6283fbb Fix QT_WILL_BUILD_TOOLS evaluation
This condition was not being properly evaluated since the cached variable
was treated as a string. Any checks with if(QT_WILL_BUILD_TOOLS) would
just verify whether the string was empty or not.

Change-Id: Ie8b9ecc8249a1e9f5c0aa1b13d5bef686fcb04de
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-16 11:39:18 +00:00
Alexandru Croitor
1291e8d094 Fix developer warnings that a plugin does not belong to a Qt module
When building qtsvg or qtimageformats there are a bunch of
configuration warnings like:

The plug-in 'qtiff' does not belong to any Qt module.

This happens because qt_get_module_for_plugin() checks for modules
only in the QT_KNOWN_MODULES variable. find_package()'d modules
will not appear there though, but only in
QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE.

Change the function to check for Qt modules in both variables.
This fixes all the warnings regarding plugins not belonging to a
module.

Change-Id: I39e668801a93794b62888cf868b97c55f57dccdd
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-16 07:28:53 +00:00
Alexandru Croitor
4572ded8b3 Fix copying / installing of testdata to proper location
I don't know why, but previously the test data was copied to
"test_build_dir/testdata" subfolder. That's incorrect, there's no
need for a testdata subfolder, the copied / installed contents
should go directly under the test build dir / install dir.

Incidentally this will make the corelib/io/qdir tests to pass.

Amends 1307736c7d .

Change-Id: I9e180d608433fe82f4a29afea7f594507e6020d3
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-15 10:56:16 +00:00
Alexandru Croitor
b8dae2c617 Handle test helpers better
Teach pro2cmake to use add_qt_test_helper instead of
add_qt_executable when the qmake 'qt_test_helper' feature is used.

Don't use macOS bundles when building tests on macOS, because that
breaks path assumptions for certain tests.

Introduce a new OVERRIDE_OUTPUT_DIRECTORY option for add_qt_test_helper
that allows placing the binary into a folder other than the test parent
folder. I considered changing the default behavior not to place into the
parent folder, but that would break all existing tests, so I opted for
override approach instead. Ultimately we might want to revisit this
later.



Change-Id: I68fd1dea608333c2af0d3896050b40a6964dd87f
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-15 10:56:02 +00:00
Leander Beernaert
7fda42ef9a Rename alias property on source files to QT_RESOURCE_ALIAS
Rename the alias property used by add_qt_resource() to QT_RESOURCE_ALIAS
to match property naming conventions.

Change-Id: I97b12b0b794e158f03dabeed5ec23a3b7d56cfbb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-15 09:34:09 +00:00
Leander Beernaert
8630c5ac7e Add support for QtQuikCompiler retained resources
Support translating the QTQUICK_COMPILER_RETAINED_RESOURCES variable.

Fix missing PROPERTIES keyword for set_source_files_properties() commands.

Apply source file properties to standalone source files as they appear
in the project as it was possible for them to inherit values that were
not meant for them.

When creating resource lists, prefix them with the resource name
to avoid collisions.

Change-Id: I69ef85ea9414c0e7c07b1ebfb76d24bd878ce70f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-14 12:45:11 +00:00
Leander Beernaert
723d5c5056 Fix QRC Resource paths for qrc files in subdirectories
When pro2cmake converts qrc files that are located in a subdirectory
there is an error in the resource paths for qrc files generated
with add_qt_resource().

For instance, consider the contents of data/scenegraph.qrc:
<RCC>
    <qresource prefix="/qt-project.org/scenegraph">
        <file>"shaders/24bittextmask.frag"</file>
    </qrsource>
<RCC>

After processing by pro2cmake and add_qt_resource() we generate
<RCC>
    <qresource prefix="/qt-project.org/scenegraph">
	<file alias="data/shaders/24bittextmask.frag">
            ${CMAKE_CURRENT_SOURCE_DIR}/data/shaders/24bittextmask.frag"
        </file>
    </qrsource>
<RCC>

The expected qrc path for the resource should be prefix/shaders/...,
but in CMake it becomes prefix/data/shaders/... due to the
BASE parameter.

To fix it we check whether BASE is set and whether there are no
other aliases present on the source file before setting an alias
with the original file path.

Change-Id: If0a68a5ffa787704b10b740e20f875c9029509b0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-14 11:44:58 +00:00
Leander Beernaert
b4bd6eaf92 Export architecture config test variables
Export the architecture configuration variables from QtBase. There are
other modules that require access to this information in order to
enable certain features (e.g: qml_jit in QtDeclarative).

Change-Id: If2c7f29ccb1c0b0a0db3d78ad133a2a6be12b5ad
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-14 07:32:18 +00:00
Leander Beernaert
0f268277c5 Add substituition rule to qt_internal_module_info
Added substituion rule to qt_internal_module_info to replace '.' with
'_'. Fixes compile errors for targets with names such as Plugin.2.

Change-Id: I0754c771bdc456a8a8f450fba90792c98d276c92
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-12 10:02:20 +00:00
Leander Beernaert
551e79f28a Install QtPlugins.cmake.in
Added rule to install missing QtPlugins.cmake.in.

Change-Id: I485dadd56ee2dd435406d97399b32dc6390cebff
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-12 10:01:58 +00:00
Leander Beernaert
b25260bac6 Change quick compiler generated code path
We now compile all qml files from the quick compiler in separate
directories qmlcache/${resource_name} to prevent issues where the same
qml file is present in more than one resource file.

Change-Id: I6857ff6aaaa21112896d5d39bbe11d3ffe524ec8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-12 09:01:35 +00:00
Leander Beernaert
6ef1b60b08 Fix QuickCompiler Setup Errors
If the variable resource_files existed in the parent scope, the list
would now be duplicate.

Fix case where TO_CMAKE_PATH didn't properly convert //Foo into /Foo,
so wee need to handle this manually.

Change-Id: I73f1b4db82f6a80ba00da928b39091ac6c968a02
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-09 14:12:37 +00:00
Simon Hausmann
95c27e325f Fix add_qt_resource behavior with regards to unspecified prefixes
This change makes the PREFIX parameter a required parameter if the
target does not specify a default. This way the behavior is clear when
reading the code: add_qt_resource() without PREFIX means it must come
frmo the target.

Change-Id: I79024e70e7b4d32a5164b93aa08ec9ff409b2d39
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2019-08-09 11:50:11 +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
Simon Hausmann
f55c6a4cb0 Remove unused parameters for add_qml_module
Change-Id: Ic7774aa401089061b153920e51537e1c2264ce4f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-08-09 11:47:13 +00:00
Leander Beernaert
7e84157117 Fix dependencies for source file generated through rcc
There was a missing dependency rule which would cause the generated cpp
file to not be updated when changes were made to a qrc file generated
through add_qt_resource().

Change-Id: I9544c2fb6cf49529913f731b8fb6fc524d65e40c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-09 11:29:50 +00:00
Simon Hausmann
8ba882a0b3 Add support for QTQUICK_COMPILER_SKIPPED_RESOURCES
Detect this in the conversion script and map it to a source file
property. When that's the case, avoid repeating the file list but
instead store it in a variable.

Change-Id: If3119d83914bb798766e27351746b4e867bd3ab3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-09 09:21:12 +00:00
Simon Hausmann
587581963e Minor variable naming cleanup
Change-Id: I47f07a22c356ca545052f63788756068a51c3e39
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-09 09:20:56 +00:00
Leander Beernaert
9c3af6ecb2 Fix sourceless qml test case
Minor tweaks to make sure QML test cases without source files work as
expected.

Change-Id: I30b72622692b8f36d01f7a17b9d1456b0ab223ea
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-09 08:23:38 +00:00
Leander Beernaert
2d48490940 Enable quick compiler for qml files in add_qt_resource
File passed into add_qt_resource are check to see if they match valid
qml files extension. Those which match the latter are then processed
by the qt quick compiler should the qmlcachegen target be present. We
also ensure that any remaining resources are properly chainloaded.

If the qmlcachegen target can't be located a warning be will be
issued asking for the inclusion of QmlTools in the find_package
command.

Change-Id: Ieecd38670e15c21d94dc549b31c7d87f2383d9af
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-09 07:33:55 +00:00
Alexandru Croitor
c894c224d1 Fix and streamline header inclusion
While trying to port qtgraphicaleffects, when trying to configure
the project with a non-prefix build, the configuration fails with
the following error:

CMake Error in src/effects/CMakeLists.txt:
  Imported target "Qt::Qml" includes non-existent path

 "../qt_cmake/qtdeclarative_built_developer/include"

This is because we incorrectly export public include directories
that point to an "/include" folder under the repo build dir, whereas
in a non-prefix build the syncqt "/include" folder is actually in the
qtbase build dir.

Fix this, by introducing a new variable called "foo_repo_include_dir"
which will point to the correct include directory regardles of prefix
or non-prefix build. This variable is set by qt_internal_module_info.

Fix all relevant places to use this new variable. Also streamline
and remove any unncessary include directories in all our functions,
thus making everything consistent and hopefully easier to understand.

Change-Id: Icbe884701275c7754daecadcdba18048b4d779d0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-08 15:45:32 +00:00
Leander Beernaert
2c7ccfefed Perform check for tool builds before src
Perform the test whether tools should be built before entering the
source directory of a project. In QtDeclarative this would result in
a configuration error since the tools are used while building everything
under src.

Change-Id: I33ce2cb317ef221836d696654f3bb4e39db47e54
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-07 08:28:27 +00:00
Leander Beernaert
ebe77c89de Fix typo in QtBuild.cmake
Fix typo for set command.

Change-Id: I1881bf77cab47ef37081065057200a72a2bc7e8f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-07 07:48:49 +00:00
Leander Beernaert
709538096c Fix add_qml_module URI
Make sure the URI name for qml modules correctly strips out the version
number for instances such as QtQuick.Controls.2.

Change-Id: I18e706b371323eeefdd6d7564b922265fa5cad3f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-06 13:10:22 +00:00
Simon Hausmann
e343affd63 Propagate library/plugin resources automatically when linking statically
The rcc generated code relies on global constructors to register the resources.
The object file of the generated code is included by default in shared libraries
and executables. However when the object file ends up in a static library, the
linker will discard the object file when nothing references any of the symbols
in that object file, when linking the static library into the executable/shared library.
The solution is to link the object file straight into the final target, by means of a
cmake object library.

Change-Id: I02ad1173e4f7e8f907022c906640dc9086233676
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-06 08:41:51 +00:00
Leander Beernaert
0ceed231b4 Add __default_public_args to add_qt_test and add_qt_executable
Due to the missing argument processing on PUBLIC arguments we could
run into situations where the defines for an executable (mostly tests)
would be incorrectly processed.

If one were to pass a define into a test that also specifies public
libraries, the defines passed in by test would fall under the
PUBLIC_LIBRARIES argument in add_qt_executable.

For instance, in a test with DEFINES Foo PUBLIC_LIBRARIES Core
would cause arg_DEFINES to be "Foo=BAR;PUBLIC_LIBRARIES;Core". This
combined with the defines specified by add_qt_test would result
in the following string "Foo=BAR;PUBLIC_LIBRARIES;Core;TEST_DIR=..."
and would cause TEST_DIR to be treated as a public library in
add add_qt_executable.

For some reason I can't figure out, these two defines end up in the
linker flag section of certain test programs. There is nothing wrong
with the rest of the propagation chain into add_qt_executable. My best
guess is that it has something to do with the generators. In any case
add an explicit -D fixes the issue.

Change-Id: I340790c1c2426fa76785d1bd1b3332a904323d56
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-05 08:06:37 +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
Leander Beernaert
a920c16ef2 Add Qt Quick Compiler support
This patch adds support for the qtquick compiler feature, which
will embed the compiled qml files as resources along with the
respective qml_loader.

This patch also changes the add_qml_module call to require either
EMBED_QML_FILES and/or INSTALL_QML_FILES to be specified.

Change-Id: I32d29c9b554b8286ed3b980027a56dd4abe11c92
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-31 12:52:20 +00:00
Simon Hausmann
517a0ea8f0 Fix add_qml_module() with non-static builds
Make sure that the .qml/.js/.mjs files are copied or installed into
their target destination.

Change-Id: Ib1649e5168c9fe3a570800af92d82293e5b295d6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-07-30 15:37:00 +00:00
Alexandru Croitor
1fc70ac0de Fix creation of generated plugin cpp files in static builds
When building qtdeclarative against a static iOS qtbase build,
QtNetwork is find_package'd twice, once in the top level
CMakeLists.txt file, and once by the qtuiotouchplugin which has
Network as a dependency.

This meant that the static plugins that Network exposes had
auto import cpp files generated twice, which failed the configuration
of qtdeclarative.

To fix this, don't generate the same file more than once.

To do that, protect the inclusion of the FooPlugins.cmake file, to
only be included once in every directory scope. That can be achieved
by setting a variable to TRUE when the target does not exist yet.

If the target exists in the same scope, that means that find_package()
was called a second time in the same scope, so there is no need
to include the Plugins file.

Change-Id: I9d7c3e7b7c22c2b4526cf1d717b9d15919f213f3
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-30 13:26:37 +00:00
Alexandru Croitor
5528bcf99c Protect against extending imported host targets
When cross-compiling qtdeclarative, add_qt_tools makes sure to import
the host tool and not build it. But there are also some
extend_target and add_qt_resource calls which try to extend the host
tool.

Make sure to protect those functions not to do anything if they are
called on an imported target.

Change-Id: Ifd8bcab8e56ad389a8c145382b23bd2c1bda5e81
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-30 13:26:25 +00:00
Alexandru Croitor
a285bcba26 Ugly fix for handling QT_SOURCE_TREE
QT_SOURCE_TREE is a variable that is set in qtbase/.qmake.conf.
In qtbase, it's used throughout various
projects to find cpp sources when building standalone tests (among
other things).
Everything works fine with qmake, because even if qmake is invoked
on the tests subfolder, qmake searches up the source directory tree
until it finds a .qmake.conf file, and uses that.

When building qttools with qmake, the qdoc project expects
to have a QT_SOURCE_TREE value, but it's not actually set in the
qttools/.qmake.conf file, so the generated include paths that use
that value are incorrect. Curiously the build still succeeds.

Now in CMake land we replaced QT_SOURCE_TREE with
CMAKE_SOURCE_DIR, but that does not work properly when doing a
standalone tests build, because the project in that case is the
tests one, and not the qtbase one, so configuration fails in a
developer build when trying to configure some private tests.

So far I've found that only qtbase actively uses this value.
A temporary fix is to save the qtbase source directory into a
QT_SOURCE_TREE variable inside the generated
BuildInternalsExtra.cmake file.

The pro2cmake script is changed to handle presence of QT_SOURCE_TREE
in a qrc file path. This is handled by finding the location of a
.qmake.conf file starting from the project file absolute path.
This is needed to stop the script from crashing when handling
the mimedatabase test projects for example.

The change also regenerates the relevant failing test projects, and
thus standalone tests (when doing developer builds aka private_tests
enabled) now configure and build successfully.

Change-Id: I15adc6f4ab6e3056c43ed850196204e2229c4d98
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-29 13:16:14 +00:00
Simon Hausmann
c75dcc6875 Permit the use of qml cache file generation even inside qtdeclarative
After re-arranging subdirs, the cmake target level dependencies can
handle building qmlcachegen before running the custom command for
generating cache files.

Change-Id: I8a35b2b5bfd2fdf4b49462ff9c27e5f3075254fc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-29 13:15:16 +00:00
Alexandru Croitor
1307736c7d Fix testdata handling
Make sure to handle glob expressions in the entire path given, not just
the end of the path. This handles tests like qsslkey and qnetworkreply.

Also copy/install the testdata in the final test directory path under
a "testdata" subdir.
Previously INSTALL_TESTDIR was used, which was never set to anything.

Change-Id: I2408e12f586cadeb524ffa249e851a4179324b23
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2019-07-29 13:14:44 +00:00