From b1f14709b82e5b044e745cfed9d3659285d4a92d Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Wed, 21 Aug 2019 16:19:06 -0400 Subject: [PATCH] Bug 550308 - Allow toolchain to specify part of the build config name. This allows us to consider more than just the os and arch in the build config names as required by the selected toolchain. Change-Id: I3e1a52c756aca13fbe6c83a95f9a86bb2f286f1d --- .../CMakeBuildConfigurationProvider.java | 9 +++----- .../.settings/.api_filters | 4 ++-- .../eclipse/cdt/core/build/IToolChain.java | 23 +++++++++++++++++++ 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationProvider.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationProvider.java index e9ec4ddbe2a..4775a04a234 100644 --- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationProvider.java +++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationProvider.java @@ -116,13 +116,10 @@ public class CMakeBuildConfigurationProvider implements ICBuildConfigurationProv configName.append('.'); configName.append(osConfigName); } else { - if (os != null) { + String fragment = toolChain.getBuildConfigNameFragment(); + if (fragment != null && !fragment.isEmpty()) { configName.append('.'); - configName.append(os); - } - if (arch != null && !arch.isEmpty()) { - configName.append('.'); - configName.append(arch); + configName.append(fragment); } } String name = configName.toString(); diff --git a/core/org.eclipse.cdt.core/.settings/.api_filters b/core/org.eclipse.cdt.core/.settings/.api_filters index e054e9ba124..0f40ba973e2 100644 --- a/core/org.eclipse.cdt.core/.settings/.api_filters +++ b/core/org.eclipse.cdt.core/.settings/.api_filters @@ -41,10 +41,10 @@ - + - + diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChain.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChain.java index 163fd89d0ad..f2264e18758 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChain.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChain.java @@ -78,6 +78,29 @@ public interface IToolChain extends IAdaptable { */ String getName(); + /** + * Return a toolchain specific part of the build configuration name. This should be enough + * to ensure the build config generated proper code for the selected target. + * + * As a default implementation, we do what the CMakeBuildConfigationProvider did which has + * been copied to a number of other providers, i.e. use the os and arch. + * + * @return fragment to be used in the build config name + * @since 6.9 + */ + default String getBuildConfigNameFragment() { + String os = getProperty(ATTR_OS); + String arch = getProperty(ATTR_ARCH); + + if (os != null) { + return os + '.' + arch; + } else if (arch != null) { + return arch; + } else { + return ""; //$NON-NLS-1$ + } + } + /** * The type id for the toolchain. The combination of type id and toolchain id * uniquely identify the toolchain in the system.