Commit Graph

515 Commits

Author SHA1 Message Date
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
hjk
8c713d45a8 CMake: Use new ExecutableAspect
Change-Id: Ic880351802c52b61c53c6730d23dfe3f124ebc44
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-03-29 14:27:14 +00:00
hjk
a5d6fe33cb Partially decouple local CMakeRunConfiguration from CMakeProject
Funnel all relevant data through target.applicationTargets() as
done for the non-local CMake-supporting setups and QBS already.

There is cleanup potential left for later changes.

Change-Id: I49ed6abd98c058a7fd1545e41b3bcd6ecb758a8b
Task-number: QTCREATORBUG-19985
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-03-13 15:02:54 +00:00
Tobias Hunger
835d4e92f3 Project: Improve default implementation of Project::needsConfiguration
Change-Id: Ic4d227334d818658f179c0589462551509274c17
Reviewed-by: hjk <hjk@qt.io>
2018-03-09 12:57:59 +00:00
Tobias Hunger
997ece4361 Project: Remove unused Project::requiresTargetPanel(...)
Change-Id: I7a5298edefd7e26841c4070be23534dd33d093cb
Reviewed-by: hjk <hjk@qt.io>
2018-02-19 13:22:21 +00:00
Tobias Hunger
8059bf6204 Project: Make setRequiredKitPredicate private
Make calling Project::supportsKit(...) the default implementation.

Change-Id: I0e47972097e760e2ff3be229afb85eff839146b8
Reviewed-by: hjk <hjk@qt.io>
2018-02-19 09:28:02 +00:00
hjk
b2a16190e8 Use project id uniformly as project context
The possibly intented flexibility e.g. to have different project types
share the same idea of a common context was never used, in all cases
we had a 1:1 relation ship between project ids and ids that were used
as context. This led to oversights like the one fixed in 60fb35a2.

This patch here uses the project id unconditionally as context and
drops all context ids. If we'll ever have the situation where the
original flexibility was needed, Project::projectContext() could be
made virtual and overridden were needed.

Also, the context was never modified for any given project, so the
updating machinery is not needed.

Change-Id: I3f7fac0ed5e4704e126558987c48577f26082dfd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-12-20 12:35:14 +00:00
Tobias Hunger
f542e24eca Project: Make Project::file take a std::function to match files
Make Project::files take a standard function to match files with instead
of an enum (and a std::function).

Change-Id: I6a24e40dba0e972ff96c0a57e775d2377e2545e0
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-12-08 09:56:29 +00:00
Tobias Hunger
18f38ff18e Project: Make Project::files return a FileNameList
Change-Id: I75ceb22ac65b8288d824f229d44089cba6fc8ea3
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-12-08 09:09:59 +00:00
Tobias Hunger
216e40b3f0 CMake: Fix tree scanner not getting run automatically
This lead to <Headers> entry being missing from the project tree.

Task-number: QTCREATORBUG-19333
Change-Id: Ice3bab6d92aaa3799e66800cbae0bacd57537322
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-11-21 10:19:53 +00:00
Tobias Hunger
a65630ef8c CMake: Pass C toolchain on to the project model
Change-Id: Ice833d9b180d7bac109c7cdf9e63fdba0bbce86e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-01 14:19:10 +00:00
Tobias Hunger
4acb16272d CMake: Enable switching between different temporary CMake configurations
This got broken when moving the BuildDirManager from the BuildConfiguration
into the Project itself.

As a side-effect this patch also fixes the persisting of cmake state.

Task-number: QTCREATORBUG-19075
Change-Id: I1fc696097b09f5285e67f20885eb1fa27504990b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-24 11:13:42 +00:00
Tobias Hunger
0a5f32ff75 CMake: Fix crashes when last target is removed from a project
Task-number: QTCREATORBUG-19112
Change-Id: I17893c3e15e9cabc09bf5ebb6746a5d76d9cc0bd
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-10-17 14:46:49 +00:00
Tobias Hunger
02533e61cf CMake: Fix project parsing notification
This builds on top of 08677c0b01 and
fixes one more code path to go through a common entry/exit point.

Change-Id: I1d00fa9242f247028e5d3b0ef3b5fe1d3f4cb03d
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-06 09:53:40 +00:00
Tobias Hunger
08677c0b01 CMake: Quieten soft-assert on small project loads
The directory tree scanner and the project parsing work independently of
each other. Add logic to combine these two sets of results into one
parsing state.

Change-Id: I46e94f0e866b40ee7225235c536c742cecf11b45
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-26 14:31:25 +00:00
Claus Steuer
100cd10d6e CMake: Set CMakeRunConfiguration executable and working directory
Since 131c7a1 the executable and base working directory property of
CMakeRunConfiguration objects is no longer set when the project data
is updated. At least the executable is required in the AutoTest plugin.

Change-Id: I31c4cb37983d3983664d178c0f8c08d491f719ad
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-24 12:23:45 +00:00
Marco Bubke
b6e12f4a1c Convert macros from plain QByteArray to a vector of structs
The old code model expected the macros as C++ formatted text
("#define Foo 42) but newer targets like the Clang codemodel expect key
value arguments like "-DFoo=42". So instead of parsing the text again and
again we use an abstract data description.

Task-number: QTCREATORBUG-17915
Change-Id: I0179fd13c48a581e91ee79bba9d42d501c26f19f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-14 15:23:56 +00:00
Eike Ziller
ca959d8063 Merge remote-tracking branch 'origin/4.4'
Change-Id: Ic9a1cf3b40b259d9c77f2f542405d189171e0fbf
2017-09-05 12:15:42 +02:00
Ivan Donchevskii
410e31c665 CppTools: set default -std=c++11 for Qt4
qmake from Qt4 does not provide C++ standard and
clang can't properly compile Qt4.8.6 and earlier
with c++1z. Behavior in this commit mimics qmake
from Qt5 which also provides c++11 as a default
standard.

Task-number: QTCREATORBUG-16441
Change-Id: I3d29891d6e47f2367f2b3b2bf4be4d86661924e9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-05 09:37:14 +00:00
Tobias Hunger
131c7a1c4e ProjectExplorer: Introduce base class for enabled/disabled project configuration
... and use this as a base for all RunConfigurations.

Clean out code in the individual run configurations dealing with their
enabled/disabled state.

Change-Id: Icc2ea136b056f7aea7ce96480b4402459d7ac0ce
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-28 17:26:03 +00:00