protected void populateToolChainProperties(ILaunchTarget target, Map<String, String> properties) { String os = target.getAttribute(ILaunchTarget.ATTR_OS, null); if (os != null) { properties.put(IToolChain.ATTR_OS, os.toLowerCase()); } String arch = target.getAttribute(ILaunchTarget.ATTR_ARCH, null); if (arch != null) { properties.put(IToolChain.ATTR_ARCH, arch.toLowerCase()); } }
protected IQtBuildConfiguration getQtBuildConfiguration( ILaunchConfiguration configuration, String mode, ILaunchTarget target, IProgressMonitor monitor) throws CoreException { // Find the Qt build config ICBuildConfigurationManager configManager = Activator.getService(ICBuildConfigurationManager.class); QtBuildConfigurationProvider provider = (QtBuildConfigurationProvider) configManager.getProvider(QtBuildConfigurationProvider.ID); IProject project = configuration.getMappedResources()[0].getProject(); // Find the toolchains that support this target Map<String, String> properties = new HashMap<>(); populateToolChainProperties(target, properties); IToolChainManager toolChainManager = Activator.getService(IToolChainManager.class); for (IToolChain toolChain : toolChainManager.getToolChainsMatching(properties)) { IQtBuildConfiguration qtConfig = provider.getConfiguration(project, toolChain, mode, monitor); if (qtConfig == null) { qtConfig = provider.createConfiguration(project, toolChain, mode, monitor); } if (qtConfig != null) { return qtConfig; } } // Couldn't find any throw new CoreException( new Status( IStatus.ERROR, Activator.ID, String.format("No suitable SDK found for target %s.", target.getId()))); }