Commit Graph

484 Commits

Author SHA1 Message Date
Tobias Hunger
afc1b854eb CMake: Remove useless code
Change-Id: I2e4e5f834f99e2c14e0f81c106abec2c1e0a3a87
Reviewed-by: hjk <hjk@qt.io>
2019-08-09 09:24:34 +00:00
Tobias Hunger
ac091622e4 CMake: Move code from CMakeProject into CMakeBuildConfiguration
Move code closer to the BuildDirManager that was moved into the
CMakeBuildConfiguration.

Change-Id: I21d7188e4a3b03a02b12b01c7dd3e46754d653f8
Reviewed-by: hjk <hjk@qt.io>
2019-08-05 15:49:06 +00:00
Tobias Hunger
338a7184a5 CMake: Move builddirmanager into CMakeBuildConfiguration
Change-Id: I1854b6021e7d573abd4ac9d64c8d5dbd0618ed71
Reviewed-by: hjk <hjk@qt.io>
2019-08-05 15:48:57 +00:00
Tobias Hunger
86c4416af6 CMake: Handle environment changes in cmake better
Handle environment changes in cmake better.

Server-mode will trigger an reader-change when the environment changes.
This has not been considered so far and a reader-change triggered by
an environment change was considered an error (and ignored).

Change-Id: I2d0baadbcfc86e04348c75d8e5997817bdc233a5
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-30 15:38:19 +00:00
Tobias Hunger
ea34cb2b4c CMake: Make "Run CMake" menu entry reliably run cmake
Task-number: QTCREATORBUG-19704
Change-Id: I575e530ad28641753fd57d371dbf081f4a13b337
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-23 11:11:12 +00:00
Christian Kandeler
b1dbd7e358 ProjectExplorer: Update run config list centrally
This prodecure requires no further information from the specific project
managers, so we can start it from the ProjectExplorer itself.
Also wait until after project parsing has officially finished and the
run configurations have updated their "enabled" state. Otherwise,
RunConfiguration::isEnabled() will always return false, potentially
leading to the active run configuration getting switched
unintentionally.

Fixes: QTCREATORBUG-21692
Change-Id: I32f4f758b5baa6222329d07b811993568eff1ee3
Reviewed-by: hjk <hjk@qt.io>
2019-07-22 14:02:57 +00:00
Christian Kandeler
f7520b7d99 Make the project managers tell the code model about include paths
... from the environment.

Fixes: QTCREATORBUG-17985
Change-Id: I9b54e550121cfcc0684a6e173337d59d235c6107
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-07-12 09:13:42 +00:00
Tim Jenssen
1df6443d4a Merge remote-tracking branch 'origin/4.10'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/libs/utils/synchronousprocess.cpp
	src/plugins/baremetal/iarewtoolchain.cpp
	src/plugins/cmakeprojectmanager/cmakeproject.cpp
	tests/unit/unittest/CMakeLists.txt

Change-Id: I124ad492df403286751e175d27fe36487ddf6d07
2019-07-04 15:17:55 +02:00
hjk
6a58666f44 More Utils::toSet/toList
... and unrelated cosmetic changes.

Change-Id: I591b17fd5289831e701b683f8fb47816efd1fa67
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-04 12:28:38 +00:00
Christian Stenger
18d96ba833 CMake: Fix compile with MSVC
Change-Id: I3f15a36579aa7bd77db1fd5d034c46cb22331a4f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-06-21 09:19:06 +00:00
Tobias Hunger
66a875ac53 CMake: code cosmetics
Change-Id: Iebe736aa82bbd8f713d304d10fe6a30707b3adef
Reviewed-by: hjk <hjk@qt.io>
2019-06-20 14:41:15 +00:00
Tobias Hunger
5bcd59c94f CMake: Simplify buildkey generation
Just use the target name as buildkey. This is unique in cmake projects, so
there is no need to mangle the source directory into the whole thing.

This is a problem since different readers might report different source
directories. That will then result in RunConfigurations getting duplicated
after switching the reader types.

Task-number: QTCREATORBUG-22129
Change-Id: I849ab68f221d732341e98faa9a4e757d3a495b2a
Reviewed-by: hjk <hjk@qt.io>
2019-06-20 14:41:04 +00:00
Tobias Hunger
129c0abb5a CMake: Get some timings about the data update process
This should help to remove UI blocking by pointing to the costly
operations.

Change-Id: I8b3250e9ec5995c7b6a705337d60250554b77b53
Reviewed-by: hjk <hjk@qt.io>
2019-06-20 14:40:45 +00:00
Tobias Hunger
67186c761f CMake: Add logging category for generic cmake stuff
Use the category in CMakeProject.

Change-Id: Idb19a92080884f1feff082d8e9db3ca5336b9249
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-06-20 13:47:39 +00:00
Tobias Hunger
0679671547 CMake: Better display name in project tree when parsing fails
When project parsing fails, then the project node might be non-nullptr but
empty. This case is handled in setRootProjectNode(...), where such a
node gets discarded (rootProjectNode() will return a nullptr afterwards).

In this case, do not use the project name that came in from the parser as
it might be wrong.

Change-Id: Iec11aa2d88cca7352d957f428aab24b0f1affd49
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-06-20 13:47:23 +00:00
Tobias Hunger
a95eb53d3b CMake: Add initial fileapireader class
Change-Id: I620cba7cc1c2a5ac56789fa9770dce573c6b19cd
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-06-20 12:25:36 +00:00
Tobias Hunger
e2d6c0bfea Project: Avoid copying the entire files(...) list
Avoid copying the entire list of files known to a project just to
filter out a couple of files from it.

Change-Id: I58b2e323f9678058ba482353eb777a55189fe05d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-19 13:40:28 +00:00
Tobias Hunger
65658f411b CMake: Unify error reporting for builddirmanager's information retrieval
Use a dedicated errrorMessage out parameter for error reporting in
the builddirmanager methods related to information retrieval. Those are
called after the parsing has finished.

This frees the errrorOccured signal of the builddirmanager to be used only
when the parsing itself has failed.

Change-Id: Ieefc32c0386769479177a6bd4bc4a0e77df5db7b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-06-13 12:36:44 +00:00
Eike Ziller
f3011f057c Merge remote-tracking branch 'origin/4.10'
Conflicts:
	src/plugins/debugger/cdb/cdbengine.cpp

Change-Id: Idcfd19292730d2b0e67816715f7aa2cc0eb71c48
2019-06-13 14:03:02 +02:00
Eike Ziller
39477594da Merge remote-tracking branch 'gerrit/4.9' into 4.10
Change-Id: I033d6baa40af45ae1eb6ed82827ff51213c832f5
2019-06-13 13:53:02 +02:00
Tobias Hunger
66dc831398 CMake: Do not QTC_ASSERT when Qml support is disabled
Change-Id: Ifb84aeb252053e1e6d856650d6ec54c27d589fa0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-06-13 11:48:58 +00:00
Tobias Hunger
08d905ae3d CMake: Store pointer to CMakeProject in BuildDirManager
Use this back-pointer to validate the buildconfiguration.

Use the validated buildconfiguration consistently. In theory
the buildconfiguration is valid at all times (since deleting
a buildconfiguration will trigger an update to the parameters
in BuildDirManager), but better be safe.

Change-Id: I614d9ce16e4974a9437a2f44756f01c71a5ede13
Reviewed-by: hjk <hjk@qt.io>
2019-06-07 11:07:16 +00:00
Christian Kandeler
0c74f6cc21 ProjectExplorer: Add "build for current run config" menu entry
This lets users build the executable corresponding to the currently
active run configuration. It's functionally equivalent to locating the
corresponding node in the project tree and choosing "Build" from the
context menu.

Fixes: QTCREATORBUG-22403
Change-Id: Ic2b729c7ce17f1ad944dc06746bb9d6db90b6c61
Reviewed-by: hjk <hjk@qt.io>
2019-06-06 15:05:56 +00:00
Tobias Hunger
6a3ec1928c CMake: Remove needless tests
These tests were done just before calling these methods.

Change-Id: If9801609ff8b1c18d8cc6b446e80a998abc2a5cf
Reviewed-by: hjk <hjk@qt.io>
2019-06-06 14:13:42 +00:00
hjk
fa38a31644 CMake: Use Utils::CommandLine for CMakeBuildStep
Change-Id: I0490b1edf073c680f24ad7de10b544443ae62c5e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-03 11:20:39 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
hjk
2b1c8aa877 ProjectExplorer: Introduce a alias for QList<Tasks>
Change-Id: I91391ad22b420926b0f512cac23cfe009048b218
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 05:51:40 +00:00
hjk
dc9cbd8f57 More FileName::appendPath() -> .pathAppended() changes
Change-Id: Ibc7eb4eb3ffb64658e441aafa240b1ddc0061930
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-27 09:10:19 +00:00
hjk
f4c9e5e5c4 More FileName::appendPath() -> .pathAppended()
Change-Id: I403d34e4f52f758339c158efc7a11fd329e3e043
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-17 11:55:04 +00:00
hjk
9433b8a7e7 ProjectExplorer: Use Utils::FileName in ProcessParameters
For the command and the working directory.

Change-Id: Ia69dc7100aeb57bb6e1b35f4dd4f3cf3763d8cda
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-15 12:55:22 +00:00
Christian Kandeler
261d7752b0 RemoteLinux: Retrieve deployment info from local install root
This provides correct deployment information as seen by the build system
when Qt Creator cannot retrieve it directly.
It's most useful for autotools and cmake projects, but can also help
with qmake in certain edge cases.

[ChangeLog] It is no longer necessary to provide a
QtCreatorDeployment.txt file when using CMake projects with remote Linux
devices.

Fixes: QTCREATORBUG-21855
Change-Id: I27e07a45dd1565e489f4b573cc3fff8191c57d9b
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2019-04-23 15:52:05 +00:00
BogDan Vatra
26463a2219 Say hello to Android CMake support
Requirements:
 - NDKr19 or newer
 - Qt 5.12.1 or newer

QtCreator supports the following variables:
 - ANDROID_PACKAGE_SOURCE_DIR
 - ANDROID_EXTRA_LIBS

Be aware, that there is a lot of magic done on QtCreator side, and you
can't use only cmake to build an Android APK.

[ChangeLog][Android][CMake] Add Android support for CMake projects.

Change-Id: I1d351976ed56f424c2bc972f4ff7b5968147a2ed
Reviewed-by: hjk <hjk@qt.io>
2019-03-06 14:47:27 +00:00
Christian Kandeler
83dd031960 ProjectExplorer: Rename KitInformation to KitAspect
The name "KitInformation" does not properly convey the fact that it
represents a certain *aspect* of a kit. The same goes for
"KitConfigWidget", which in addition was inconsistent with
"KitInformation".
We now use "KitAspect" and "KitAspectWidget".

Change-Id: I9804ee4cedc4d61fad533ea1dd4e4720e67fde97
Reviewed-by: hjk <hjk@qt.io>
2019-02-11 11:55:01 +00:00
Bernhard Beschow
719a51a03d CMakeProject: Update attribute in update method
createGeneratedCodeModelSupport() can now be marked const and is renamed
since it doesn't create GeneratedCodeModelSupport instances any longer.

Change-Id: I8b4b8e8980623841889bd3a03e5fe8c1d4342cb3
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-01-28 12:18:28 +00:00
Bernhard Beschow
693e2649a4 CMakeProject: Prefer assignment to out parameter
Also change method names from update...() to create...() and mark as
const. This communicates that the objects the methods are called on are
neither altered nor updated.

Change-Id: I29e84dc398ded3ffcbf90741227362c6b4be2bf9
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-01-27 12:13:45 +00:00
Alessandro Portale
eef5131962 Fix: Emit keyword being used with non-signal
-Wclazy-incorrect-emit

Change-Id: I02e54b1170fdd812f3bfee97e9b7ecd6b0560270
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-01-15 08:53:29 +00:00
Nikolai Kosjar
7b494c068e CppTools: Simplify ProjectUpdateInfo
...by using KitInfo.

Change-Id: I17b4dd6c368ba8b10b765f12a4663c041c9be7e5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-10 07:13:49 +00:00
Nikolai Kosjar
4ce9ec5d63 CppTools: De-duplicate code for CppProjectUpdater
Centralize gathering the kit, toolchains and qt version.

Change-Id: I6bd586ac7925e2ee556fd119f1dab096cd500e41
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-10 07:13:38 +00:00
hjk
ce43f6fbb4 Cmake: Move some code from project to build configuration
Less use of activeBuildConfiguration and activeTarget.

Change-Id: I9fa77a0084c5701e86530e4f9845c47baddaed4e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-01-09 12:08:05 +00:00
Bernhard Beschow
3bdb7d1de5 CppProjectUpdater: Remove unread attribute
Change-Id: I51123e5b5609de431cfa6d1558aed0b9739ff9c8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-06 21:49:28 +00:00
Alessandro Portale
17f169c291 CMakeProjectManager: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using

Change-Id: I6a272bc3b75835840b3d6cbe83be6f50f94bbedb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-11-25 07:50:15 +00:00
Christian Kandeler
73b1a765f3 Move evaluation of QtCreatorDeploymentData.txt to ProjectExplorer
We want to re-use it outside of the CMakeProjectManager.

Change-Id: I7550f86704bb7c2a683e831cf8827d5b0f6d90f6
Reviewed-by: hjk <hjk@qt.io>
2018-11-14 13:03:12 +00:00
Robert Loehning
4032f6383a Fix frequent typo
can not -> cannot

Change-Id: Ie872ada1bc9b4ed64bffb667c2e44dbb13b4ad11
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2018-10-23 09:30:20 +00:00
Nikolai Kosjar
5900766ecb Toolchains: Detect unspecified language version
We checked the command line from the project manager for "-std=X" and
friends to figure out the language version to use. However, if such a
flag was not provided, we assumed the latest version we support. This
could conflict with the actual version of the compiler and its
predefined macros.

Figure out the version by inspecting __cplusplus/__STDC_VERSION__ in the
predefined macros of the toolchain. The MSVC compiler is an exception to
this, as it does not seem to properly set the value - check for
_MSVC_LANG if possible, otherwise simply assume some versions as before.

While at it, add also support for C17/C18 and the upcoming C++2a.

Task-number: QTCREATORBUG-20884
Task-number: QTCREATORBUG-21188
Change-Id: I464ffcd52d2120c0208275a050e82efda44fae1c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-08 09:07:56 +00:00
Eike Ziller
6e66b2a078 Remove some lambdas from Utils::transform calls
It is often possible to user (member) functions or members directly.
That improves readablility and potentially reduces the total number of
symbols.
Also use qobject_container_cast at places where it is appropriate.

Change-Id: Ia2591bca356591e001e2c53eeebcf753e5bc3c37
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-05-28 13:45:20 +00:00
Tobias Hunger
fdccc54275 server-mode: Always try to read CMakeCache, even after error
Change-Id: Ib3d4fb5ac14340a7f706e4a1d8a0cbdc420d01d1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-22 15:21:54 +00:00
Tobias Hunger
5754d5accf ProjectExplorer: Use unique_ptr for Project::setRootProjectNode
Change-Id: If63a49d0eecfb93adcc6076fcb3208c87603af10
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-02 11:34:35 +00:00
Tobias Hunger
460fdc02e0 ProjectExplorer: Report project-specific kit errors/warnings
Report project-specific warnings about the kit used in Project Mode.
E.g. a python project should not complain about missing toolchains,
while a qmake project should.

Change-Id: I5ce6742683cdeffc7ff3f1a3e8f0b89aee9aa0b4
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2018-04-19 13:21:45 +00:00
hjk
bc698d4ce6 ProjectExplorer: Consolidate RunConfiguration identifications
The previously per-Project/RunConfiguration changing meanings of
BuildTargetInfo::buildTarget have by now been split
into separate values in BuildTargetInfo:
  - buildKey     a handle to one item in Target::applicationTargetList
  - displayName  a user-visible string in the run settings page

The buildKey was tweaked to coincide with the previous 'extraId',
i.e. the non-RunConfiguration-type part of the project configuration
id that (still) use id mangling.

This allows replacing the cases of locally stored seven different
versions of buildKey(-ish) data by one RunConfiguration::m_buildKey,
and do all remaining extraId handling in RC::{from,to}Map only,
i.e. remove the base ProjectConfiguration::extraId() virtual and
remove the "re-try fromMap with mangled id" hack entirely.

The id mangling is still used to temporarily maintain .user file
compatibility in some cases for now, but should be replaced by
storing the build key and the RunConfiguration type soon. Qbs
already changes in here to only use the uniqueProductName as
buildKey, without the previously added display name which is
stored as part of the ProjectConfiguration already.

It turns out that RunConfiguration::buildSystemTarget was intended
and used to retrieve an item from the Target::applicationTargetList
for some configurations, coinciding with what buildKey does always.
So use that insteand and drop RunConfiguration::buildSystemTarget.

There is clearly is further consolidation potential left.

handling of (default)displayNames is still a per-runconfiguration
mess and there is further consolidation potential left.

Change-Id: I448ed30f1b562fb91b970e328a42fa5f6fb2e43e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-12 12:11:45 +00:00
Orgad Shaneh
7d3a79c696 Utils: Purge asConst
Replace by qAsConst.

Change-Id: I3301366f73c066c86f08df7188d70dc3b613c55c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-04-09 09:04:00 +00:00