mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
Add a Debug configuration for Autotools projects
- set default CFLAGS and CXXFLAGS for debug configuration Autotool projects - pass project when creating a new AutotoolsConfiguration - add new Debug (GNU) configuration - add new build type property to Debug configuration - look for property when initializing AutotoolsConfiguration Change-Id: I95e6fa59f854dad3aff71507a4a85ffa55f4b2bc
This commit is contained in:
parent
9fd79b0596
commit
022e9428fd
5 changed files with 151 additions and 12 deletions
|
@ -22,6 +22,7 @@ Autotools.wizard.name=GNU Autotools Build Wizard
|
|||
Autoconf.editor.name=Autoconf Editor
|
||||
|
||||
BuildProperty.value.name.default=Default;
|
||||
BuildProperty.value.name.debug=Debug
|
||||
BuildProperty.type.name.autotools=GNU Autotools
|
||||
|
||||
PreferenceAutotools.name=Autotools
|
||||
|
@ -45,6 +46,7 @@ Autotools.projecttype.name=GNU Autotools
|
|||
AutotoolsNature.name=Autotools Project Nature
|
||||
AutotoolsNewNature.name=Autotools Project Nature V2
|
||||
Configuration.build.name=Build (GNU)
|
||||
Configuration.debug.name=Debug (GNU)
|
||||
Autotools.targetplatform.name=GNU Autotools Target Platform
|
||||
Autotools.gnu.toolchain.name=GNU Autotools Toolchain
|
||||
Configure.outputType=Configure Output (config.status)
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
property="org.eclipse.cdt.build.core.buildType"
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.buildType.default"
|
||||
name="%BuildProperty.value.name.default"/>
|
||||
<propertyValue
|
||||
property="org.eclipse.cdt.build.core.buildType"
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.buildType.debug"
|
||||
name="%BuildProperty.value.name.debug"/>
|
||||
<propertyValue
|
||||
property="org.eclipse.cdt.build.core.buildArtefactType"
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.buildArtefactType.autotools"
|
||||
|
@ -332,7 +336,17 @@
|
|||
name="%Option.configure.user"
|
||||
resourceFilter="all"
|
||||
tip="%Option.configure.user.tip"
|
||||
valueType="string"/>
|
||||
valueType="string">
|
||||
<enablement
|
||||
type="CONTAINER_ATTRIBUTE"
|
||||
attribute="defaultValue"
|
||||
value="CFLAGS=-g -O0"
|
||||
extensionAdjustment="false">
|
||||
<checkBuildProperty
|
||||
property="org.eclipse.cdt.build.core.buildType"
|
||||
value="org.eclipse.linuxtools.cdt.autotools.core.buildType.debug"/>
|
||||
</enablement>
|
||||
</option>
|
||||
<outputType
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.outputType.configure"
|
||||
name="%Configure.outputType"
|
||||
|
@ -388,7 +402,7 @@
|
|||
id="org.eclipse.linuxtools.cdt.autotools.core.projectType"
|
||||
isAbstract="false">
|
||||
<configuration
|
||||
buildProperties="org.eclipse.linuxtools.cdt.autotools.core.buildType.default"
|
||||
buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.linuxtools.cdt.autotools.core.buildType.default"
|
||||
cleanCommand="rm -rf"
|
||||
errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.configuration.build"
|
||||
|
@ -432,6 +446,65 @@
|
|||
<builder
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder"
|
||||
isAbstract="false"
|
||||
isVariableCaseSensitive="false"
|
||||
name="%Makefile.builder.name">
|
||||
</builder>
|
||||
<supportedProperties>
|
||||
<property
|
||||
id="org.eclipse.cdt.build.core.buildArtefactType">
|
||||
<value
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.buildArtefactType.autotools">
|
||||
</value>
|
||||
</property>
|
||||
</supportedProperties>
|
||||
</toolChain>
|
||||
</configuration>
|
||||
<configuration
|
||||
buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.linuxtools.cdt.autotools.core.buildType.debug"
|
||||
cleanCommand="rm -rf"
|
||||
errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.debug"
|
||||
languageSettingsProviders="org.eclipse.cdt.ui.UserLanguageSettingsProvider;org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider;org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider;${Toolchain}"
|
||||
name="%Configuration.debug.name">
|
||||
<toolChain
|
||||
archList="all"
|
||||
configurationEnvironmentSupplier="org.eclipse.cdt.internal.autotools.core.AutotoolsEnvironmentVariableSupplier"
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.debug"
|
||||
languageSettingsProviders="org.eclipse.cdt.autotools.core.LibtoolGCCBuildCommandParser;org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector"
|
||||
name="%Autotools.gnu.toolchain.name"
|
||||
supportsManagedBuild="false"
|
||||
targetTool="org.eclipse.linuxtools.cdt.autotools.core.tool.configure">
|
||||
<tool
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure.debug"
|
||||
isAbstract="false"
|
||||
natureFilter="both"
|
||||
superClass="org.eclipse.linuxtools.cdt.autotools.core.tool.configure"/>
|
||||
<tool
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.autogen.debug"
|
||||
isAbstract="false"
|
||||
natureFilter="both"
|
||||
superClass="org.eclipse.linuxtools.cdt.autotools.core.tool.autogen">
|
||||
</tool>
|
||||
<tool
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.debug"
|
||||
isAbstract="false"
|
||||
superClass="cdt.managedbuild.tool.gnu.c.compiler">
|
||||
</tool>
|
||||
<tool
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp.debug"
|
||||
isAbstract="false"
|
||||
superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
|
||||
</tool>
|
||||
<targetPlatform
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform.debug"
|
||||
isAbstract="false"
|
||||
name="%Autotools.targetplatform.name"
|
||||
superClass="org.eclipse.linuxtools.cdt.autotools.core.targetPlatform">
|
||||
</targetPlatform>
|
||||
<builder
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder.debug"
|
||||
superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder"
|
||||
isAbstract="false"
|
||||
isVariableCaseSensitive="false">
|
||||
</builder>
|
||||
<supportedProperties>
|
||||
|
@ -441,6 +514,12 @@
|
|||
id="org.eclipse.linuxtools.cdt.autotools.core.buildArtefactType.autotools">
|
||||
</value>
|
||||
</property>
|
||||
<property
|
||||
id="org.eclipse.cdt.build.core.buildType">
|
||||
<value
|
||||
id="org.eclipse.linuxtools.cdt.autotools.core.buildType.debug">
|
||||
</value>
|
||||
</property>
|
||||
</supportedProperties>
|
||||
</toolChain>
|
||||
</configuration>
|
||||
|
|
|
@ -18,6 +18,14 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsOptionConstants;
|
||||
import org.eclipse.cdt.core.CCProjectNature;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuildObjectProperties;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
||||
public class AutotoolsConfiguration implements IAConfiguration {
|
||||
|
@ -25,6 +33,7 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
|||
public static class Option {
|
||||
private String name;
|
||||
private String transformedName;
|
||||
private String superClassId;
|
||||
private int type;
|
||||
private String defaultValue;
|
||||
|
||||
|
@ -45,6 +54,14 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
|||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public Option(String name, String transformedName, String defaultValue, String superClassId, int type) {
|
||||
this.name = name;
|
||||
this.transformedName = transformedName;
|
||||
this.type = type;
|
||||
this.defaultValue = defaultValue;
|
||||
this.superClassId = superClassId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
@ -57,6 +74,10 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
|||
return defaultValue;
|
||||
}
|
||||
|
||||
public String getSuperClassId() {
|
||||
return superClassId;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return ConfigureMessages.getConfigureDescription(transformedName);
|
||||
}
|
||||
|
@ -121,15 +142,21 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
|||
private String id;
|
||||
private boolean isDirty;
|
||||
private boolean isParmsDirty;
|
||||
private IProject project;
|
||||
private Map<String, IConfigureOption> configOptions;
|
||||
private ArrayList<String> configParms = new ArrayList<>();
|
||||
|
||||
public AutotoolsConfiguration(String name) {
|
||||
this(name, true);
|
||||
this(null, name, true);
|
||||
}
|
||||
|
||||
public AutotoolsConfiguration(IProject project, String name) {
|
||||
this(project, name, true);
|
||||
}
|
||||
|
||||
private AutotoolsConfiguration(String name, boolean initialize) {
|
||||
private AutotoolsConfiguration(IProject project, String name, boolean initialize) {
|
||||
this.id = name;
|
||||
this.project = project;
|
||||
configOptions = new HashMap<>();
|
||||
if (initialize)
|
||||
initConfigOptions();
|
||||
|
@ -140,6 +167,16 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
|||
// Put configure options in hash map. Ignore categories.
|
||||
ArrayList<Option> tools = new ArrayList<>();
|
||||
FlagConfigureOption lastFlag = null;
|
||||
IConfiguration configuration = null;
|
||||
IBuildObjectProperties buildProperties = null;
|
||||
if (project != null) {
|
||||
ICConfigurationDescription cfgd = CoreModel.getDefault().getProjectDescription(project)
|
||||
.getConfigurationById(id);
|
||||
|
||||
configuration = ManagedBuildManager.getConfigurationForDescription(cfgd);
|
||||
if (configuration != null)
|
||||
buildProperties = configuration.getBuildProperties();
|
||||
}
|
||||
for (int i = 0; i < configOpts.length; ++i) {
|
||||
Option opt = configOpts[i];
|
||||
String defaultValue = opt.getDefaultValue();
|
||||
|
@ -165,6 +202,23 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
|||
break;
|
||||
case IConfigureOption.MULTIARG:
|
||||
MultiArgConfigureOption m = new MultiArgConfigureOption(opt.name, opt.transformedName, this);
|
||||
if (buildProperties != null) {
|
||||
// Check to see if we have a Debug configuration in which
|
||||
// case, default the compiler flags
|
||||
// appropriately (for C or C/C++).
|
||||
if (opt.name.equals("user")) { //$NON-NLS-1$
|
||||
if (buildProperties.containsValue("org.eclipse.cdt.build.core.buildType", //$NON-NLS-1$
|
||||
"org.eclipse.linuxtools.cdt.autotools.core.buildType.debug")) { //$NON-NLS-1$
|
||||
defaultValue = "CFLAGS='-g -O0'"; //$NON-NLS-1$
|
||||
try {
|
||||
if (project.hasNature(CCProjectNature.CC_NATURE_ID))
|
||||
defaultValue += " CXXFLAGS='-g -O0'"; //$NON-NLS-1$
|
||||
} catch (CoreException e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (defaultValue != null)
|
||||
m.setValue(defaultValue);
|
||||
configOptions.put(opt.name, m);
|
||||
|
@ -251,12 +305,12 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
|||
|
||||
@Override
|
||||
public IAConfiguration copy() {
|
||||
return copy(id);
|
||||
return copy(this.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAConfiguration copy(String newId) {
|
||||
AutotoolsConfiguration cfg = new AutotoolsConfiguration(newId, false);
|
||||
AutotoolsConfiguration cfg = new AutotoolsConfiguration(project, newId, false);
|
||||
Collection<IConfigureOption> oldValues = configOptions.values();
|
||||
for (Iterator<IConfigureOption> i = oldValues.iterator(); i.hasNext();) {
|
||||
IConfigureOption opt = i.next();
|
||||
|
|
|
@ -100,6 +100,10 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
return new AutotoolsConfiguration(id);
|
||||
}
|
||||
|
||||
public synchronized IAConfiguration createDefaultConfiguration(IProject project, String id) {
|
||||
return new AutotoolsConfiguration(project, id);
|
||||
}
|
||||
|
||||
public synchronized IAConfiguration findCfg(IProject p, String id) {
|
||||
Map<String, IAConfiguration> cfgs = getConfigurations(p);
|
||||
return cfgs.get(id);
|
||||
|
@ -112,7 +116,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
public synchronized IAConfiguration getConfiguration(IProject p, String cfgId, boolean persist) {
|
||||
IAConfiguration cfg = findCfg(p, cfgId);
|
||||
if (cfg == null) {
|
||||
cfg = createDefaultConfiguration(cfgId);
|
||||
cfg = createDefaultConfiguration(p, cfgId);
|
||||
if (persist) {
|
||||
addConfiguration(p, cfg);
|
||||
}
|
||||
|
@ -223,7 +227,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
else
|
||||
continue; // have to punt, this doesn't map to real cfg
|
||||
}
|
||||
IAConfiguration cfg = new AutotoolsConfiguration(cfgId);
|
||||
IAConfiguration cfg = new AutotoolsConfiguration(project, cfgId);
|
||||
NodeList l = n.getChildNodes();
|
||||
for (int y = 0; y < l.getLength(); ++y) {
|
||||
Node child = l.item(y);
|
||||
|
@ -304,7 +308,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
if (savedList != null)
|
||||
oldCfg = savedList.get(oldId);
|
||||
if (oldCfg != null) {
|
||||
IAConfiguration newCfg = oldCfg.copy(cfgd.getId());
|
||||
IAConfiguration newCfg = oldCfg.copy(newId);
|
||||
tmpList.put(cfgd.getId(), newCfg);
|
||||
// Check to see if the new configuration is already stored as part of the project description.
|
||||
// If yes, it should already be saved. This can occur if the configuration was added as part of
|
||||
|
@ -394,7 +398,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
String id = cfgd.getId();
|
||||
IAConfiguration cfg = cfgs.get(id);
|
||||
if (cfg == null) {
|
||||
cfg = createDefaultConfiguration(id);
|
||||
cfg = createDefaultConfiguration(project, id);
|
||||
}
|
||||
p.println("<configuration id=\"" + cfg.getId() + "\">"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
for (int j = 0; j < optionList.length; ++j) {
|
||||
|
@ -626,7 +630,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
|||
|
||||
// Get set of configuration options and convert to set of IAutotoolOptions
|
||||
Map<String, IConfigureOption> cfgOptions = cfg.getOptions();
|
||||
IAConfiguration dummyCfg = createDefaultConfiguration(createDummyId());
|
||||
IAConfiguration dummyCfg = createDefaultConfiguration(project, createDummyId());
|
||||
for (Iterator<Entry<String, IConfigureOption>> i = cfgOptions.entrySet().iterator(); i.hasNext();) {
|
||||
Map.Entry<String, IConfigureOption> entry = i.next();
|
||||
String name = entry.getKey();
|
||||
|
|
|
@ -332,7 +332,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
|||
Element e = d.getDocumentElement();
|
||||
// Get the stored configuration data
|
||||
NodeList cfgs = e.getElementsByTagName("configuration"); //$NON-NLS-1$
|
||||
assertEquals(3, cfgs.getLength());
|
||||
assertEquals(4, cfgs.getLength());
|
||||
int foundUser = 0;
|
||||
for (int x = 0; x < cfgs.getLength(); ++x) {
|
||||
Node n = cfgs.item(x);
|
||||
|
|
Loading…
Add table
Reference in a new issue