Commit Graph

385 Commits

Author SHA1 Message Date
Cristian Adam
d5eed0480d CMakePM: Save initial configuration changes on "exit"
Previously the changes to "Initial Configuration" would be done only
after pressing "Re-configure with Initial Parameters".

Now the settings are saved when the widget is closed:
- a different kit is selected
- a different build type is selected
- project is closed
- switch between build and run settings

This way the changes are not lost.

Change-Id: Ia2c1c10c59bfa101332066205f98684843266f94
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-01-31 16:43:04 +00:00
Cristian Adam
ff66f501f2 CMakePM: Do not flush CMake parameters model on parsing complete
The flush there was as a "hack" for the case:

1. failed initial configuration (CMAKE_GENERATOR as Ninja2)
2. successful configuration

The current configuration would get current items with unexpanded
values e.g.: QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}

But flush also removed the expanded values of the selected
initial parameters from CMakeBuildSystem::updateInitialCMakeExpandableVars

This is useful when CMAKE_CXX_COMPILER changes or
CMAKE_PROJECT_INCLUDE_BEFORE gets a new path to the new Qt Creator.

Change-Id: I480ce141d043d8ba6001fa47a54b066762b6a128
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-01-28 13:54:28 +00:00
Cristian Adam
0923d8676e CMakePM: Display CMake kit mismatch values in Settings page
updateFromKit() is now called on parsingFinished and the configuration
values that differ from the ones in the Kit's CMake configuration
will be displayed in red.

The "Initial Configuration" page will display the mismatches between
kit's CMake configuration and initial parameters.

The "Current Configuration" page will display the mismatches between
the initial parameters and the current CMake parameters.

The Tooltip is displayed with a bit of more space between values
for more readability.

Change-Id: I6ebfa71951cf979ab08f097befed2d43b74e4d6e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-28 12:42:25 +00:00
hjk
abbd6cdc8c CMake: Use CommandLine to create the initial default parameters
This has at least theoretically the potential to get quoting in
"cross" configurations right. Since the consuming side is not ported,
there should be no noticeable differences yet.

Change-Id: I933ded4b1c9645055d3114d53f3d1b95b5c5539c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-01-26 18:09:31 +00:00
Cristian Adam
761e1fb13f CMakePM: Add additional CMake parameters to the Kit's CMake config
This way one could pass --warn-uninitialized in the kit's configuration,
which will be transferred to the "Initial Configuration" and so on.

Fixes: QTCREATORBUG-26826
Task-number: QTCREATORBUG-26869
Change-Id: I6d9833a065ea790fc298a75b1120dfa360f885e8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-24 13:29:40 +00:00
hjk
25f5771aa4 Rename QtSupport::BaseQtVersion to QtVersion
... and the Utils::QtVersion enum to Utils::QtMajorVersion to avoid
conflicts.

Change-Id: Ib688c67388272b7204a91444155f60b8c18a56bd
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-01-24 12:13:19 +00:00
hjk
b3375cfd56 CMake: Prevent crash if kit has no toolchain
Amends beb167a963.

Change-Id: I65feee771a21bdfbb2a102419a0d778af97a22eb
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-01-21 14:11:48 +00:00
Cristian Adam
a0836a29c7 CMakePM: Refactor "Initial Parameters" as a tab bar item
Now we have "Initial Configuration" and "Current Configuration"
as tab bar buttons.

This way the UI can be shared between the two configuration states.

Task-number: QTCREATORBUG-26869
Change-Id: I8206032a2a5ac076629865057816edb99706f2ff
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-17 15:23:19 +00:00
Cristian Adam
dfacdbefa8 CMakePM: Add ability to stop CMake run in Settings
Previously the only way to stop the CMake run was to click on "x"
button of the "Configure" progress bar.

Now you can click in Settings on "Stop CMake".

Change-Id: I167b86ba62679f197c194148b122ff0c87e87162
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-07 11:13:54 +00:00
Cristian Adam
2d9dde30dc CMakePM: Remove "Clear selection" button in Settings
The "Clear selection" button doesn't add much value in the list
of buttons.

If you have a selection it doesn't really matter, and you can
simply click on an item an the new item will be the new
selection.

Change-Id: Ie64bc379773219392c12da4c256afd462d4081a9
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-05 15:05:26 +00:00
Cristian Adam
3c7d0c5c98 CMakePM: Remove grouping of cmake cache variables
Having groups made from the first underscore is not necessarily
helpful.

In some cases it creates empty groups, which can confuse users.

We have filter and search functionality in the list, which can
help with finding the right items.

Fixes: QTCREATORBUG-26218
Change-Id: I751a59b49184ea57f55d3832ef4edc8a3c33e0da
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-05 13:04:19 +00:00
Oliver Wolff
beb167a963 Add qt's toolchain file to initial cmake arguments for Windows on ARM64
Fixes: QTCREATORBUG-26636
Change-Id: Id9fc9f3c2242136d2fa4d42e7e64b038a50b1809
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-12-02 05:19:46 +00:00
Assam Boudjelthia
91117a1c36 Android: Clean up for extraData constants
clean, rename and delete unused constants, we well as unify the
usage between qmake, cmake, and qbs.

Change-Id: I8827ac2f2f7660e337694fef17f744e727bd776a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-06 08:07:42 +00:00
Cristian Adam
87c1f597e3 CMakePM: Display CMake project loading errors/warnings in issue pane
Currently the errors / warnings were visible only in Project mode.
Now they will appear in the build system issues pane, so that the
user knows that something is wrong with the project.

Change-Id: I4e0e6aebed86fdb9ea757692255cdbde37cf58a3
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-09-21 12:49:07 +00:00
David Schulz
e397394090 CMake: skip auto-setup.cmake for docker kits
Change-Id: Iaf9e98f8368167b0e665687a118f29d196c20941
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-09-14 12:30:41 +00:00
Eike Ziller
3d4d7c7e14 Merge remote-tracking branch 'origin/5.0'
Conflicts:
	src/plugins/clangtools/clangtoolssettings.cpp
	src/plugins/clangtools/executableinfo.cpp
	src/plugins/clangtools/executableinfo.h

Change-Id: Id8caf63e3e594792467d3447870086bd2d8f73b9
2021-09-13 17:03:55 +02:00
Eike Ziller
f6ede253c7 iOS/CMake: Fix building for iOS device
Fix detection if a kit is an iOS kit.
iOS device kits do not have a device set, if no device is currently
connected. So we would end up with the normal desktop macOS CMake
configuration instead of the special iOS one.
Just check for the device type like before, and guard the else branch
with its own check for macOS target device.

Amends a71d725e46

Change-Id: I829e549e5743ec2b358713f2df6d9cd5e32f6b70
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-09-10 11:44:47 +00:00
Cristian Adam
1a030fb911 CMakePM: Fix build type for multi-configuration generators
Fixes: QTCREATORBUG-26079
Change-Id: Ia849cfcea6f3fb10d791ad32c32413d95aa31569
Reviewed-by: Alp Öz <aoz@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-09-09 07:06:10 +00:00
Assam Boudjelthia
62c33f909d CMake: Don't build apk by default with CMake's ALL target
From Qt 6.1, Qt 6.1 builds the apk directly with ALL step if it's
not a Qt build.

Change-Id: Ib8573399a1ed509852a973e84405353191e80f86
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-09-08 08:09:00 +00:00
hjk
22ecef0444 ProjectExplorer: Streamline access to buildDirectoryTemplate data
There's only one kind of use, in the context of BuildConfiguration.

Change-Id: I09628ff443ef08e28738125a614c17d5d979189b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-08-24 16:27:33 +00:00
hjk
21fff1a9d1 CMake: Fix a crash
Amends a71d725e.

Change-Id: Ifef7629650d119bfde997afbe3c60742a322b8ed
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-02 09:38:01 +00:00
hjk
c6e66a466e CMake: Fix crash with Android when no Qt version is set
Change-Id: I4090add40d621251b795dc090b43ca5f6acb3015
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-08-02 09:37:54 +00:00
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
3b779fb8dd CMakeProjectManager: Use "cooked types" in DirectoryData
Less conversions cycles at the price of a few more temporary bytes.

Change-Id: Ibda82e02d7b83944f5db38ac7cf75c4bae4f55ec
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-07-21 06:25:06 +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
Cristian Adam
b3c83b79f7 CMakePM: Project settings widgets grouping
Group together Initial CMake Parameters and Re-Configure button.

Change-Id: Ieb7d5d65b9465f3e77f1e350bc003777817f1af2
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-06-30 14:37:33 +00:00
Cristian Adam
2d8cd0c90c CMakePM: Update missing expandable CMake variables at project load
The following variables:
    "CMAKE_C_COMPILER",
    "CMAKE_CXX_COMPILER",
    "QT_QMAKE_EXECUTABLE",
    "QT_HOST_PATH",
    "CMAKE_PREFIX_PATH",
    "CMAKE_FIND_ROOT_PATH",
    "CMAKE_PROJECT_INCLUDE_BEFORE",
    "CMAKE_TOOLCHAIN_FILE"

will be checked to see if the existing values have the same values
from the initial cmake parameters list.

Only the CMakeCache.txt values that do not exist on the file system
will be updated.

If not, the updated value will be presented in the dialog for upgrade,
or marked as bold in the settings dialog.

CMAKE_PROJECT_INCLUDE_BEFORE is dependent on Qt Creator version / path
and needs to be updated.

Fixes: QTCREATORBUG-24443
Change-Id: I1eeb44df3a7914051084ef405af5f5621cc5a4e2
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-30 14:36:41 +00:00
Cristian Adam
fc493c3fcb CMakePM: Resolve paths to build directories
With the default build directory template the CMake build directories
will be displayed as project-source/../build-project-name-kit-build-type
which can be irritating.

With this commit the build directory will contain the resolved path.

Change-Id: I968260caba5b9a47e1bda4eeaea386a04fe817b1
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-28 08:07:20 +00:00
Eike Ziller
8f30ff6987 CMake: Show build directory when asking if it should be used
When changing the build directory to a new or empty directory, we ask if
the build directory should be changed and the project be configured
there. Mention the new directory in the dialog.

Change-Id: Ie4d7e9b132e6e90004e4d498b2182562375e7441
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-06-24 11:58:52 +00:00
Eike Ziller
1d600101ee CMake: Apply build directory change on editingFinished
Otherwise every time a character is typed, a dialog pops up, and that
dialog is closed without triggering a cmake run, the value is reset.

Add that behavior optionally to StringAspect.

Change-Id: I6831d1622f08acae6df43d4ceb2bf7367c96a747
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-06-23 12:05:45 +00:00
hjk
d3994dd903 CMake: Use local path names in android build parameters
This is directly passed to cmake and used in the context of the build device.

Change-Id: If22764b0d962f96b51897b754b413c2310818c33
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-21 10:29:19 +00:00
hjk
eed82176b2 CMake: Listen to BuildSystem::parsingFinished, not Target::parsingFinished
There's a 1:1 relationship between CMakeBuildConfigurations and
CMakeBuildSystem objects. No need to react in one
CMakeBuildConfiguration to the signals of someone elses buddy.

Change-Id: I53f7d02d8852a85b9530bd55d8e059916a22579c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-06-10 14:03:49 +00:00
Cristian Adam
26e856254c CMakePM: Allow copy / editing of build directory
This reverts 69b0a2cafc

The build directory is preset and by having the ability to edit, you can
easily do a new build by appending a number.

When you have a new build directory a dialog will warn you that you'll
start from scratch. This is enough of a hinderniss to the user to start
typing and get lots of build directories. No need to have it read only.

Fixes: QTCREATORBUG-24451
Change-Id: Id1bc77d0fbcb071608f5ac83ddd6b8af943fdac5
Reviewed-by: hjk <hjk@qt.io>
2021-06-10 13:42:29 +00:00
Cristian Adam
b504bef7a4 CMakePM: Add support for QNX 7.1 and Qt 6
By setting CMAKE_TOOLCHAIN_FILE to the qt6 toolchain file all the
needed bits to compile agains Qt6 get resolved automagically.

Change-Id: I43084842f98a4385acedd4865aaf7e26f25a351e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-18 08:26:06 +00:00
Eike Ziller
c0cfafdd3d Merge remote-tracking branch 'origin/4.15'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp

Change-Id: I403b236c40d73a61ae22304e289e9d4374366395
2021-04-06 15:17:40 +02: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
Cristian Adam
a862c7b354 CMakePM: Fix "Build type" for multi configuration generators
The multi configuration generators (Visual Studio, Xcode) had an
empty "Build type" which caused failures to parse the CMake file-api
information.

Change-Id: I70ee4978cee4d43e980edf4cd512d1ca95275638
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-03-26 19:36:19 +00:00
hjk
beda749326 CMake: Aspectify CMakeSpecificSettings
Change-Id: I2e094c5a392964fdaf49ac30c2e0ae0f57a3b11d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-03-26 12:40:08 +00:00
Eike Ziller
b213c87cf4 Merge remote-tracking branch 'origin/4.15'
Conflicts:
	src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp

Change-Id: I722a94f37bdd1d78625cfae503ba6d02ff083c63
2021-03-25 11:06:59 +01:00
hjk
baa794a7ba Utils: Use a full layout row for an aspect for Columns and Forms
Avoids some boilerplate on the user code side.

This seems to be the only existing case. If there'd ever be a case where
this is not appropriate, an extra Row { ... } would solve it.

Change-Id: I1ae1102e895640c0acc03b4949e3baabecfcdc49
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-03-25 04:53:05 +00:00
Alessandro Portale
460d446c61 CMakeProjectManager: Set CMAKE_TOOLCHAIN_FILE for WebAssembly
Like for Android and iOS, CMake also needs a CMAKE_TOOLCHAIN_FILE when
configuring a WebAssembly project. We pass it "qt.toolchain.cmake",
which is part of Qt6, just like we do for iOS.

Fixes: QTCREATORBUG-25519
Change-Id: Ia02cafc163da6cd94c483e860922b08a35284c71
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-03-23 18:23:43 +00:00
Cristian Adam
bc518cf353 CMakePM: Disable Add and Batch Edit buttons when the file-api parsing failed
For a project that failed to generate a valid CMake file-api reply
the manual added variables could be lost when the new state doesn't
result in a valid CMake file-api reply.

The user will have to edit the initial CMake parameters to generate
a valid CMake file-api reply.

Task-number: QTCREATORBUG-24637
Change-Id: I091a301ceee3cd41ec59b6282bb9515a49c1a366
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-03-23 08:29:19 +00:00
Cristian Adam
1a4c7abb22 CMakePM: Keep CMakePM error messages meaningful
If CMake project parsing is failing for some reason, it's better
to keep the error message with the actual error than just replacing
it with "The project was not parsed successfully."

This error message was also issued when the project was loading,
which is a bit misleading.

In order to test this:
1. Set the build type to "" (nothing)
2. Clear CMake Configuration from menu
3. Run CMake

This will re-configure the project with initial cmake parameters,
but "-DCMAKE_BUILD_TYPE:STRING=" will set the build type to empty,
and CMakePM would try to parse 'Release' and issue:
"No 'Release' CMake configuration found".

The commit resets the error message when the project is loaded.

Change-Id: I1a586ec19f324d75a25e8f282cab02a6934fce2b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-03-23 08:25:37 +00:00
Eike Ziller
e9bf841dc9 Fix lupdate issues
Some wrong tr calls / missing tr functions.
Some places where we need to bring lupdate to the right track with
regard to namespace resolution.

Change-Id: Idf552054a34e24d9671db68c816bf37f4d403dbc
Reviewed-by: hjk <hjk@qt.io>
2021-03-22 15:00:37 +00:00
Cristian Adam
49a2e14357 CMakePM: Add "Re-configure with Initial Parameters" button
This makes it easier to configure a CMake project with initial cmake parameters
when parameters are added or if the configuration fails.

Task-number: QTCREATORBUG-24637
Change-Id: I880ac6ad82f7cc5e1df2e34e9bcc28e67c3d716e
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-03-22 12:04:35 +00:00
Eike Ziller
863260f1fd Merge remote-tracking branch 'origin/4.15'
Conflicts:
	src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
	src/plugins/debugger/gdb/gdboptionspage.cpp

Change-Id: I4149e860b6842ea63bff3a7eb9632b7a6c2919d8
2021-03-22 09:52:14 +01:00
Cristian Adam
637d45c66a CMakePM: Make "Build type" aspect visible
For single configuration projects if you change the build type
aspect you will change the CMAKE_BUILD_TYPE variable.

When switching the build directory the existing CMAKE_BUILD_TYPE
will be set as build type aspect.

Fixes: QTCREATORBUG-25451
Change-Id: I13519e95c316c556cc1348fba6121637d2fd4275
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-03-19 13:38:18 +00:00
Cristian Adam
8eaf24a694 CMakePM: Fix assert with UNINITIALIZED build type
The typename needs to be STRING and not String

Change-Id: I2bddc4d7df17ff72b7e7e6ee2fa9947f2dfc1e6e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-03-19 13:36:04 +00:00
hjk
a388769c00 CMake: Use LayoutBuilder in build configuration widget
Drop intermediate widget layers, also fix the QML debugging and profiling
aspect misalignment.

Change-Id: I5ee5041ab7db2c05efdd66598c39b589e3d4f56a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-03-16 11:37:56 +00:00
hjk
035a6ff031 Utils: Avoid intermediate widgets when using LayoutBuilder
In most cases, the layout constructed in the builder was set
on a widget which in turn was put into a vbox in the actual
widget. This is not necessary, but needs some re-ordering.

Also make sure that using not-yet-parented widgets during
layout construction does not cause visible artifacts.

Change-Id: I75727a571da093d3131ea6fba467c2c646cdb6f1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-16 11:37:44 +00:00