Commit Graph

47 Commits

Author SHA1 Message Date
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
Assam Boudjelthia
df52de2828 Android: get correct value for ANDROID_DEPLOYMENT_SETTINGS_FILE for Qt 6
CMake with Qt 6 which uses android-${target}-deployment-settings.json
file name, we use substitute ${target} with the root node target name
to get the correct file name.

Task-number: QTCREATORBUG-24678
Change-Id: Ib0c82b947b3217b6b763191b22d91ab9674fedce
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-10-02 07:13:08 +00:00
hjk
61bfd32438 ProjectExplorer: Introduce a ProjectConfiguration::kit() function
For convenience, and use it in some places.

Change-Id: I8f7cb502b37b2fbf4cf2d17cac9c6299558332dc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-09-09 06:27:21 +00:00
Christian Kandeler
a7305a60e0 CMake: Parse project on initial load
When opening a project for the first time, the project has already been
added to the session when the BuildSystem object is created, whereas the
code expected a different order.

Fixes: QTCREATORBUG-24318
Change-Id: I8ccfeab7da4e566670f61bfe677a293033bdfe44
Reviewed-by: hjk <hjk@qt.io>
2020-08-12 09:13:33 +00:00
Artur Shepilko
5b53ac9661 Fix compiler warnings about several unused variables
Change-Id: Ic236efdfdfd997719187eec1c19ad2b7f6c044df
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-06-25 15:23:25 +00:00
Tobias Hunger
1bc3e2f0ba CMake: Be more paranoid about running several cmakes at the same time
Try to be more paranoid about having several cmake binaries run for the
same project at the same time.

Change-Id: I6ceca456e515c0beeff46e6912d15b2dd87283a2
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2020-06-15 10:34:01 +00:00
Tobias Hunger
82555df811 CMake: Add some debug output
Change-Id: I2ae817c5c810b3c97fef2784fe1b5f25cab3c439
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2020-06-15 10:33:15 +00:00
Tobias Hunger
01b0d4f8f5 CMake: Remove magic configuration from CMake
Get rid of magic configuration handling in the CMakeProjectManager.

* Use CMakeCache.txt as the sole source of truth, do not keep
  a shadow copy of configuration in the .user file
* Have initial CMake arguments that are easy to edit in batch
  (Fixes: QTCREATORBUG-18179) used whenever no CMakeCache.txt
  file is in the build directory. These allow for any thing that
  can be passed to CMake on the command line.
  (Fixes: QTCREATORBUG-16296)
* Ask when changes to CMake configuration were not applied
  (Fixes: QTCREATORBUG-18504)
* Run cmake with arguments effecting its configuration only when
  the CMake settings are changed in the UI, run CMake without any
  special arguments in all other cases.
* Get rid of the confusing dialog used to keep settings in sync between
  what is in CMakeCache.txt and Creator (Fixes: QTCREATORBUG-23218)

Change-Id: I26d55be7df733f084f5691ecf7d7b4352f58b8e7
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-09 16:34:00 +00:00
Tobias Hunger
28c22ff57e CMake: Inject special build targets into list of extracted targets
Inject special targets like all, test and install into the list of
targets that get reported by CMake. This makes those available in
the locator again.

Task-number: QTCREATORBUG-24064
Change-Id: I08f1232d243afbe0800c1dc308a00917c98ccf8a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2020-06-03 09:46:45 +00:00
Eike Ziller
5b364de168 Use dialogParent() instead of mainWindow()
There are very few reasons to use mainWindow() directly.
Especially for modal dialogs, using dialogParent() is important, since
that guarantees the stacking order in case of other dialogs currently
being open.

Change-Id: I7ad2c23c5034b43195eb35cfe405932a7ea003e6
Reviewed-by: hjk <hjk@qt.io>
2020-06-02 11:44:53 +00:00
Tobias Hunger
59473389b9 CMake: Remove BuildDirManager
The BuildDirManager was used to switch between different
BuildDirReaders. Now that only the FileApiReader is left, that
infrastructure is no longer needed.

Change-Id: I2d339a3407bb633cff6a8f7502b7b09094f63fef
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-04-30 12:08:08 +00:00
Tobias Hunger
0b9513f273 CMake: Simplify CMake Build System states a bit
Merge handleParsingSucceeded and handleParsingSuccess as well as
handleParsingFailed and handleParsingError.

Change-Id: If4f84bdfa2f59cfa0037a941372a1929996be3bd
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-04-30 08:06:39 +00:00
Tobias Hunger
5bb5c7b904 CMake: Make sure a CMakeBuildConfiguration always has a CMakeBuildSystem
For this to work, we need to make sure no parsing is triggered before
the project is fully set up. Otherwise it would be QTCREATORBUG-23816
again...

Change-Id: If81f4c6b9c82283abdaa8a635f93ebe0bcaf8159
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-04-22 12:09:14 +00:00
Tobias Hunger
5350288e45 CMake: Fix includes all over the CMake plugin
Keep internals internal, remove some unnecessary includes, add
some that should have been there.

This reduces the number of files that get rebuild when working
on CMake internals from over 1000 to about 200.

This patch also moves some code around that ended up being
in the wrong file.

Change-Id: Icd7366ac760dc85031040720418fbb16336dce9b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-04-20 10:05:24 +00:00
Tobias Hunger
74a07f906f CMake: Rename some constants
Rename some constants to get a bit more consistency into the
naming scheme. I am so tiered of missing a constant due to it
not having _ in the expected places!

Change-Id: Ibb5e82ea4e25ccb559352839b96c8a64394f3085
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-04-17 13:24:43 +00:00
Eike Ziller
deb0eaf795 Merge remote-tracking branch 'origin/4.12'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp

Change-Id: I34c3d1fd5be90537e37d15e00b1a0d455d1bf81d
2020-04-14 09:47:38 +02:00
Tobias Hunger
a53308cde6 CMake: Do not create .cmake directories in source dir
Only initialize the CMakeBuildSystem after the
CMakeBuildConfiguration has been fully set up. The "builddirectory"
was still pointing to the source directory, so creater configured
cmake in the source directory, leading to a useless directory being
left in the source tree that does not belong there.

Fixes: QTCREATORBUG-23816
Change-Id: I7c9b6ae1f8d999043e700cd9f2d56418c22f2abf
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-04-09 12:22:32 +00:00
Tobias Hunger
10e79cebc9 BuildSystem: Add buildConfiguration() method
Add a buildConfiguration method that returns the saved
BuildConfiguration or the active BuildConfiguration if none is
set.

Change-Id: I8af25aa1037f59a0091900bac7eb84fed9e5fbb0
Reviewed-by: hjk <hjk@qt.io>
2020-03-23 13:16:15 +00:00
Tobias Hunger
a596421ffc BuildSystem: Clean up use of BuildSystem::(kit|target|project)
Change-Id: I4852689cb54d02bb278f9cd596f1de506a43fc04
Reviewed-by: hjk <hjk@qt.io>
2020-03-20 13:10:01 +00:00
Tobias Hunger
5de0e81d8b CMake: Fix typo in symbol names
I can't spell occurred:-/

Similar typos in 3rd party code (sqlite) has been left in place.

Change-Id: I7cfa9911fc434d42ce3df8e9c7ccb83dc00401e8
Reviewed-by: hjk <hjk@qt.io>
2020-03-19 17:50:21 +00:00
hjk
b0b50257ec ProjectExplorer: Pass extra project files as QSet
They are available in some cases as such, and consumed as such.

Change-Id: I9866c7d7bd817fb19a8b11a0efbe583ed55fe393
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-03-03 09:17:20 +00:00
hjk
1e8f262322 CMake: Compile fix
Amend 7dd8858fa2.  Was not unusused after all.

Change-Id: I18c5f5033ebd8b3e19ebdf4718465d6b4ba6acf4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-03-02 12:13:04 +00:00
hjk
488bd7eddb CMake: Check parseGuard.guardsProject()
... before overwriting the current guard, retaining the
state of the current guard in the error case.

Change-Id: I45ec43d48a9a13b9b59a5bbe6415a457b974b654
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-02-27 16:27:34 +00:00
hjk
0e48783c03 CMake: Use buildConfiguration() instead of target()->activeBc
In case it does the same, it is faster now.
In case it does't do the same, it was something  wrong.

Change-Id: Ic3c237a9349d490bcadb10a5e9f700d68a178dae
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2020-02-24 12:57:03 +00:00
Cristian Adam
f65f260c91 CMakeBuildSystem: Don't re-update code model on CMakeLists.txt saves
Currently if you edit a CMakeLists.txt and then press save, the code
model will be reindexed.

On projects like Qt Creator this operation is quite significant.

Note that the code model is updated after CMake has run on the project,
which is what I would expect.

Saving the CMakeLists.txt and not running CMake has no effect on the
project, and the code model shoudn't be reindexed.

Change-Id: I61289fda60752ef002cf3625d339d4fcaf144d1b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2020-02-20 15:41:28 +00:00
Tobias Hunger
108ab4b715 CMake: Do not start several parsing runs in parallel
This should make the parsing a bit more robust.

Change-Id: I6a8b1758acefaf197a53a68ec4e569582765a0ea
Reviewed-by: hjk <hjk@qt.io>
2020-02-11 16:01:02 +00:00
Christian Stenger
54cd881a40 CMakePM: Fix handling of qml debugging
Add a respective aspect to the build configuration
for handling qml debugging from the build side
similar to what we do with qmake and qbs.

Qml debugging needs to get enabled on the build side
before the settings on the run configuration page
has an effect.

Fixes: QTCREATORBUG-23541
Change-Id: I86267747601015760737d8b21978712896892a37
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-02-07 11:55:37 +00:00
Christian Kandeler
beed0c7396 CMake/Qbs: Do not emit Project::fileListChanged()
...explicitly.
This is already done as part of Project::setRootProjectNode(), and the
signal is connected to some rather expensive operations.

Task-number: QTCREATORBUG-18533
Change-Id: I96ea2f49c866f2b60f599748c4d5b82c790ed2ca
Reviewed-by: hjk <hjk@qt.io>
2020-02-07 09:39:19 +00:00
Tobias Hunger
2da7d205d4 CMake: Add LD_LIBRARY support
Extract all the information necessary for the "Add build library search path
to LD_LIBRARY_PATH" from fileapi and enable the relevant UI in the
desktop run configuration.

This allows to remove a workaround introduced for QTCREATORBUG-19354.

Note that this is only supported by fileapi at this time.

Task-number: QTCREATORBUG-23464
Change-Id: I390d26ed8cd559bd7ff8c2701cd3b1cb8e764339
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-01-22 12:23:22 +00:00
Alessandro Portale
9904464074 Make various Q_LOGGING_CATEGORY's static
Change-Id: I43d3a198b0863d85a7fb305c7cb768f68acbd139
Reviewed-by: hjk <hjk@qt.io>
2020-01-15 14:54:10 +00:00
hjk
e109b731ad Utils: Rename FilePathList to simply FilePaths
The exact storage type does not really matter here.

Change-Id: Iefec40f0f5909c8e7ba3415db4a11962694e1b38
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-12-18 08:43:18 +00:00
Tobias Hunger
0dbe6f8e3c CMake: Add heuristics to set "Run in Terminal" flag
For CMake file-api, flag all applications not linking to "QtXGui"
as "Run in Terminal".

Task-number: QTCREATORBUG-21451
Change-Id: I29f086c546d3d8a9f56257e423602f787db42ccd
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-12 14:55:17 +00:00
Tobias Hunger
a8b96a8240 CMake: More logging of parsing starting/stopped
Change-Id: I52dad9260c21e03add513f7229148635ae76236a
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-10 09:16:22 +00:00
hjk
c2127c9ec4 ProjectExplorer: Introduce and use a Target::buildSystemUpdated signal
Change-Id: I497d46866146600a1ed9162bd720c574ee4d4769
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-11-21 13:08:06 +00:00
hjk
738bbf1a87 ProjectExplorer: Introduce per-buildsystem setRootProjectNode
Currently diverting to the original Project::setRootProjectNode.
Idea is to focus on the BuildSystem <-> generated tree relation.

Change-Id: I8b20173e364713f0919cf4f8b76a2f79ef8770bb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-11-21 07:40:22 +00:00
hjk
95ba85c86e ProjectExplorer: Use a Kit to initialize KitInfo
Change-Id: I70a83ff9a9da814b4e1ad9ce5e0b626105c09ca4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-11-20 11:31:14 +00:00
hjk
2758682723 ProjectExplorer: Move BuildSystem owership to BuildConfiguration
... or Target.

This patch moves build system from conceptually "one per project"
to "one per target (i.e. per project-and-kit)" or "per
BuildConfigurations" for targets where the builds differ
significantly.

Building requires usually items from the kit (Qt version, compiler,
...) so a target-agnostic build is practically almost always wrong.

Moving the build system to the target also has the potential
to solve issues caused by switching targets while parsing, that
used Project::activeTarget() regularly, with potentially different
results before and after the switch.

This patch might create performance/size regressions when several
targets are set up per project as the build system implementation's
internal data are duplicated in this case.

The idea is to fix that by sharing per-project pieces again in
the project implementation once these problems occur.

Change-Id: I87f640ce418b93175b5029124eaa55f3b8721dca
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-11-19 11:05:52 +00:00
Eike Ziller
04bd6e39c8 Merge remote-tracking branch 'origin/4.11'
Conflicts:
	share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.cpp

Change-Id: I8ea57eba526ab830608fd928c28771c5441749f8
2019-11-01 15:31:19 +01:00
Nikolai Kosjar
02a81b89c4 CMake: Simplify
Change-Id: I3e5fd3aebf8b11037d99ff367826ff8f8f436045
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-11-01 09:11:06 +00:00
hjk
6a878c7293 ProjectExplorer: Use a functor for BuildSystem creation
... instead of creating the BuildSystem direct. This will help the
shift of BuildSystem owner ship as a Project will have potentially
multiple BuildSystem instances (one per BuildConfiguration), but
still be responsible for creating them with the Targets.

Change-Id: I2dd71c7687ed41af9e42c874b3f932ce704e7ee3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-10-25 09:01:52 +00:00
Tobias Hunger
aa1cc54b3e BuildSystem: Fix move semantics of ParseGuard and related code
This avoids a spurious set of parsing started/finished signals.

Change-Id: I0c723f2a2ad679a5f6cffddf9f542ebc02192be8
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-10-08 14:20:24 +00:00
Eike Ziller
9cc45fe1fb CppTools: Move RawProjectPart to ProjectExplorer
Doesn't have any dependencies into CppTools anymore, therefore moving it
reduces the dependencies of the project managers to CppTools as well.

Change-Id: Ibe728abe59eb88a8877943dca1f48a85163e27ac
Reviewed-by: hjk <hjk@qt.io>
2019-09-11 06:22:12 +00:00
Tobias Hunger
b7e4046a17 ProjectExplorer: Add BuildSystem class
Add a class to abstract out the BuildSystem from the Project.

Thie idea is to make a Project have-a BuildSystem, so that
it can stop being one.

The Projects in the different ProjectManagers will get much
simpler that way (and many will only consist of a constructor
with some setter calls) and handles all the interactions
between the rest of Qt Creator and the project.

The complex code to interact with the build systems is then
separate from that.

Change-Id: I3bbb000bb1aed91f0b547ac493f743ede8afb8cd
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-29 07:28:04 +00:00
Tobias Hunger
b8be7da158 CMake: Simplify based on Project::projectFileIsDirty signal
Delegate all the necessary file watching to Project and connect
to the relevant signal.

Server-mode insists on watching files itself, so that may not
report extra project files.

Change-Id: If821c54a7b0f8b72beed53dd1c83f255973faf3e
Reviewed-by: hjk <hjk@qt.io>
2019-08-16 12:43:39 +00:00
Tobias Hunger
38e69c907b CMake: Fix marking the parsing run as successful
This missing mark prevented the Run/Debug buttons to become active
again!

Change-Id: If02f300d4bb67424398102a9ce1677f366bb5801
Reviewed-by: hjk <hjk@qt.io>
2019-08-14 10:59:45 +00:00
Tobias Hunger
d115276b34 CMake: Move code from CMakeProject into CMakeBuildSystem
Introduce BuildSystem to implement functionality common to all
build systems out there. This includes things like delaying the
parsing by 1s.

The actual CMake specific code is then moved into a derived
class CMakeBuildSystem.

Change-Id: I84f4344430f19a44e16534db294382c436169ed5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-13 13:13:02 +00:00