forked from qt-creator/qt-creator
ProjectExplorer: Stop pretending that C and C++ compilers are unrelated
Motivation:
a) It was ridiculous that when users wanted to manually
add a new toolchain, they had to do the entire setup twice.
b) It was equally weird that users had to take care to choose
matching toolchains when setting up a kit, or indeed that it was
even possible to mix random toolchains in the first place.
User-visible changes:
- The "C" and "C++" categories in the toolchain settings page have
been merged into a single "C/C++" category.
- When adding a new toolchain, the "C" and "C++" sub-menus are gone.
Instead, the toolchain config widget offers two path choosers if
the respective toolchain type supports C and C++ compilers.
- By default, the C++ compiler file path is derived from the C
compiler file path automatically, so the user usually has
to enter only the former.
- In the kit settings page, the "C" and "C++" toolchain combo boxes
have been replaced by a single "C/C++" combo box, relieving the user
of the responsibility to choose two matching toolchains.
Implementation:
The notion that a Toolchain object corresponds to a single compiler is so
deeply engrained in the code that it cannot realistically be changed in
the short term. We therefore introduce the concept of a "toolchain
bundle" as an additional layer that groups matching C and C++ toolchains
together. This way, most code dealing with toolchains stays unchanged,
and only the presentation layer (i.e. the toolchain and kit settings
pages) needed to be rewritten. Once set up in a bundle, toolchains stay
implicitly linked together so the matching only needs to be done once.
In follow-up patches, we will make use of toolchain bundles in all the
places where kits are auto-created, eliminating the risk of mixing
incompatible toolchains in a kit.
Change-Id: Ie6c5add9963e7c1096268dd77acd624671b2674f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/gcctoolchain.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/toolchainconfigwidget.h>
|
||||
|
||||
#include <debugger/debuggeritemmanager.h>
|
||||
#include <debugger/debuggeritem.h>
|
||||
@@ -555,6 +556,12 @@ public:
|
||||
}
|
||||
|
||||
Toolchains autoDetect(const ToolchainDetector &detector) const final;
|
||||
|
||||
std::unique_ptr<ToolchainConfigWidget> createConfigurationWidget(
|
||||
const ToolchainBundle &bundle) const override
|
||||
{
|
||||
return GccToolchain::createConfigurationWidget(bundle);
|
||||
}
|
||||
};
|
||||
|
||||
Toolchains IosToolchainFactory::autoDetect(const ToolchainDetector &detector) const
|
||||
|
||||
Reference in New Issue
Block a user