Commit Graph

95 Commits

Author SHA1 Message Date
Eike Ziller
098637b758 Merge remote-tracking branch 'origin/4.15'
Conflicts:
	src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
	src/plugins/ios/iosprobe.cpp
	src/plugins/mcusupport/mcusupportsdk.cpp

Change-Id: I6c2136b576c44fc35def397191db97069599f183
2021-06-07 08:37:56 +02:00
Cristian Adam
2ef2e497fc CMakePM: Cancel active C/C++ parsing before starting CMake
If CMake is being triggered when C/C++ parsing is running, make sure
to cancel() the C/C++ parsing before running CMake.

The C/C++ parsing is issued after the CMake project is loaded,
so for a subsequent CMake run there is no need to have the
system busy with C/C++ parsing and at the same time run CMake.

Change-Id: Ib9a2e057a90d9572e904ff449666bb9b12d1accc
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-03 10:12:02 +00:00
Cristian Adam
392bda1160 CMakePM: Save cmake parameters in qtcsettings.cmake also for initial run
This way projects can have access to all CMake parameters that were
issued from Qt Creator.

Previously the initial run was skipped, only the subsequent changes
were picked up.

Change-Id: I7a2262cdb9754ff666f78fd2e39663466f494f5f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-06-01 09:22:41 +00:00
Eike Ziller
2485c31a48 Merge remote-tracking branch 'origin/4.15'
Conflicts:
	doc/qtcreator/src/qtquick/qtquick-from-qmlproject-to-pro.qdoc

Change-Id: I906330addb7de31e6ed88f88af3fd2adbbe53e1f
2021-05-31 16:13:47 +02:00
Eike Ziller
fbeaa774b5 CMakePM: stop file api reader future on stop()
The future that would trigger the result of a cmake api file parsing
would not be removed if the stop parsing would be triggered.

This could be triggered by fast switching between build configurations.

It could also lead to forever parsing states having the project's
wheel always spinning.

Fixes: QTCREATORBUG-25588
Fixes: QTCREATORBUG-25287
Change-Id: I4f92806ebdb703b4910952cd8db1e52816daf9cf
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-05-31 13:58:26 +00:00
Cristian Adam
637a20c34c CMakePM: Have only one "Scan project tree" task
Check if asyncScanForFiles returns true, which means it added
a future, which then can be used for Core::ProgressManager::addTask

Task-number: QTCREATORBUG-24564
Change-Id: I347c027e676023a782e7d4822fe2d51385888a64
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-31 08:30:33 +00:00
Eike Ziller
dbd4a10d6f Merge remote-tracking branch 'origin/4.15'
Change-Id: I3d3dfa04124eed14952294c2847b9851dcb1a5fd
2021-05-25 16:26:54 +02:00
Christian Stenger
8d5e9c3636 CMakePM: Fix running selected ctests
Do not use a pattern to address tests when running selected. Instead
get their respective test number and use this.
This avoids executing unchecked test cases that match a shorter selected
one. Beside this it shortens the commandline which might be also a
benefit on Windows.

Change-Id: Ic1c0cf8eedab478564f04fb494679eca4521f402
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-05-21 10:26:09 +00:00
Cristian Adam
b5428d0903 CMakePM: Do not filter out all UTILITY targets
add_custom_target will be set as UTILITY target, which one might
want to reference as "cm <target>" or "--target <target>".

Filter out instead the "_autogen" and "_autogen_timestamp_deps".

Fixes: QTCREATORBUG-25726
Change-Id: Ia73d6e87e4b230114d068649964792ff3f626378
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-20 07:28:16 +00:00
Eike Ziller
2800f3b51f Merge remote-tracking branch 'origin/4.15'
Change-Id: I0afcf51d354ffd73a8f2956a7f78b1e4f032677b
2021-04-09 12:42:03 +02:00
Cristian Adam
85e2368b38 CMakePM: Reparse CMake project when the file-api json files change
CMake will reconfigure itself if you have modified the CMakeLists.txt
files. Qt Creator needs to reparse the file-api json structure even
if the "Auto-run CMake" is being disabled.

"Auto-run CMake" will run CMake when the project files themselves
have been changed e.g. modify and then save.

CMake will use ninja / make to reconfigure itself, generate the file-api
structure and Qt  Creator needs to keep up.

Change-Id: I12d8683b86f35bd6e0ebccec5300cd7ae8dce0b2
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-04-06 15:46:07 +00:00
Eike Ziller
c0cfafdd3d Merge remote-tracking branch 'origin/4.15'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp

Change-Id: I403b236c40d73a61ae22304e289e9d4374366395
2021-04-06 15:17:40 +02:00
Cristian Adam
3da99f7832 CMakePM: Filter out utility targets from target configuration list
In the build target list there is no reason to have <target>_autogen
or <target>_autogen_timestamps targets.

Also do not sort the target list, so that the special targets stay
at top (all, clean, install etc)

Change-Id: I3107150bb40d68cc95246d4d09abc300a6e3d3fc
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-04-06 12:15:52 +00:00
Cristian Adam
ca430f2a8b CMakePM: Copy the header file name to clipboard after adding class
Fixes: QTCREATORBUG-25212
Fixes: QTCREATORBUG-24301
Change-Id: Idf6104548223f6d26820bc395ee60c1a8c794c6d
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-03-31 14:39:10 +00:00
hjk
341132dd0a CMake: Code cosmetics
- use newer approach to settings page layout building
- no SHOUTING enums
- namespaces
- proper dialog parent for message

Change-Id: I7adfb7487d502b8fd706c4a0c5645f4d2153e39c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-03-30 08:57:31 +00:00
Alessandro Portale
07f1aa7ed1 CMakeProjectManager: Remove left-over qDebug()
...from CMakeBuildSystem::updateQmlJSCodeModel

Change-Id: I2f0db764266d5580c47fb99bc6637bcd0ba508ca
Reviewed-by: hjk <hjk@qt.io>
2021-03-26 15:19:25 +00:00
hjk
beda749326 CMake: Aspectify CMakeSpecificSettings
Change-Id: I2e094c5a392964fdaf49ac30c2e0ae0f57a3b11d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-03-26 12:40:08 +00:00
Eike Ziller
b213c87cf4 Merge remote-tracking branch 'origin/4.15'
Conflicts:
	src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp

Change-Id: I722a94f37bdd1d78625cfae503ba6d02ff083c63
2021-03-25 11:06:59 +01:00
Cristian Adam
9d2fab7c17 CMakePM: Clear CMake configuration to remove backup files
Also remove the CMakeCache.txt.prev, .cmake/api/v1/reply, and
.cmake/api/v1/reply.prev which might cause problems in
case of CMake configuration failure.

Change-Id: I24f049e5e0338b78393b68ab3680276388ffc6bf
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-03-23 10:51:11 +00:00
Eike Ziller
863260f1fd Merge remote-tracking branch 'origin/4.15'
Conflicts:
	src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
	src/plugins/debugger/gdb/gdboptionspage.cpp

Change-Id: I4149e860b6842ea63bff3a7eb9632b7a6c2919d8
2021-03-22 09:52:14 +01:00
Cristian Adam
637d45c66a CMakePM: Make "Build type" aspect visible
For single configuration projects if you change the build type
aspect you will change the CMAKE_BUILD_TYPE variable.

When switching the build directory the existing CMAKE_BUILD_TYPE
will be set as build type aspect.

Fixes: QTCREATORBUG-25451
Change-Id: I13519e95c316c556cc1348fba6121637d2fd4275
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-03-19 13:38:18 +00:00
Erik Verbruggen
5ad724a3ac Support for QML module mapping
QUL uses module mapping for theming of QtQuick.Controls: during
code-generation the compiler is pointed to the Controls implementation
it should use. This is done by rewriting any import of QtQuick.Controls
with the given module name. The CMake build scripts will write a file
for each target to the directory "qml_module_mappings" in the build dir,
and those files will contain the mappings used.

Fixes: QTCREATORBUG-25356
Change-Id: I3f74897836dde7717b03bd6dffa46dcc0689ffdd
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
2021-03-19 10:43:23 +00:00
Erik Verbruggen
2361f26732 Support merged QML import paths with header paths
QUL does not have separate QML import paths, but (re-)uses the include
paths for this purpose. Support this behavior by adding all include
paths to the QML import paths before handing the project information off
to the QML code model.

Change-Id: Ic2e39ab69ac27776f5070b7b8b7c66d53a83210b
Reviewed-by: <christiaan.janssen@qt.io>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
2021-03-18 14:33:55 +00:00
Eike Ziller
bce64778c5 Merge remote-tracking branch 'origin/4.15'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qtcreator_ide_branding.pri

Change-Id: I009308451e1c6276692412f498125d79a8f12a07
2021-03-11 14:10:14 +01:00
Eike Ziller
8ac091abf8 CMake: Improve layout of "Apply configuration changes" dialog
Show the CMake parameters that would be passed in a mono space font, one
option per line.

Change-Id: I462792736960b33fea669b5b753c89d21cd087fd
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-03-11 07:47:01 +00:00
Erik Verbruggen
9d90efee8b Add QML import path supplied by the kit
Although QUL has merged the QML import paths and the include paths, the
convention for C/C++ is to have the headers for a project under a
subdirectory of the include path, and do imports relative to the include
path. For example:
  #include <qul/SomeHeader.h>

The QML code model doesn't know about this convention, so for the kit
has to supply an extra QML import path for this case.

Change-Id: I82d4375dd8a1f510180f81b011a715dee8c10d60
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-03-10 14:33:06 +00:00
Jarek Kobus
675a72e296 Fix a deadlock when closing Creator while loading a project
Replace the call to SynchronousProcess::run() by asynchronous
call that invokes a process.

This change may be tested by applying the additional patch
mentioned in QTCREATORBUG-25385 description.

Don't call the SynchronousProcess::run() from the main thread when
the Quit event was already scheduled for qApp, since the Quit event
will get removed from the awaiting queue by a call to
QEventLoop::exec().

Fixes: QTCREATORBUG-25385
Change-Id: I8af39552443bfa9b3af6e31ddce85a01b91bbbd8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-03-09 11:13:01 +00:00
Cristian Adam
8f2db9fcbe CMakePM: Ask for configuration save if the user has changed variables
If the use has forgotten to click "Apply Configuration Changes"
button in project settings but it tries to build or run the
project, then the "Apply Configuration Changes" dialog box pops
as a reminder.

Change-Id: I26728ee3c79af72125be3bede759620c2cf3d7a1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-03-02 14:18:53 +00:00
Cristian Adam
3c3e9a97fd CMakeProjectManager: Write cmake configuration into qtcsettings.cmake
The parameters sent to CMake are also saved as qtcsettings.cmake,
this allows Android Multi-ABI CMake projects apply the settings
for all ABIs.

This was part of 196b0da08a

Task-number: QTCREATORBUG-25183
Change-Id: I6d4f210247d5377cab855a1a051cf7aa815192c7
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2021-03-02 08:15:37 +00:00
Cristian Adam
fc411cd0d1 CMakeProjectManager: Make backup of CMake configuration before starting CMake
CMake's fileapi functionality will save the project structure in json
files in the .cmake/api/v1/reply directory.

When issuing a cmake command with -D variables CMake will update its
CMakeCache.txt file even if cmake will fail.

This commit will rename .cmake/api/v1/reply as .cmake/api/v1/reply.prev
and make a copy of CMakeCache.txt before starting CMake, and if
something fails, replace the existing files with the previous values.

Also make sure the changed values are not dissappearing when the
old .cmake/api/v1/reply gets parsed.

Fixes: QTCREATORBUG-24593
Change-Id: I82141786fea7068699e0f761a8978ba1f3203e47
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-02-18 13:21:11 +00:00
Alessandro Portale
ae5255cebd Android: Fix android-*-deployment-settings.json detection
Qt 6.0 + CMake: The name for the Android deployment settings file needs
to be determined by using the build key of the current run configuration
rather than by using the display name of the project root node.

Since in contrast to qmake/Qbs, CMake does not supply us with the file
name and we have to contruct it ourselves. Therefore, it makes sense to
move the value into the Android plugin.

This change adds AndroidQtVersion::androidDeploymentSettings which lets
qmake and Qbs still provide the value as before while handling the CMake
fallback.

Fixes: QTCREATORBUG-25209
Change-Id: I12314d06a45d6e045cb654d9140f9d2ed4602f67
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-02-18 09:34:48 +00:00
Alessandro Portale
72d91dc94a Use qAsConst with non-const Qt containers in range-loops
... in various places

Change-Id: Ic6c0c1b9437a1ed402105c7a14a1f5f9454a68d4
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-02-17 14:43:29 +00:00
Alessandro Portale
9e2c6fbfca Android: Deduplicate string literals and use constants instead
Improves findability of identical string in code (via code model).
Reduces risk of typos.

Change-Id: I0e9d9af8eed5cd9b66bf303cfee99c53513bf314
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-02-10 10:32:15 +00:00
Mitch Curtis
b5ff180f8c cmakeprojectmanager: save files before build
This code path (CMakeBuildSystem::buildCMakeTarget) is taken
when building a specific target, such as when activating
Build > Build for Run Configuration. Building via e.g. Ctrl+B
takes a different code path, so this shouldn't be called more
than necessary.

Fixes: QTCREATORBUG-25276
Change-Id: I362bafda43460eaeac9cbf0f053bf457a76702f1
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-02-04 13:34:40 +00:00
Cristian Adam
6cbdae8070 CMakeProjectManager: Support for multi-config generators
CMake has multi-config generators like:

  * Visual Studio
  * Xcode
  * Ninja Multi-Config

The first two have different special targets for "all", "install",
"package", "test" namely: "ALL_BUILD", "INSTALL", "PACKAGE",
"RUN_TESTS".

All of them need to get the build type passed via "--config <build-
type>" and not via "CMAKE_BUILD_TYPE".

The multi-config generators will use only one build directory.

Fixes: QTCREATORBUG-24984
Change-Id: I8aa7ff73ce2af1e163b21a6504d26fcf95530edf
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-01-21 09:31:30 +00:00
Christian Stenger
1e2e3f8e48 CMakeProjectManager: Fix initial ctest call
CMake settings can avoid to create the build directory
automatically. If this is the case the ctest call fails
due to missing information that is present inside the
build directory.
In this case we need to use the temporary directory that
is used before the build directory is created.

Change-Id: Ie6581e53a671c3e5ad71474d9706285d29bd37a8
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-13 05:27:32 +00:00
Eike Ziller
3f0e7bcbe1 Merge remote-tracking branch 'origin/4.14'
Change-Id: I9d1931b7862f4541ac7a064ff987128afd835cbe
2020-12-07 12:29:44 +01:00
Eike Ziller
eeea1e6c32 CMake: Apply configuration changes to fresh build directories
Fixes opening a new project without existing build folder, changing
some configuration values, and pressing apply or choosing Run CMake.

extraCMakeArguments contains the arguments needed to apply any changes
done in e.g. the CMake configuration list in projects mode.
When pressing Apply, the build directory gets created, and CMake run
with REPARSE_FORCE_INITIAL_CONFIGURATION. But we may not remove
REPARSE_FORCE_EXTRA_CONFIGURATION which might even just have been added
a few lines above after asking the user via mustApplyExtraArguments().

Amends af4e74a972

Task-number: QTCREATORBUG-24936
Change-Id: I5e5547611262490ebdebb30dc1bfc690f1cdedde
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-12-03 10:59:14 +00:00
Eike Ziller
d02afbe6b4 Merge remote-tracking branch 'origin/4.14'
Conflicts:
	src/plugins/projectexplorer/gcctoolchain.cpp

Change-Id: I2136ba89d3aa3c4c2a0e7a4f9d8ba9cec32924ce
2020-11-30 16:14:32 +01:00
Eike Ziller
af4e74a972 CMake: Create build directory when user changes configuration
When opening and configuring a project, Qt Creator first tries to
configure the project in a temporary directory (if the build directory
doesn't exist anyhow). This is nice if you just open a project for
browsing, and the initial arguments are set up correctly for parsing a
project.

But if the user starts changing the configuration, either by changing
variables and applying the change, or by choosing a "QML debugging and
profiling" option, we should create the actual build directory and do
the configuration there.
Otherwise we have issues with redoing the correct configuration in the
actual build directory later on.

Fixes: QTCREATORBUG-24936
Change-Id: I54013a14f68eb7785e866cc2a9c09bbc43b44233
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-11-26 11:30:54 +00:00
Eike Ziller
6172fc8a9d Merge remote-tracking branch 'origin/4.14'
Change-Id: I8543d87779c0da6a876caa046f6852737c9ae680
2020-11-26 10:53:34 +01:00
Eike Ziller
3ef279450b CMake: Don't overwrite existing builds when changing build dir
When changing a build configuration's build directory to a directory
with an existing build (i.e. CMakeCache.txt), do not overwrite it, but
just parse it (running CMake as needed to generate the fileapi
response). Do not ask funny questions in that case.

This solves the pattern that you want to use some preconfigured build
but configured the right kit already with the default parameters.
Switching to a different build directory should simply never "kill"
an existing build in any case (and running CMake with the
"initial arguments" basically kills the existing build in the
not-so-uncommon case).

Change-Id: I54ca1f14d72a11a3bfe5b09ce340b28be321f80e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-11-26 06:48:42 +00:00
Eike Ziller
b243a794aa CMake: Fix missing run of CMake after saving sub-CMakeLists.txt
If you have a project with subdirs, changing and saving on of the
subdirs CMakeLists.txt would just "reparse" the existing project
data again.
Instead run CMake first, so the change actually takes effect.

Change-Id: Ia2b0f8b5681f10d426229470fdc420b3234eccec
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-11-25 16:19:38 +00:00
Eike Ziller
5ca70bdcb3 Merge remote-tracking branch 'origin/4.14'
Change-Id: Iea84f23cf394de13e99a9ed777c8c113e4eff473
2020-11-19 15:38:13 +01:00
Eike Ziller
bdc74ea2a0 cmake: Show errors for unsupported CMake versions
Show an error icon in the CMake settings, and instead running CMake with
unsupported parameters show an error in the Issues pane.

Arguably it should not be possible to select an unsupported CMake
version in the kit settings at all (neither manually nor automatically
when setting up kits), but this is the less intrusive change for now.

Fixes: QTCREATORBUG-24553
Change-Id: I32caa2ce93d28cbd9db90e2004d60da93d32c68c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-11-19 09:51:27 +00:00
Alessandro Portale
b2a766a79a Don't access static functions/fields via instance
Courtesy of readability-static-accessed-through-instance

Change-Id: I71f54244f1e091315dac2943d9e1bfad6efa56a9
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-11-19 08:42:14 +00:00
Christian Stenger
564fa06399 CMakePM: Fix missing include
Change-Id: I7ed4045aa5b6b85fbf6a332161a3ad0e94bff348
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-11-09 12:27:35 +00:00
Christian Stenger
617a8aee2b CMakePM: Start integrating ctest
Gather some more information of a CMake based project to be
able to provide this later on to the AutoTest plugin.

Task-number: QTCREATORBUG-23332
Change-Id: I2beaf0a6456d57871dcf65832f0a79f37fe5fddc
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-11-09 11:02:37 +00:00
Dmitriy Purgin
53115259ba CMakeProjectManager: Add File System virtual folder
If a CMake project cannot be parsed by CMake, it is practically unusable in
Qt Creator. According to discussion in QTCREATORBUG-24677, a virtual
folder with the project's file system view is added to the project
manager as a convenience feature.

Fixes: QTCREATORBUG-24677
Change-Id: I48775bb89c704d3f7e5bb21ec6481bd5cc0f4b6c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-11-09 10:48:14 +00:00
Nikolai Kosjar
888ea6bbbb CppTools: Take "-include" files into account
Fixes: QTCREATORBUG-20602
Change-Id: Ibfc518fc64ed75f93265db800558ec1d2e424bb4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-11-05 08:49:24 +00:00