This will add the new added source files (.cpp, .h, .qrc, .ui) to the
corresponding CMake source file as last arguments for known CMake
functions like add_executable, add_library as well for the Qt
counterprarts qt_add_executable or qt_add_library.
For custom functions the code will insert a target_sources() call.
Subsequent calls will add the files to the last target_sources.
The previous copy to clipboard mechanism and settings have been removed.
Fixes: QTCREATORBUG-26006
Fixes: QTCREATORBUG-27213
Fixes: QTCREATORBUG-28493
Fixes: QTCREATORBUG-29006
Change-Id: Ia6e075e4e5718e4106c1236673d469139611a677
Reviewed-by: hjk <hjk@qt.io>
Utils::mimeTypesForFileName would only return "text/x-c++hdr" for .h
files. This is perfectly fine for C++ source files.
The ancestor "text/x-chdr" is required for C source files though.
Fixes: QTCREATORBUG-28991
Change-Id: I21f038787e48e88b5e4b9e8ca386b3af80d098ea
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Basically a.onDevice(b) == b.withNewMappedPath(a), matching the order
of b.withNewPath(a).
Whether the (curretly docker-specific) path mapping is useful /there/, and
whether some of the calls are needed at all is dubious. I added some
FIXME and changed a few cases directly.
Change-Id: I7514736ce922f632f1f737bc496f6783389a42b6
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...
While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only
Change was done by running
find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;
Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
When running on the remote build device. And make it work with CMake.
Change-Id: If25bef8ab836c1d59a586116b3c3447a29c4e7e8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
An option is added to change the default behavior that
would create subfolders inside source groups for files
based on their location on disk.
When disabling the option, files will be added directly
under their respective source group.
The virtual folders <build-folder> and <other-files>
is also omitted when the option is disabled.
Fixes: QTCREATORBUG-27432
Change-Id: Id78e178011c5299d4f7257bf855a5d791eebf91c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
CMake splits sources files into groups "Source Files" and "Header
Files".
CMake also has compiler groups when source files are compiled
differently.
Qt Creator is mapping the compiler groups as RawProjectParts.
In order to get the header files as part of a RawProjectPart the target
sources (which contains all sources) is mapping the header files that
match the mime type of the compiler group language type.
.h header files were considered ambigous headers, and in this
commit we treat them as the compile group language header.
Fixes: QTCREATORBUG-27117
Change-Id: If68e847846cc270f06fc2231ec44a29ea6a987c1
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
So far we only looked at a target and added all paths of actually linked
libraries to the ((DY)LD_LIBRARY_)PATH, if the "Add build library search
path" option is on (the default).
That often is fine, but
- if the library to link to is only given as a library name, not a path
and not a CMake target, then CMake file-api doesn't give us a path to
the library either
- on Windows, where the .lib is needed for compiletime linking, but the
.dll is needed for runtime linking this only helps if the .dll was in
the same directory as the .lib
We already have a hack on Windows, if the directory ends in /lib, that
we also add /lib/../bin, but that again only helps for that specific
layout.
Instead actually add the "build library search path", by adding the
directories from target_link_directories, even if no libraries are
linked from there. This fixes the "linked only by name" issue, and
allows users to add a build library search path to the .dll too, and
have that used by Qt Creator for running the application.
Fixes: QTCREATORBUG-27201
Change-Id: I7b9210b791b4dae3a6d1747ff36e4b82235db2f9
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
- configure with QTC_USE_NEW_MIMEDATABASE to switch to the new one in
utils/mimetypes2/
- added utils/mimeutils.h header for the Qt Creator specific static
wrappers, that also includes the "public" headers for MimeType et al
from the new or old implementation, depending on configuration
- change all utils/mimetypes/ includes to utils/mimeutils.h
- move the implementation for the wrappers to
utils/mimetypes(2)/mimeutils.cpp
- also move the MimeDatabase declaration in the "old" implementation
back to utils/mimetypes/mimedatabase.h
Change-Id: Ie8de229c035d6cd9a5e4739dc0fa78d9c17228e3
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Detect that constructor of ResourceTopLevelNode is being
run from non-main thread and omit creation of ResourceFileWatcher
in this case. The construction of ResourceFileWatcher
will be postponed until the node tree returns back
to the main thread. This happens later inside
Project::setRootProjectNode() when ProjectTree::applyTreeManager()
is called for the second time - this time it's done from the main
thread. In order to setup the lacking resource file watchers
we install an additional folder node visitor only in case when
the handler is called from main thread. The visitor
sets up the lacking resource watchers if that's still needed.
Amends: 0bcab32657
Fixes: QTCREATORBUG-26417
Change-Id: Ia1bfb7f284afb833b6b4291accc4d0a91bd0d6c5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
The change that treats header files as projects added all sources for a
certain language for every compiler group.
This meant that for the target that has precompiled headers, the source
files would be added multiple times.
This change reverts to adding only the source files from a compiler
group and the header files for a language type, but only for non PCH
compiler group.
Fixes: QTCREATORBUG-26383
Change-Id: Ib328e0a0331e0f373d5a5981489bc17c58b8eed6
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Don't lookup for matching targetDetails on every iteration.
Before we start a loop we prepare the appropriate hash and
use it on every iteration instead.
This shortens the total time spent on findOrDefault
from about 2 seconds to about 10 miliseconds now.
Change-Id: I89bb3f472bc9071a54f9900fa057f87b57d4742d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Don't search for each target separately in the node tree,
but do a one search for all targets at once.
This makes searching for nodes much faster, as in case
of loading a Qt6 project (5 main modules only) with debug build
of Creator, the searching time went down from 36 seconds into
30 miliseconds (just 1000 times faster). The number of targets
in this case was more than 5000.
Change-Id: I015f6fd2a2d5e613307cc7b65746c01a5b14c6dc
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Also mark the CMake configured generated precompile header files as
generated, so that the "Hide Generated Files" filter menu entry would
take them into account.
Fixes: QTCREATORBUG-25125
Change-Id: I0ec1cc923e361ae9b599eef1a039695e749a033a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
The file tree scanner will only be started on CMake configuration
failure to generate the <File System> fall back project node.
Change-Id: I873ef1189fd43dc9bffa03aeafabb00bb3b8b6af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
CMake projects need to add the headers as source files in order to get
exported from the CMake file-api json export.
Having header files that are not part of the project displayed in the
<Headers> node is error prone and confusing.
This also means that you won't get bogus files when doing git commit
for example.
Fixes: QTCREATORBUG-18206
Fixes: QTCREATORBUG-24609
Fixes: QTCREATORBUG-25407
Change-Id: I89ac4f8a80f452119f8a991b9e4ef14efb7a86b9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
CMake doesn't associate header files in a compiler group in the
file-api export. But it does list them as source files if added
to the source files of a target.
By using the CppEditor::ProjectFileCategorizer we can sort the
header files to the right compiler group.
This way one could have the clang-tidy and clazy run on a header
file. Or the TODO plugin find TODOs in header files. Or the Autotest
plugin finding Google Tests in header files.
Fixes: QTCREATORBUG-23783
Fixes: QTCREATORBUG-23843
Fixes: QTCREATORBUG-26201
Fixes: QTCREATORBUG-26238
Change-Id: I8acace48e89fd9b3da8bce1c479dec7891e1bbd4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
There was already a similar function taking a QString.
After that, the remaining no-argument version of absolutePath()
can be deprecated.
Change-Id: I5b9ad8c8b68a5723891b0aa9f5a37e90db0fe09e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
This will allow for the Qt Creator's CMake build only qtcreator
target to be selected as runnable.
Similar to qmake's qtc_runnable or Qbs's qtcRunnable features.
Fixes: QTCREATORBUG-25908
Change-Id: I6416873d0ad9cfec4960d98fc4b289ec98cc58b1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
For CMake and Qbs projects and users of TreeScanner, where the tree is
already created in a separate thread.
Expanding the QRC nodes means reading and parsing the QRC files, which
can take up a considerable time (second(s)) if there are hundreds of
them in a larger project like Qt Creator.
Task-number: QTCREATORBUG-25783
Change-Id: I5ca818b9f75ea6e8ef23f837cc9e15df7e6630e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
QDir::cleanPath(...) doesn't do the right thing on stringified
Utils::FilePaths. Use FilePath functions instead.
Change-Id: Ied66f38dd30a15694bce12ed57d37411bb87f680
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
The main QtcProcess interface is nowadays a CommandLine, with no
explicit references left to QtcProcess::Arguments and related static
helper functions, so it only clutters the QtcProcess class interface
So move these items out of QtcProcess, later potentially to a separate
file pair.
Change-Id: I45c300b656f5b30e2e2717232c855fdd97c2d1d7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Creating QIcons elsewhere is not safe because of image reader plugin
loading and the pixmap cache.
Fixes: QTCREATORBUG-25301
Change-Id: Ia22a0cd571f808d7f5c639353fdf2e548743f8ca
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
If a project specifically links to a library in a standard path (like
/usr/lib/...), we do not need to add that path to LD_LIBRARY_PATH.
Actually adding it can be harmful if the build needs to link against
some other library in a different version than is available in the system
path.
Common case is linking the application against a Qt version from the
online installer. If /usr/lib/... ends up in the LD_LIBRARY_PATH before
the path to the Qt from the online installer, the system Qt is picked up
at runtime instead of the Qt from the online installer.
Fixes: QTCREATORBUG-25292
Change-Id: Ib080e41f5893fb68e9d65cc9c9f11d1a9a60f485
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
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>
Clang code model can break if CMake project uses precompiled headers.
QtCreator will make a copy of the precompiled header, this way it
will not conflict with the build system one.
Ammends 888ea6bbbb
Fixes: QTCREATORBUG-24945
Fixes: QTCREATORBUG-25213
Change-Id: I149fc416cd047683d095758a024de47c7baf681c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Mark some of them with Q_UNUSED, since it looks like
sometimes the copy is done on purpose, to force detach
or used for some hack with memory management.
In one case make unused variable used again.
Change-Id: I3825cd3399fa63bf6e12173c64509287d4a125e5
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
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>