Commit Graph

3443 Commits

Author SHA1 Message Date
Marcus Tillmanns
cca7bc98a9 CMake: Fix deployment path
Previously the path would be created based on the build device
instead of the target device. Therefore when building on windows with a
linux target the path might become "c:\usr\bin\..." instead of
"/usr/bin/...".

Fixes: QTCREATORBUG-29797
Change-Id: I13a9941b87b863f3e1b8420bcab230db1f70a28b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-10-27 07:46:51 +00:00
Cristian Adam
5e3d14e2e9 CMakePM: Allow CMAKE_SYSROOT to be taken from the CMake preset probe
One could have a toolchainfile that sets the CMAKE_SYSROOT. We need to
be able to read the value later, and not just from the CMake Presets
cmakeCache array.

Task-number: QTCREATORBUG-29643
Change-Id: I63697219195b043813516c8214329ce583dc0676
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-24 09:13:50 +00:00
Cristian Adam
423315178a CMakePM: Fix display of header / source files
Qt Creator will display the header / source files based on the
sourceDirectory of the target as base directory.

The source_group(TREE <dir>) will result CMake in making a source group
named "TREE" which should not be displayed in the project view.

Amends 9280f7f757

Fixes: QTCREATORBUG-23942
Fixes: QTCREATORBUG-29105
Change-Id: Ib71ffcc559376ea1596a5b21cb7e7fa779bd8d79
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-20 17:15:43 +00:00
Cristian Adam
aef415a25d CMakePM: clang-tidy fix for 'move-const-arg'
See https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-
tidy/checks/performance/move-const-arg.html

Change-Id: Ic20445321286fdcb8b02e1b2cf170e0fe60fd1fd
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-20 13:57:40 +00:00
Cristian Adam
55cccfa59e CMakePM: clang-tidy fix for 'no-automatic-move'
See https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-
tidy/checks/performance/no-automatic-move.html

Change-Id: If265c9b0e2aea49e5923f079cd621e10bb958286
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-20 13:57:34 +00:00
Cristian Adam
69815af272 CMakePM: clang-tidy fix for 'performance-implicit-conversion-in-loop'
Change-Id: I67e5adad19a3454986381c5548bbe96cf1cc1e6a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-20 13:57:28 +00:00
Cristian Adam
43121fa574 CMakePM: clang-tidy fix for 'perf*-unnecessary-copy-initialization'
Change-Id: I9c407f7254328e7278096239f6f3946c34e873d5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-20 13:57:20 +00:00
Cristian Adam
60de12efd2 CMakePM: clang-tidy fix for "performance-unnecessary-value-param"
Change-Id: Ia22d7c3fe6c29a5e0999145b6c4b281818dd72bf
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-20 13:57:15 +00:00
Christian Stenger
531fe36ac5 CMakePM: Silence warning
This is not handling the respective role correctly, just
silencing the warning. No change in current functionality.

Change-Id: Icd904941d5fc496d66b8e1eb7eec0031840f519d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-20 12:51:45 +00:00
hjk
fe129cc0c4 CMake: Reduce number of FilePath conversions in fileapidataextractor.cpp
Change-Id: If143843782b0bfdbdd68ab1a387d0feabfb60a33
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-20 10:27:57 +00:00
Cristian Adam
32b6e6309e CMakePM: Remove remainders of extraGenerator
It was not possible to set the toolset for Visual Studio 2022 generator.

Amends 4f26d802ca

Change-Id: I56caf9c0d66812eb599646a3679602af7372f419
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-20 10:07:17 +00:00
Cristian Adam
105fd8becb CMakePM: Add "share" for CMAKE_PREFIX_PATH for completion
This would allow packages from vcpkg to be found.

Change-Id: Ie0921d9ed6cfe692bc18235bfaf678ede5c98e14
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-19 18:55:26 +00:00
Cristian Adam
cdc7857572 CMakePM: Search for Config modules also in CMAKE_MODULE_PATH
This is allowed by `find_package`, and can be tested with the `fmt`
package provided by conan.

Change-Id: Ib9bf2a6cbd80b8eb322cb6d8a1a9c25af0ca4031
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-19 18:55:09 +00:00
Eike Ziller
a253a2aa95 Tr: Fix lupdate issues
Add missing `Tr::` and use some fully qualified namespaces where lupdate
fails to resolve it correctly.

Change-Id: Ied4ac7bf0438a9080d0b76a9a1f5033dbc94a163
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-18 11:21:52 +00:00
hjk
0e77cdcc2e CMake: save a few cycles
Cheaper checks first.

Change-Id: I7487862abf409ef0a885d6ac9511066a6f814039
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-18 08:08:00 +00:00
hjk
53b3255256 CMake: De-noise fileapidataextractor.cpp a bit
Change-Id: I1ed8b18e394246cbfd14394c7f9b79fd90f680d2
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-17 15:22:02 +00:00
hjk
8845a7f896 CMakeProjectManager: Use a few FilePath::path() instead of toString()
... when appropriate.

Change-Id: I2c23e4688ec69f78b0ce873e578139d5c4e89c35
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-17 15:04:57 +00:00
hjk
b38c7a452e CMakeProjectManager: Fix path construction of pch files
This triggered soft asserts in FileUtils::copyIfDifferent() when
opening top-level qt.

Amends 246f33c20d which introduced a unwanted extra .parentDir() call
which removed part of the path.

Change-Id: Id0475a74a589372d37b7ec65d33d3faf6194013c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-17 14:52:35 +00:00
Cristian Adam
2e2248e80e CMakePM: Allow invalid file characters as part of preset names
The fact that Qt Creator uses the preset name to create a directory and
then import the directory is an implementation detail.

This changeset will allow characters like ":" to be part of the preset
name.

Task-number: QTCREATORBUG-29643
Change-Id: I84a224b78eb3d2233f80d9bdb8bf4478471349b0
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-17 11:37:57 +00:00
Cristian Adam
16b147d563 CMakePM: Expand macros in cmakeExecutable CMake preset value
The specification allows this, so we need to support it.

Task-number: QTCREATORBUG-29643
Change-Id: I8bd0a91ba05d2ed27b7a7af2d268539de020826f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-17 06:36:29 +00:00
Eike Ziller
abeb2287ce Tr: Fix some quoting
Change-Id: I91c515822d48b4efb7c7869c5afe06b5375bf20e
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-10-16 13:16:00 +00:00
Cristian Adam
d7f44cdd24 CMakePM: Enable ANSI codes colored output
Qt Creator is able to display colored output for the _Compile Output_
and _General Messages_ panes.

This commit enables CMake and tools to use this functionality.

See https://cmake.org/cmake/help/latest/variable/
CMAKE_COLOR_DIAGNOSTICS.html and http://bixense.com/clicolors/ for more
details.

Change-Id: Ied4058bbd2522750d559b05d585092830ce3a911
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-10-16 07:29:56 +00:00
Cristian Adam
52fa2c369e CMakePM: Remove compiler group for all generated sources
Change-Id: Ie30bb63c96438d3582a7d2b753b9677a4a95fe9b
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-13 13:30:46 +00:00
Artem Sokolovskii
c8e5db79ba DAP: Fix grey out cmake debug option
Change-Id: Ic4f593c87b874835f923ca5d171f5c78c3fee191
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-12 12:23:22 +00:00
Christian Stenger
344ac9813d CMakePM: Fix crash in rstparser
Change-Id: I5a9e456214581800c977e69da01aab1053cc554f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-12 04:44:47 +00:00
Cristian Adam
c929b71acd CMakePM: Add cache variables to code completion
Change-Id: I5ac4fcf3ca7755ab52ffecafd83922e4e380363e
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-10 18:29:06 +00:00
Cristian Adam
524634f124 CMakePM: Add support for "$ENV{" code completion and help
CMake has a few environment variables that are documented and this
commit adds support for them.

Change-Id: Iaa31bdc97b343581fcf519d19e66bc6ce8ace150
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-10 18:08:13 +00:00
Cristian Adam
afc6d555b3 CMakePM: Do not copy the PerformInputData structure
I needed to add more members to the structure, and will get static
analyser to complain that the number of bytes is to high.

Amends 3984108c0c

Change-Id: I162b9ef615dc7f6f76b08c5599eed24488bf7e88
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-10-10 10:04:14 +00:00
Marcus Tillmanns
f1c3482e0d CMake: Fix default cmake tool
If Boot2Qt devices are registered, their CMake tool would often end up
as the default. Instead now we only auto select a cmake tool on the
local machine.

Change-Id: I677ab06ae88ff36209e691ea0fadb356436e973c
Reviewed-by: hjk <hjk@qt.io>
2023-10-10 08:20:14 +00:00
Cristian Adam
45fb2c0986 CMakePM: Remove pointer check for null
The pointer contains the parent class passed with "this" and will never
be null.

Coverity-Id: 1568097 Dereference after null check (FORWARD_NULL)
Coverity-Id: 1568100 Uninitialized pointer field (UNINIT_CTOR)
Coverity-Id: 1568111 Dereference before null check (REVERSE_INULL)
Change-Id: I40e32d162689c749d498c4a63c073c0e336a3626
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-10-10 07:30:36 +00:00
Cristian Adam
a5f8214c23 CMakePM: Consider local CMAKE_PREFIX|MODULE_PATH for code completion
If projects are using a local "cmake" directory containing
Find<Package>.cmake modules the common practice is to use something like
this:

  ## Add paths to check for cmake modules:
  list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

This commit makes sure that these packages are taken into consideration
for code completion.

Change-Id: I152ccce0c97ab2385eda93ff6bc5fc4e7cefb6c4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-09 14:41:45 +00:00
Cristian Adam
ad13144cc0 CMakePM: Search after packages in CMAKE_PREFIX|MODULE_PATH
This way code completion will have Qt6 package suggestions for
find_packages.

Change-Id: I9ab64425f850a0d990e77a559ce9f121bc9cf2d7
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-09 14:41:35 +00:00
Jarek Kobus
d278923dd4 CMakeParser: Ensure the details list isn't empty
Amends bda5c6a228

Fixes: QTCREATORBUG-29732
Change-Id: Iac518227df42c4d22b808028958210485a9c02ff
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-09 12:15:22 +00:00
Cristian Adam
399e12c973 CMakePM: Fix crash in findLinkAt
Fixes: QTCREATORBUG-29715
Change-Id: I4db919c8858631beb573789d1888b3dbee606c50
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-10-09 10:26:10 +00:00
Cristian Adam
ad680902b2 CMakePM: Fix condition for filtering out non CMake parameters
Coverity-Id: 1515708
Change-Id: I97de84f4db79977d7833337be87ae4877c10136b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-09 10:25:43 +00:00
Cristian Adam
cbeeec2dc6 CMakePM: Fix Coverity issue "Arguments in wrong order"
Coverity-Id: 1526499
Change-Id: I4b5d7c4d12eca39b9c4e60b45ea3e67bce069069
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-10-09 09:14:40 +00:00
Jarek Kobus
3984108c0c CMakeFileCompletionAssist: Limit the size of PerformInputData
The size should drop down to 184 (from 264) bytes.

Amends 07e758147b

Change-Id: Ia07b153f3f75b9e7b6199d857d58bffbb7b3e7d4
Reviewed-by: hjk <hjk@qt.io>
2023-10-09 08:12:41 +00:00
Cristian Adam
1d2c942360 CMakePM: Only process cmake files for include and modules
... and not for every function. Just the CMake files.

Change-Id: I6e361f4913f8334942a3135adaa0480fdc0cee31
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-06 19:41:59 +00:00
Jarek Kobus
ee48dba19e FileApiReader: Make shutdown faster
Check more often for canceled future.

Make more functions static.

Fixes: QTCREATORBUG-27729
Change-Id: I8dd787acea6343008c7515fb6a4fdfde50b37aee
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-06 15:37:12 +00:00
Jarek Kobus
e4ae894c96 FileApiReader: Make stopping faster
On the session switch we are busy waiting for the running async task,
started before by the FileApiReader::endState(). This blocks the main
thread for considerable amount of time. E.g. when switching
between sessions both containing Qt project, it may block
the main thread up to 10 seconds.

Instead, we employ the future synchronizer and move the awaiting
to the shutdown phase.

The next patch is going to limit the awaiting in shutdown phase.

Task-number: QTCREATORBUG-27729
Change-Id: I956ed26edcd699d8a4e2b9309d109963f1d4bb20
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-06 15:37:06 +00:00
Cristian Adam
162f9f59d7 CMakePM: print newline before the message
This way we'll get:
  [cmake]
  [cmake] Elapsed time: 00:05.

And not the other way around.

Change-Id: Ica7352cd112b9017c8a39b98618be69494527be9
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-06 15:25:48 +00:00
Cristian Adam
9ab9c88e0a CMakePM: Include the last error/warning line from call stack
This was the first one reported by CMake, and we need to make sure it's
also included.

Change-Id: I5becfffc1afb35a4f69fd26d8563aa1ea6eaea60
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-05 16:23:41 +00:00
Cristian Adam
224b409013 CMakePM: Fix opening context help via F1 in hover tooltip
Change-Id: I9ebd6a6ec8e00c63bd6f9182ba8530944f3437ea
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-05 15:16:48 +00:00
Alessandro Portale
4d4bc2de7e CMakePM: Theme the CMake output prefix
Change-Id: Ic762867cb7249ae8f4e54e801dc5b6319f3f3e72
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-05 15:15:53 +00:00
Cristian Adam
16dfd2d374 CMakePM: Add "[cmake] " prefix to all output messages
With this one could easily filter the "[cmake] " messages from all the
messages in the "Generate Messages" pane.

Change-Id: I690650f0ccb0372c9361b95cfec41809737720d7
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-05 15:15:32 +00:00
Cristian Adam
edf4280bd9 CMakePM: Support errors with call stack
This is usually the case when using a custom CMake API e.g.
qt_add_executable.

The topmost function is highlighting the error now, presenting the
callstack in the tooltip.

Change-Id: Ic8b8f60e8fe94d88dfa0b384639172370382a421
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-05 15:15:20 +00:00
Cristian Adam
bda5c6a228 CMakePM: Preserve newlines in multi-line error messages
This way the popup message is not spanning the whole screen.
Testable with find_package(Qt7 REQUIRED).

Change-Id: I3f1943b603baa02c55f2f8f63c75908468e69d9a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-05 09:59:39 +00:00
Cristian Adam
08cebc7e08 CMakePM: Fix crash when runing qtcreator -test CMakeProjectManager
Change-Id: I3535c1edd0c72eba3c1bcd50234baeb4c1acecc5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-05 09:25:48 +00:00
Cristian Adam
4875b25e31 CMakePM: Use the cmake logo for actions
Change-Id: Id19c8405e44218ad62da4d60b3d6eb71637033ad
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-04 15:15:24 +00:00
Cristian Adam
f81bf72924 CMakePM: Fix assert with non CMake projects
Amends 7028e27a81

Change-Id: I5d1e29abf19135aea8a401f2b971767f8a308c28
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-10-04 13:56:47 +00:00