Commit Graph

271 Commits

Author SHA1 Message Date
Alexandru Croitor
09fdddeb32 CMake: Don't strip debug builds with qt-cmake-private-install in CI
This provides better stack traces and easier debugging in CI VMs.

Put the MSVC check for disabling stripping into the same place so
there's one location to decide whether stripping should happen.

Amends 60d804c567

Pick-to: 6.6
Fixes: QTBUG-118070
Change-Id: I4684036c8a5a137d14eea58954b34fe1ceb7f804
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-11-03 18:24:46 +02:00
Alexey Edelev
214c3a033a Add simple project generation based on existing source files
Introduce the qt-cmake-create script. The script generates the simple
CMakeLists.txt based on the source files located in the current or
specified directory. The initial version can generate a CMake code for
the following file types:
  - .c .cc .cpp .cxx .h .hh .hxx .hpp - generates the qt_add_executable
    call with prerequisites.
  - .qml .js .mjs - generates the qt_add_qml_module call with
    prerequisites.
  - .ui - adds the found ui files to the existing executable. Requires
    C++ files be present in the directory too.
  - .qrc - generates the qt_add_resources call and adds the resources
    to the existing executable. Requires C++ files be present in the
    directory too.
  - .proto - generates qt_add_protobuf call with prerequisites.

The QtInitProject.cmake script contains the 'handle_type' function that
allows extending the script capabilities and establish simple relation
chains between the file types.

Note: The initial implementation doesn't deal with sub-directories, so
all files from sub-directories will be added to and handled in the
top-level CMakeLists.txt file. This can be extended by user request.

Task-number: QTBUG-104388
Change-Id: I5abd9e07da109e867ff95986572ed2bf02ef9d3d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-08 12:59:19 +01:00
Amir Masoud Abdol
07a978c756 Use the Windows path separator in a Batch file
Patching inconsistent path separator in Batch file. This at some point
may lead to something similar to the mentioned task.

Pick-to: 6.4 6.5
Task-number: QTBUG-109857
Change-Id: I36c05dc7a0b7daf3dc5dced61f3c3f7d90eb59e3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-01-09 14:39:27 +01:00
Amir Masoud Abdol
9773f0175c Return qt-configure-module to bin/
We agreed that qt-configure-module needs to come back to bin/ as it's
user-facing.

Amends d77ce33082

[ChangeLog][CMake] Upon further consideration, qt-configure-module
was deemed user-facing, and was thus moved back to ./bin on
all platforms.

Task-number: QTBUG-107621
Change-Id: I1f7874436e5b3988242091fc0303ea828f29d5c6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-13 10:02:25 +00:00
Amir Masoud Abdol
ca24ee14df Create the versioned variant of Qt tools in cross platform build
In cross builds, we are not creating versioned links for qt tools. This
patch addresses that. I've changed the signature of the
`qt_internal_install_versioned_link` such that it can be used for
non-target as well, so in cross build the qmake or qtmake.bat can be
processed with the same function.

Fixes: QTBUG-109024
Change-Id: I246621c18325d084622ca92b422e815ed06f1381
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-07 07:09:15 +01:00
David Skoland
a0ecc14f30 Minor fixes for qt-configure-module
Put quotes around args var and add e and u flags, which
do the following:

e - terminates the script if an error occurs. This is
certainly desirable behavior. We don't want the script to chug
along with unpredictable behavior if an error occurred.

u - terminates the script if an undefined variable is encountered.
It is also desirable to terminate here because it might lead to
unexpected behavior.

Change-Id: Ia02196ef3eab64521e36771530d033a15bb40ecc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-06-27 17:55:19 +02:00
Alexandru Croitor
a3917126e8 CMake: Automatically use Xcode generator in qt-cmake + iOS
When calling qt-cmake on the command line, we don't usually force
usage of a particular CMake generator and defer to the user's choice
or CMake's default for the host OS.

In the case of iOS, the generator that makes the most sense to use is
Xcode. One could also use Ninja / Unix Makefiles if the project
is only building static libraries, but for shared libraries and
executables the project likely needs the code signing
provided by xcodebuild.

When targeting iOS, use a different qt-cmake file template.

The iOS-specific shell script will set the CMAKE_GENERATOR environment
variable to 'Xcode'.
If no -G or -D CMAKE_GENERATOR is provided on the command line then
the project will use the Xcode generator. Otherwise the generator
given on the command line takes precedence.

The CMAKE_GENERATOR environment variable from the parent process is
completely ignored.

The logic is only done for iOS, to reduce the likeliness
of breaking the qt-cmake script for other platforms.

Note that Qt Creator does not use qt-cmake, but rather calls cmake
directly with additional options like the toolchain file,
architecture, sysroot, etc.

[ChangeLog][iOS][CMake] qt-cmake now defaults to using the Xcode
generator when targeting iOS projects.

Pick-to: 6.2 6.3
Fixes: QTBUG-100834
Change-Id: I39b3dce47cc9ee2f98678631e4bd035c59c65294
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-20 13:06:00 +02:00
Joerg Bornemann
71e490f0ba Provide a qtpaths wrapper script when cross-building Qt
The qtpaths tool is supposed to replace "qmake -query", and it must be
available for cross-builds as a wrapper script like qmake.

Re-use the existing facility for creating the qmake wrapper script for
creating the qtpaths wrapper script.

Pick-to: 6.2
Fixes: QTBUG-97821
Change-Id: I460bae61a531994422e1c0fba09c79e4aa65713f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-08 13:41:03 +01:00
Joerg Bornemann
1ac947e3af Add missing -help argument to qt-configure-module
Now it's possible to display a configure help screen per module with
  qt-configure-module <module-source-dir> -help

Pick-to: 6.2
Fixes: QTBUG-95943
Change-Id: I7d26006246af4b38b5a2ec6deca3f45c5313afec
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-20 19:44:43 +02:00
Joerg Bornemann
57ad532e75 Fix our usage of CMake script mode in Windows configure
This is a preparation for adding the -help argument to
qt-configure-module.bat.

Consider the call
  qt-configure-module.bat path/to/qt-module -help
Internally, we called
  cmake ... -P .../QtWriteArgsFile.cmake path/to/qt-module -help
which was supposed to separate the arguments and write them into
config.opt.

However, passing arbitrary arguments after "-P script.cmake" only worked
by accident and is not supported.  As soon as arguments are passed that
are valid CMake arguments, like -help or -G, the CMake call would fail.

Now, we let configure.bat and qt-configure-module.bat write the
arguments as is into config.opt.in and let QtWriteArgsFile.cmake read
this file, separate the arguments and write config.opt.

Pick-to: 6.2
Task-number: QTBUG-95943
Change-Id: I80f298a2aaf55b0f79fed86320a055eb2d2b6faa
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-20 19:44:43 +02:00
Cristian Adam
0a1256a52d CMake: Allow usage of QtStandaloneTestTemplateProject as package component
Currently in order to compile a Qt6 test standalone one needs to use
the qt-cmake-standalone-test script which will load the
Qt6BuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt project
with the current test source directory to create a complete CMake project.

This commit will allow a test to have these lines at top:

cmake_minimum_required(VERSION 3.16)

if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
    project(a_qt_test LANGUAGES C CXX ASM)
    find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST)
endif()

and be standalone and work with any IDE capable of loading CMake projects.

Fixes: QTCREATORBUG-25389
Pick-to: 6.1
Change-Id: If3f878b7e560a8bfbb604a8f1aa30b7962742e66
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-23 13:31:04 +02:00
Joerg Bornemann
1aba26eeae Add reference to CMake issue in qt-cmake-private-install-cmake.in
The original issue #20713 is fixed, but there's still #21475 to be fixed
before we can remove qt-cmake-private-install-cmake.
Extend the comment to mention this.

Change-Id: I7a2d794ae23e2b8bc7bd27527cbc8a32b1e78e1b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-31 15:32:30 +02:00
Joerg Bornemann
4ae9922166 Move bin/qt-internal-configure-tests to libexec
Pick-to: 6.1
Task-number: QTBUG-88791
Change-Id: I78613128760b5820e6db17b0c09462e34f7c7bb2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-30 14:39:12 +01:00
Joerg Bornemann
800f745140 Move syncqt.pl to libexec
To not disturb the qmake build we kept syncqt.pl in <src>/bin but
installed it to libexec. This is not necessary anymore.

This also removes the need for having syncqt.pl in both, bin and libexec
in the build dir of qtbase.

Pick-to: 6.1
Fixes: QTBUG-91076
Change-Id: I44b014ea41e3f00c420e02fd5c76f11169340b8c
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-03-04 09:56:07 +01:00
Joerg Bornemann
e01add5cdb Remove fixqt4headers.pl
This script was aiding users to port from Qt 4 to 5 and is considered
to be of little value for Qt 6.

Pick-to: 6.1
Change-Id: I26fb97d32969463d94e38222e32f241f86ad9193
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-03-04 09:56:06 +01:00
Alexandru Croitor
88e9e88a26 CMake: Mark qt-cmake-standalone-test as an executable on Unix
The source permissions are transferred when using configure_file for
non-prefix builds. This allows running qt-cmake-standalone-test in
both non-prefix and prefix builds.

Change-Id: I38829901d0bd4dfc4b89c665169798052b218fb0
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-12-04 11:22:38 +01:00
Christophe Giboudeaux
687bd03d09 CMake: strip the executable bit from qt-cmake-private-install.cmake
Despite being installed in the the binary directory, this
CMake snippet cannot be executed.

Pick-to: 6.0
Change-Id: Ibfd31e51184f0688d19ac063804cc200c95555a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-30 16:16:21 +00:00
Alexey Edelev
4456ebc1e3 CMake: Make paths in qt-cmake-standalone-test relative
Make paths in qt-cmake-standalone-test relative to script's PWD.

Fixes: QTBUG-88380
Change-Id: I6ab507c31ebed391f4e85bc6fe3f7f747dd97d54
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-17 11:47:37 +01:00
Joerg Bornemann
2a29426e39 CMake: Fix argument passing for configure.bat / qt-configure-module.bat
Passing arguments with equal signs was broken for configure.bat and
qt-configure-module.bat. An argument FOO=BAR was split at = and written
as
    FOO
    BAR
to config.opt, breaking every attempt of assigning CMake variables.

We must not iterate over %* in batch files to avoid splitting arguments
at equal signs. Instead, pass %* unmodified to a CMake script that
writes config.opt.

Fixes: QTBUG-88019
Change-Id: I7c743a206961d1ed168f2313f864905f6b345b49
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-30 08:22:30 +01:00
Joerg Bornemann
de3bd64425 CMake: Prepare configure/qt-configure-module for calling more scripts
In a subsequent change we will call another CMake script from
qt-configure-module.bat. Write the location of qtbase/cmake into the
generated scripts instead of the path to QtProcessConfigureArgs.cmake.

Change-Id: Ie333b16d310b215c6e49efa27740c7525453d28f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-30 08:22:26 +01:00
Cristian Adam
60d804c567 Do not strip binaries for MSVC builds
CMake's --install --strip command will result in calling ${CMAKE_STRIP}
after installation.

On the build machines we have multiple compilers, and ${CMAKE_STRIP} will
have a valid program e.g. C:/strawberry/c/bin/strip.exe

This will change the MSVC binaries to have a MinGW linker version flag,
which confuses Qt Creator when setting up a MSVC Kit.

Amends 2044992eed

Fixes: QTBUG-87735
Change-Id: I1b3d4cc122b3f502810d48e0443f39824016cab5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-29 11:24:46 +01:00
Alexandru Croitor
bcc7d34540 CMake: Provide a qt-internal-configure-tests script
This is meant to be called by our CI instructions to build standalone
tests of a Qt repository.

Currently it just calls qt-cmake with
-DQT_BUILD_STANDALONE_TESTS=ON, but it might contain more things in
the future.

The script also simplifies configuring standalone tests locally, due
to not having to remember the name of the magical variable.

Change our CI instructions to use the new script.

Change-Id: I6bc02b4e94adc9d0d05fecb0fe70a561043271f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-10-26 15:23:25 +01:00
Joerg Bornemann
351d066adb CMake: Put the -qtconf argument in front in the qmake wrapper
For QMake's -install argument it's necessary to have -qtconf in front.

Task-number: QTBUG-87801
Change-Id: I042acdd143972cc4065660035b02678db891157f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-23 21:11:55 +02:00
Joerg Bornemann
115ead8fe4 CMake: Remove superfluous del call in qt-configure-module.bat
We're ensuring its existence right in the next line.

Change-Id: If7a55511c9ef839a9f9ae70a7928b58ad768ae65
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-22 20:47:10 +02:00
Joerg Bornemann
da9e22f029 CMake: Fix running qt-configure-module without arguments
We need to make sure to create a config.opt file, even if it's empty.
This is the same fix we did for the .bat file in
dad9550305.

Change-Id: I79c507cfe0f9517d3033a773d3a5cf69eb13cfe6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-22 20:47:10 +02:00
Joerg Bornemann
4c0ca7dd26 Allow paths with backslashes in qt-configure-module.bat
Fixes: QTBUG-87730
Change-Id: I93172062ec8dfd86529491ffb031edbd2e24592a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-10-22 20:47:09 +02:00
Giuseppe D'Angelo
54232d6ea9 Streamline the template specialization of QESDP's dtor
Declaring and implementing out of line a specialization for
QESDP's destructor is needed if we have an implicitly shared
type and we want to provide an inline move constructor for it.

The code is however a bit heavy on the eyes, and the full
implementation for the destructor must be provided (read:
copy and pasted) -- the specialization destructor cannot
just "reuse" the one from the primary template.

This patch adds a few macros to streamline the above, so
that we can start using the same pattern in more places.
These macros are completely private for the moment being;
we don't want to push this solution for our users.

Port QPixmap to the new macros.

Change-Id: Ia6a51ad988483e44c9d97c0eca2fb003b6bd21e3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-05 10:16:52 +02:00
Alexandru Croitor
2044992eed CMake: Strip binaries and libraries upon installation
To avoid big artifact sizes, strip the binaries and libraries upon
installation. This achieves stripping similar to QTBUG-69767 and
QTBUG-81301 but arguably in a cleaner CMake way.

See comment on PS34 of the unmerged commit
90b09fee44b08b65a436fd15fda2526e242f7b21 for details.

Task-number: QTBUG-86053
Change-Id: I3ed929a8a7c74b88c480543212fc9551d8bde77f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-09-30 16:16:00 +02:00
Joerg Bornemann
dad9550305 CMake: Fix running qt-configure-module.bat without arguments
We need to make sure to create a config.opt file, even if it's empty.

Change-Id: If1e41cea2f3b5f3ce67f30285b77c58f7376546a
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2020-09-11 17:11:02 +02:00
Joerg Bornemann
457cf10f7e CMake: Introduce qt-configure-module
Add a convenience script to configure a Qt module separately.
This script reads and interprets the qt_cmdline.cmake files of the
Qt module to be configured and eventually calls qt-cmake-private.

Example usage:
<install-prefix>/bin/qt-configure-module <source-root>/qtdeclarative
  -qml-network -- --trace-expand --trace-redirect=cmake.trace

Change-Id: I026f1a050cd3f4df740611c32ba8c03161bba7a3
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-09-11 00:41:10 +02:00
Kai Koehne
29bd0b781a Windows: Avoid syncqt needlessly re-generating headers
Normalize newlines so that headers on Windows are not
always treated as outdated.

This amends 108fb2f197.

Task-number: QTBUG-86121
Change-Id: I46ddb3c5b42852bff75fd56ca224c555ac0bae94
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-08-19 12:46:09 +02:00
Jonas Karlsson
a99bc30e1e Add OS-specific prelude to qt-cmake-standalone-test
This makes sure the executable is run as a shell script
with the proper interpreter on Unix systems.
Otherwise it will fail in some shells, like fish.

On windows, it prevents all commands in the batch file
from displaying on the screen.

Change-Id: If554262f172b035b9661b3e2ff26a96789fa707b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-15 15:13:05 +00:00
Alexandru Croitor
108fb2f197 syncqt: Make sure to update forwarding headers if they are stale
Previously syncqt did not write content to forwarding headers if they
already existed in the target location, regardless of the contents of
the forwarding header.

This is different from syncqt's behavior when it actually copies
the headers to the target location, instead of creating a forwarding
header that includes another header.

Fix syncqt to read existing forwarding header content, and update the
content in case if it's different from the newly generated content.

This should fix the following non-prefix build case: running syncqt
from a different source + build directory would not update the
forwarding headers in the qtbase build dir.

Change-Id: Ia0a1665a36ce54f1c487101d9a7532fc0aa40c89
Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-06-30 13:15:11 +02:00
Joerg Bornemann
d7fd684861 CMake: Support cross-compilation with qmake
When cross-compiling, we now create a target_qt.conf file that's to be
used with the host Qt's qmake. With "qmake -qtconf .../target_qt.conf"
projects can be cross-built against the cross-built Qt.

We also create wrapper scripts for the host qmake to save the user from
passing the -qtconf argument.

Fixes: QTBUG-82581
Change-Id: Ib5866e7e820369efea9eb3171e3e3e3ca5c0c3c1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-06-29 12:47:34 +02:00
Alexandru Croitor
b3e01d608e CMake: Use custom install script to support Ninja Multi-Config builds
Calling cmake --install . only installs a single configuration.

To install both debug and release artifacts, the install
invocation needs to be done for each configuration.

To keep the Coin instruction code simpler, delegate the looping
over configurations to a custom CMake script, and use it in the
Coin instructions.

Replace all cmake --install calls in the instructions with calls
to either call_host_install.yaml or call_target_install.yaml.

The path to the script depends on whether we are building
qtbase or another module. In the former case the script should
be called from the build dir, otherwise from the install dir.

The other distinction is whether the host or target env prefix
needs to be added.

Task-number: QTBUG-80900
Change-Id: Ied4bf739e2b1a2307f22fc79c1cfad746c8cbc44
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-19 10:16:11 +02:00
Alexandru Croitor
bf315c5526 CMake: Make build system of installed Qt more relocatable
Aka handle CMAKE_INSTALL_PREFIX in a more relocatable way.

The following story inspired this change.

If a user wants to build a Qt repo into a different install prefix
than the usual Qt one, this will fail configuration because we
look for various things like syncqt, qdoc, etc relative to
CMAKE_INSTALL_PREFIX, which will now point to a different location
where none of the above tools are located.

The intent for such a use case is to support building Qt packages with
Conan, which sets a random install prefix when configuring a repo.

The idea is to derive the qt prefix dynamically from the
QtBuildInternals package location. Essentially it's a reverse relative
path from the QtBuildInternalsConfig.cmake file to the install prefix
that was specified when initially configuring qtbase.

Once the dynamic prefix is computed (so we know where the possibly
relocated Qt is), we can find tools like syncqt and qdoc.

This is an initial attempt to support a use case like that.

More design work will probably needed in case if tools / libs need to
be found in a location different than the Qt install prefix (so
support for multiple install prefixes / search paths).

An example of such a case would be when building qtdeclarative and
qtquickcontrols2 as Conan packages in one go. Most likely the
qmltyperegistrar tool will be located in the random install prefix
set by Conan, so building qtquickcontrols2 might fail due to not
finding the tool in the original Qt install prefix.

As to the implementation details, the change does the following:
- Dynamically computes and sets the
  QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX variable when
  find_package()'ing QtBuildInternals. It's an absolute path
  pointing to where the relocated Qt is.

- When building qtbase this variable is not yet available (due
  to QtBuildInternalsExtra not existing), in that case we set
  the variable to the absolute path of CMAKE_INSTALL_PREFIX
  (but only for the initial qtbase configuration).

- Remove QT_BUILD_INTERNALS_ORIGINAL_INSTALL_PREFIX which was used
  for standalone tests purposes. It's not needed now that we compute
  the location of the Qt prefix dynamically.

- The Unixy qt-cmake and qt-cmake-private shell scripts now
  use a relative path to find the toolchain file we created.

- The toolchain file also dynamically computes the location of the Qt
  packages, and adds them to CMAKE_PREFIX_PATH.

- A lot of existing CMAKE_INSTALL_PREFIX uses are replaced with
  QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX. This includes finding
  tool locations, mkspecs dir, path environment setup for tools, etc.

- Some places still use CMAKE_PREFIX_PATH in the following cases
  - When determining paths while configuring qtbase (valid cases)
  - When I wasn't sure what the behavior should be, so I left them
    as-is (an example is documentation generation, do we want to
    install it into the random Conan prefix, or into the main prefix?
    Currently it installs in the random prefix).

Note that relocating a Qt installation does not work for non-prefix /
non-installed builds, due to hardcoded paths to include directories
and libraries in generated FooTargets.cmake files.

Task-number: QTBUG-83999
Change-Id: I87d6558729db93121b1715771034b03ce3295923
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-07 15:41:16 +02:00
Qt Forward Merge Bot
efd7757154 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/widgets/widgets/qabstractbutton.cpp
	src/widgets/widgets/qbuttongroup.cpp
	src/widgets/widgets/qbuttongroup.h
	src/widgets/widgets/qsplashscreen.cpp
	tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp
        tests/benchmarks/opengl/main.cpp

  Needed update:
	src/plugins/platforms/cocoa/CMakeLists.txt

Change-Id: I7be4baebb63844ec2b3e0de859ca9de1bc730bb5
2020-04-22 15:28:01 +02:00
Tor Arne Vestbø
504b37e399 syncqt: Ignore deprecation macros when resolving class names
Otherwise we will fail to resolve the symbol and will not create
a forwarding header for the class.

Change-Id: I34922d8458bdb994a194108183ac9b9d14530c5e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-14 10:14:37 +00:00
Alexandru Croitor
1f442c684f CMake: Provide script to configure and build one or more tests
Before this patch there were a few ways to build tests
- Configure all tests as part of the repo build
- Configure all tests as part of the repo build, but don't build
  tests by default (-DQT_NO_MAKE_TESTS=ON)
- Configure all tests as a standalone project in a separate build
  dir using -QT_BUILD_STANDALONE_TESTS=ON

All of the above incur some time overhead due to the necessity
of configuring all tests.
Sometimes you just want to build ONE test (or a few).

To facilitate that use case, a new shell script called
bin/qt-cmake-standalone-test(.bat) can now be used to configure
and build one or more tests.

The script takes one single argument pointing to the desired test
project path and configures a generic template project that sets up
all the necessary Qt CMake private API, afterwards calling
add_subdirectory on the passed in project.

Example
$ path/to/qt/bin/qt-cmake-standalone-test ./tests/auto/gui/image/qicon

or

$ path/to/qt/bin/qt-cmake-standalone-test ./tests/auto/gui/image

After that, simply run 'ninja && ctest' to build and run the test(s).

This is the CMake equivalent of calling qmake on a test .pro file
(or on a tests SUBDIRS .pro file)

There are 3 details worth mentioning.

Due to the add_subdirectory call, the built artifacts will not
be in the top-level build dir, but rather in a nested build_dir.

The script currently can't handle more than one argument
(the path to the project), so you can't pass additional
-DFoo=bar arguments.

If a test uses a 3rd party library (like Threads::Threads)
which was not a public dependency for any of the Qt modules,
configuration will fail saying that the target was not found.
Perhaps we should consider recording these packages when
generating the StandaloneConfig.cmake files.

Change-Id: Icde6ecb839341d34f341d9a19402c91196ed5aa0
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-23 09:54:48 +01:00
Alexandru Croitor
c9bea1ad62 Add initial support for CMake "Ninja Multi-Config" generator
This allows doing debug_and_release builds with Ninja on all
platforms.
The "Ninja Multi-Config generator" is available starting with CMake
3.17.

Desired configurations can be set via CMAKE_CONFIGURATION_TYPES.
Possible values: "Release, Debug, RelWithDebInfo, MinRelSize".
For example -DCMAKE_CONFIGURATION_TYPES="Release;Debug".

The first configuration is the 'default' configuration which is
built when calling ninja with no arguments.

To build all targets of a certain configuration use "ninja all:Release"
or "ninja all:Debug".

To build all targets in all configurations use "ninja all:all".

Note that the first configuration influences which configuration of
tools will be used when building the libraries for all configurations.
In simple terms, when configured with
-DCMAKE_CONFIGURATION_TYPES="Release;Debug" the release version of moc
is used by AUTOMOC.
When configured with -DCMAKE_CONFIGURATION_TYPES="Debug;Release"
the debug version of moc is used by AUTOMOC.

Framework builds and Ninja Multi-Config don't currently work together
due to multiple bugs in CMake, which ends up generating an invalid ninja
file with duplicate rules. There are also issues with placement of the
debug artifacts.

This will be handled in a follow up patch after CMake is fixed.

Task-number: QTBUG-76899
Change-Id: If224adc0b71b7d1d6606738101536146aa866cd7
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-01-27 11:47:57 +00:00
Leander Beernaert
502d3d6744 Merge remote-tracking branch 'origin/dev' into merge-dev
Change-Id: I31b761cfd5ea01373c60d02a5da8c33398d34739
2020-01-24 13:17:33 +01:00
Leander Beernaert
6eb32dc28a Fix qt-cmake.bat for paths with spaces
Change-Id: Id338f7f2f0392e2fe3933659af156644e8fac6c1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-22 08:47:58 +00:00
Liang Qi
d140f2f614 Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	examples/widgets/widgets/scribble/mainwindow.cpp
		This amends cb54c16584.

Change-Id: Iaae60a893330524b2973917e23b31f9d51f8bd38
2019-11-13 07:21:33 +01:00
Andy Shaw
5771b5325b syncqt: Add a means to suspend/resume the processing of a file
Rather than tweaking the parser to cover every eventuality with corner
case lines that could cause incorrect header files to be created then
the means to suspend/resume the processing of a file is added.

This enables us to have it skip over the template line that is causing
a QList header to be created as part of the QtGui headers. This patch
includes the fix to solve this in addition.

Fixes: QTBUG-68129
Change-Id: I751646c4b20a4434347c149ae5e6dcb6e7618853
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-11-06 10:49:24 +01:00
Alexandru Croitor
f4b4c4f79b Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I3a1d7673c3c20019ab12a2ea0a60f1619920a34c
2019-10-11 16:23:19 +02:00
Kevin Funk
8ce653e048 Make sure QLatin1Literal fwd header is generated
This broke when QLatin1Literal got deprecated in change 45373c1924

Both hunks in this patch are needed. The hunk in syncqt.pl removes the
QT_DEPRECATED_X(...) macro if it appears solely on a line in source code,
the second hunk inserts a newline after the QT_DEPRECATED_X(...) macro usage
to trigger that code path in the Perl script.

Before/after comparison of the headers generated in include/QtCore:

```
% diff  ~/old.txt ~/new.txt
105a106
> QLatin1Literal
```

Change-Id: I468dd2dd54bf115521ed82c6182236905556f568
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-09-02 11:33:54 +02:00
Alexandru Croitor
c7ec7cd2a1 Merge branch 'wip/qt6' into wip/cmake
Change-Id: I50ac36b8803c296998149e98cc61e38687cdd14b
2019-08-15 16:53:19 +02:00
Terunao HIROTA
b03ee91ebf syncqt: Fix to work correctly when the line endings are LF in Win-msys
In Windows-msys syncqt.pl expects CRLF line endings, and does not
work correctly with LF. syncqt.pl was fixed to be line-ending-agnostic.

Task-number: QTBUG-77192
Change-Id: Ie8029238bdd580bcf042ede0d0f64d5f01488406
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-08-15 16:16:06 +09:00
Felix Barz
36a15a87de syncqt: Fix module header install target creation
Modified a regular expression in syncqt.pl so that the special case of
a class beginning with another class does not lead to the exclusion of
the first one. This affects the generation of the install target for
generated class headers of Qt modules. Now the expression verifies the
class names are not identical.

Fixes: QTBUG-71323
Change-Id: I210b4d4c3ed64cf189594b95b10aa0e8495a19d2
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-07-11 09:50:18 +02:00
Alexandru Croitor
38640f745e Fix toolchain path when doing non-prefix builds
Previously the cmake install prefix was added twice during a non-prefix
build, which evaluated to an incorrect path.

Set another absolute dir variable, and use that instead.

Change-Id: I73099510dadc8f401d5a763f21840c9671686c10
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-07-03 16:09:55 +00:00