Commit Graph

111 Commits

Author SHA1 Message Date
hjk
3aa324ef1f CMake: Make CMakeConfig a proper class
Looks a bit more "object oriented" in my book.

Change-Id: I6a3b1b4691ec1c7465f652608678e8f31e7e52a7
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-07-21 13:25:30 +00:00
hjk
f8c7d2e848 Docker: Rework auto-detection and removal of kit items
- Use more uniform messages for the different kinds of items
- Remove all auto-detected items

Change-Id: I0b0df0bca484337039432b163bd8e19593b1cd22
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-14 12:55:53 +00:00
Tim Jenssen
22121885fe baseqtversion: commands are FilePathes
also renamed the qmlscene* qmlRuntime*

Change-Id: Ifd522e21f5ce30aaa54060fdcebee2cd8b9463c4
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-07-14 09:50:01 +00:00
Tor Arne Vestbø
a71d725e46 Add workarounds for running under Rosetta on macOS
When Qt Creator is built as an Intel binary, and runs on
an Apple Silicon (ARM) Mac, it will be run via the Rosetta
translation layer. This means any process spawned by QtC,
including qmake, CMake, and lldb, will launch as x86_64
binaries as well.

For qmake and CMake, this affects their default choice of
build architecture, resulting in x86_64 builds of user
applications. We want to produce native arm64 apps, even
if Qt Creator itself isn't one, so we explicitly detect
the situation, and if Qt has an arm64 slice, we default
to arm64 builds.

The logic of adding CONFIG+=x86_64 to the qmake step has
been disabled, as the assumption that a single qmake run
and build will produce only a single architecture does no
longer hold. The corresponding logic in Qt was removed
in 2015 (qtbase f58e95f098c8d78a5f2db7729606126fe093cbdf).

In the case of lldb, running it as an x86_64 binary fails
to attach to the running application. We work around this
by using the 'arch' tool to explicitly launch it as an
arm64 binary. This works for debugging both arm64 and
x86_64 applications.

Change-Id: I65cc0f600223990f25c76cef18d927895e551260
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-07-13 11:18:23 +00:00
hjk
6d26f4f5b0 CMake: Allow autodetected tools to associate themselves with kits
Change-Id: I5b48ddf36ba1b9c4eb6476017be63c4d43b60627
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-25 13:57:36 +00:00
hjk
0dbed86651 CMake: De-noise cmakekitinformation.cpp
Change-Id: Icd23b996a4d01b327124bcce14be2e9b77d25ca5
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-04 10:09:45 +00:00
hjk
f4a529ea95 Utils: Change signature of MacroExpander::registerFileVariables
... to take a function returning a FilePath as base.

Implementation is (not) yet changed.

Change-Id: I624efab35cf38631c816b630be5296bdf696899e
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-03 05:50:18 +00:00
hjk
015204a7c3 ProjectExplorer: Split Kit::*environment into build and run
They may differ in a containerized setup.

Change-Id: Ib7e60fdd69f56e8e22bad3dfbc246e7de2fe9cd4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-05-27 14:35:05 +00:00
hjk
8e352af0ec Core: Add a default parameter to various ICore::*path functions
Saves some code on the user side.

Change-Id: I32cd220b6e533f5497a1865f9c34ab9db4cfda79
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-04-27 06:52:05 +00:00
Eike Ziller
86f0d72b2a Look for jom also in "jom" subdirectory
Jom is currently installed into the Qt Creator bin/ directory directly,
but it can be considered unsafe if we add that to the PATH. Look in a
subdirectory for it as well, as preparation for moving it there instead.

Task-number: QTCREATORBUG-25585
Change-Id: I85b379fa093c57639875872868c16b5cc964f4aa
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-04-26 07:01:12 +00:00
hjk
7eb9d8cb60 ProjectExplorer: Introduce a KitAspect::createManageButton() function
Saves some repetition downstream.

Change-Id: Ied58586572d3e70669c9172c5076bbd12e211aa7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-04-19 12:05:35 +00:00
hjk
77481f25ce ProjectExplorer: Base KitAspectWidget on BaseAspect
Enables re-using existing functionality.

The "Make mutable" functionality is still oddly placed. I doubt people
find and use it actively.

Change-Id: Ic6aae17e3a7df093f0f5f234f1e6e1afc196a087
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-04-19 12:02:19 +00:00
hjk
341132dd0a CMake: Code cosmetics
- use newer approach to settings page layout building
- no SHOUTING enums
- namespaces
- proper dialog parent for message

Change-Id: I7adfb7487d502b8fd706c4a0c5645f4d2153e39c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-03-30 08:57:31 +00:00
Eike Ziller
b47a80c5ce CMake/iOS: Set up CMake configuration
For Qt6/iOS we need to use the Xcode generator, and set
CMAKE_OSX_SYSROOT, CMAKE_OSX_ARCHITECTURES, and the Qt toolchain file
with CMAKE_TOOLCHAIN_FILE.

We also may not automatically add the CMAKE_SYSROOT and
CMAKE_C(XX)_COMPILER_TARGET variables, since this is handled differently
for iOS targets.

With this building, running and debugging on the simulator works, if the
CMake project correctly sets up a MACOSX_BUNDLE_GUI_IDENTIFIER,
MACOSX_BUNDLE_BUNDLE_VERSION, MACOSX_BUNDLE_SHORT_VERSION_STRING and
MACOSX_BUNDLE_LONG_VERSION_STRING.

For the device build the signing and provisioning details are still
missing.

Task-number: QTCREATORBUG-23574
Change-Id: I12be0d102b57d834d7cae06c87842638f693c087
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-02-04 07:28:02 +00:00
Cristian Adam
6cbdae8070 CMakeProjectManager: Support for multi-config generators
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>
2021-01-21 09:31:30 +00:00
Eike Ziller
5ca70bdcb3 Merge remote-tracking branch 'origin/4.14'
Change-Id: Iea84f23cf394de13e99a9ed777c8c113e4eff473
2020-11-19 15:38:13 +01:00
Eike Ziller
bdc74ea2a0 cmake: Show errors for unsupported CMake versions
Show an error icon in the CMake settings, and instead running CMake with
unsupported parameters show an error in the Issues pane.

Arguably it should not be possible to select an unsupported CMake
version in the kit settings at all (neither manually nor automatically
when setting up kits), but this is the less intrusive change for now.

Fixes: QTCREATORBUG-24553
Change-Id: I32caa2ce93d28cbd9db90e2004d60da93d32c68c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-11-19 09:51:27 +00:00
Jarek Kobus
b269066435 Use const iterator with std::find_if where possible
Make the resulting interator const.

Change-Id: I4aadcfff35f6b1015e506bc75bcfc2a1f1be4d65
Reviewed-by: hjk <hjk@qt.io>
2020-11-19 09:46:31 +00:00
Jarek Kobus
48c2afe157 Decorate some classes and methods with final keyword
This way we silence the clang warnings about calling
virtual methods from c'tor or from d'tor:
[clang-analyzer-optin.cplusplus.VirtualCall]

Change-Id: I8d6318b490152133da4833bda2ba28622bce30dd
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-11-19 09:45:53 +00:00
hjk
cec468d78a Utils/ProjectExplorer: Move re-usabled bits of aspects to Utils
Classes involved are BaseAspect and some derived classes,
LayoutBuilder and VariableChooser.

This is mostly mechanical, with various include/using changes
to make it compile.

Change-Id: I624a457f3555f102e541c4c71e33a9423af32250
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-09-23 07:44:42 +00:00
hjk
430a33dcd9 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-07-06 06:07:13 +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
494b9f5287 CMake: Remove servermode support
Task-number: QTCREATORBUG-23915
Change-Id: I2a58e1d6d95c28e25787722fa37448d86c4aebc9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-04-29 14:30:16 +00:00
Eike Ziller
d79febdde9 Merge remote-tracking branch 'origin/4.12'
Conflicts:
	src/plugins/cmakeprojectmanager/cmakekitinformation.cpp

Change-Id: I90ef0063ed24e23bcb3d73fff086f50324faa1e2
2020-04-24 13:58:05 +02:00
David Schulz
e3a0fe71e4 CMake: fixup env if jom is missing
Add the applitcation dir path to the path environment variable
if jom cannot be found there. This should fix the cannot find
jom error for binary releases since we ship jom with qc.

Fixes: QTCREATORBUG-22645
Change-Id: Ia3b55f794d3ac4b5fd6d2e85cf19f00bd8cddd2c
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2020-04-23 12:59:51 +00:00
David Schulz
2aac4cc07f CMake: honor use jom instead of nmake setting
Only search for the jom cmake generator if this setting is
enabled.

Change-Id: Id8eed91d47f1f6ca2375fe0d169b21168c5ca4ff
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2020-04-23 12:59:43 +00:00
Tobias Hunger
ca4c578532 CMake: Update minimum CMake version to 3.7
Tealeaf reader mode has been removed, so require at least
CMake version 3.7 (which comes with server-mode).

Change-Id: I1ce8cdd08f226446ccca5882d1cb2171019b3409
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-04-22 11:59:21 +00:00
Tobias Hunger
43895c87a2 CMake: Fix WS only
Change-Id: I2ab4d5e3998ee550cdc00e27a314ae3109c8225b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2020-04-20 13:20:59 +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
Tobias Hunger
e5f4cfbeb8 CMake: Do not default to CodeBlocks extra generator
Now that CMake without server-mode or file-api are no longer
supported in Qt Creator, there is no more need to push for the
CodeBlocks extra generator which was required for the
"tealeaf" reader only.

Change-Id: Iec280d960b9f50ee6f9b954ecc532745a62213f5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2020-03-05 12:50:18 +00:00
Orgad Shaneh
4dcc480865 Merge remote-tracking branch 'origin/4.12'
Change-Id: I5de0b3e1940998d4aca79b1698ef408ae4d43e69
2020-03-05 11:32:27 +02:00
Eike Ziller
abd4d68696 Merge remote-tracking branch 'origin/4.11' into 4.12
Change-Id: I00ccdc2c79176799fe9d20ecfe42c260796d7d97
2020-03-05 09:36:40 +01:00
Tobias Hunger
8e47fc18a6 CMake: Pick Ninja generator when installer added ninja
Pick the Ninja CMake generator when the installer has installed
the ninja binary.

Task-number: QTCREATORBUG-23650
Change-Id: I966b369513e7d489161b210819832f1bbbb5a0fc
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-03-05 08:31:46 +00:00
Eike Ziller
61dc14b67f Merge remote-tracking branch 'origin/4.12'
Change-Id: I3e7049da2c3da6f784e3cb3407c22ada556e5d24
2020-02-26 08:35:05 +01:00
Kai Koehne
fda9955df0 Globally disable WindowContextHelpButtonHint
Do set the global application flag AA_DisableWindowContextHelpButton
to avoid having to unset the default WindowContextHelpButtonHint
in every single dialog.

AA_DisableWindowContextHelpButton was added in Qt 5.10.

Change-Id: I21fe8bc5ddfa4c01ec7a799b04bfb6ff1c9d6d86
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-25 13:26:44 +00:00
hjk
3f68292dbe ProjectExplorer: Introduce ToolChainKitAspect::{c,cxx}ToolChain
Special accessors to the repeatedly used C and C++ cases to denoise
and slim down user code.  Plus some code cosmetics nearby.

Change-Id: Iba4662bd4731d8c4256e658529f39d5c995691ce
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-02-19 15:59:12 +00:00
hjk
0334b6e491 ProjectManager: Add convenience Task subclasses
For Compile, BuildSystem and Deployment. Unclutters user code and reduces
binary size.

Change-Id: Ia18e917bb411754162e9f4ec6056d752a020bb50
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-01-20 10:11:59 +00:00
Alessandro Portale
b619c60ff7 CMakeprojectManager: Use Utils::ElidingLabel in GeneratorKitAspect
Don't stretch the kit options page horizontally more than required.

Change-Id: I8eb3855ae48a8a172741b1c42f79b9e05cc7eb42
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-11-22 11:35:07 +00:00
Tobias Hunger
b489bfd615 BaseQtVersion: remove qmakeProperty(...) getter
Qt 6 will not use qmake to identify a Qt version, so this can not
be part of the public interface of BaseQtVersion anymore.

Provide getters for the information actually read via qmakeProperty(...).

Use the getters whenever possible.

Change-Id: Iadbee80b75e4f8b06caf90e7ed69fae2029b4dd7
Reviewed-by: hjk <hjk@qt.io>
2019-10-01 11:46:43 +00:00
Alessandro Portale
718af236de CMakeProjectManager: Export CMake*Aspect and CMakeConfigItem
Allow other plugins to set CMake specific Kit options.

Change-Id: I038e9fabc3d2cb8cc463adafebecd51b21ef3d05
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-09-26 15:06:41 +00:00
Eike Ziller
ff503740ce Run CMake via canonical path instead of warning
Running CMake via a non-canonical path (including '..' in the path, or
via a symlink) can result in funny errors.

de6faa0f15 added a warning for that
condition. Unfortunately the auto-detection of CMake can return a path
to a symlink (e.g. for CMake from brew on macOS). Also it is helpful to
use a symlink to e.g. manage different CMake versions.

Instead of warning about the condition, and forcing the user to resolve
it manually, simply run CMake via its canonical path when actually
running it from Qt Creator.

Change-Id: I95623b45c5436a6d61c1419b7aba23e2a73a0650
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-08-12 12:54:28 +00:00
Tobias Hunger
de6faa0f15 CMake: Better warnings for strange/invalid CMake binaries
Warn when cmake is configured to use a non-canonical path. This might
trigger problems in CMake itself.

Show this warning in the Kit as well as in the CMake options page.

Also complain other issues in the CMake options page.

Task-number: QTCREATORBUG-22583
Change-Id: I841341db8305f9152543487ce9ceeab2eca0b2b9
Reviewed-by: hjk <hjk@qt.io>
2019-08-05 15:13:40 +00:00
Tobias Hunger
6790238d91 CMake: Do not warn when fileapi-enabled cmakes have no Codeblocks
Do not warn when fileapi-enabled cmake tools do not have the
Codeblocks extra-generator set in the Kit. This is only necessary
for the tealeaf-reader.

Change-Id: Id3aa9df2ec5aa8c2de8b0a5bef8c751e54d72b42
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-25 12:15:40 +00:00
hjk
251287f0d3 Avoid warning on empty expressions
For some reason, Q_UNUSED includes already a semicolon, adding one
on the user side creates an additional empty statement.

Change-Id: I9c5e8fac381345a60792cb75e2938fd53958d3b0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-23 11:55:59 +00:00
Alessandro Portale
0933c20de8 connect() to ambiguous signals/slots: Replace static_cast with QOverload
Change-Id: I473d7a2a16509cee944a2a21b022a3f6f02cfd8d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 14:07:03 +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
33ea685a91 Directly construct KitAspect::toUserOutput return values
Less dependent on used type and actually saves cycles.

Change-Id: I87344172c330198e98c11205a80862b3b30271e4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-05-28 07:22:55 +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
Eike Ziller
534fcfcd45 Fix Qt version for auto-detected kits
Fixes a regression in d4565be655 that
leads to all desktop Kits being assigned a default desktop Qt version,
even though the installer registered these kits with a specific Qt.

Implementations of KitAspect::setup may not unconditionally override an
existing value, since it is called on the kits restored from the install
settings. This is needed because the installer registers toolchains and
debuggers by referring to them via an ABI ("this kit has a debugger that
can handle this specific ABI"), since the installer doesn't know e.g.
about installed MSVC toolchains itself.
That's why ToolChainKitAspect and DebuggerKitAspect may modify an
existing value in their "setup" method. If this should be moved
somewhere else, e.g. "fix", should be investigated, but in a separate
refactoring.

Change-Id: Ibd99e4da03cd7130c49294f4ac79cd8e346fb1b7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-07 13:24:24 +00:00