mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 11:15:38 +02:00
External commit for Leo Treggiari. The archList attribute of the target object specifies the list of architectures that the target is supported on. The valid list of architectures is the string values returned by BootLoader.getOSArch(). If the archList attribute is not specified, or if the value is "all", then the target is supported on all architectures. Otherwise, the target is only displayed when CDT is running on one of the specified architectures, unless the user has requested to see all targets.
This commit is contained in:
parent
e40dd5c703
commit
08c13e8969
5 changed files with 92 additions and 56 deletions
|
@ -22,12 +22,12 @@
|
|||
point="org.eclipse.cdt.managedbuilder.core.ManagedBuildInfo">
|
||||
<tool
|
||||
natureFilter="both"
|
||||
sources="rc"
|
||||
name="Target Independent Tool"
|
||||
sources="rc"
|
||||
headerExtensions="h"
|
||||
outputFlag="/fo"
|
||||
outputs="free"
|
||||
command="RC.EXE"
|
||||
outputs="free"
|
||||
id="target.independent.tool">
|
||||
<optionCategory
|
||||
owner="target.independent.tool"
|
||||
|
@ -38,8 +38,8 @@
|
|||
defaultValue="Live free or die"
|
||||
name="String in Free"
|
||||
category="indy.cat.free"
|
||||
id="org.eclipse.cdt.core.tests.option1"
|
||||
valueType="string">
|
||||
valueType="string"
|
||||
id="org.eclipse.cdt.core.tests.option1">
|
||||
</option>
|
||||
<optionCategory
|
||||
owner="indy.cat.free"
|
||||
|
@ -50,8 +50,8 @@
|
|||
defaultValue="false"
|
||||
name="Boolean in Chained"
|
||||
category="indy.cat.chained"
|
||||
id="org.eclipse.cdt.core.tests.option2"
|
||||
valueType="boolean">
|
||||
valueType="boolean"
|
||||
id="org.eclipse.cdt.core.tests.option2">
|
||||
</option>
|
||||
</tool>
|
||||
<target
|
||||
|
@ -62,17 +62,17 @@
|
|||
defaultExtension="toor"
|
||||
isAbstract="false"
|
||||
makeCommand="make"
|
||||
makeArguments="-k"
|
||||
binaryParser="org.eclipse.cdt.core.PE"
|
||||
makeArguments="-k"
|
||||
osList="win32">
|
||||
<tool
|
||||
natureFilter="cnature"
|
||||
name="Root Tool"
|
||||
sources="foo,bar"
|
||||
name="Root Tool"
|
||||
headerExtensions="baz"
|
||||
outputFlag="-r"
|
||||
command="doIt"
|
||||
outputs="toor"
|
||||
command="doIt"
|
||||
id="root.tool">
|
||||
<optionCategory
|
||||
owner="root.tool"
|
||||
|
@ -82,47 +82,47 @@
|
|||
<option
|
||||
name="List Option in Top"
|
||||
command="-L"
|
||||
id="list.option"
|
||||
valueType="stringList">
|
||||
valueType="stringList"
|
||||
id="list.option">
|
||||
<listOptionValue
|
||||
value="a">
|
||||
</listOptionValue>
|
||||
<listOptionValue
|
||||
builtIn="false"
|
||||
value="b">
|
||||
value="b"
|
||||
builtIn="false">
|
||||
</listOptionValue>
|
||||
<listOptionValue
|
||||
builtIn="true"
|
||||
value="c">
|
||||
value="c"
|
||||
builtIn="true">
|
||||
</listOptionValue>
|
||||
</option>
|
||||
<option
|
||||
defaultValue="false"
|
||||
name="Boolean Option in Top"
|
||||
command="-b"
|
||||
id="boolean.option"
|
||||
valueType="boolean">
|
||||
valueType="boolean"
|
||||
id="boolean.option">
|
||||
</option>
|
||||
<option
|
||||
defaultValue="x"
|
||||
name="String Option in Category"
|
||||
category="category"
|
||||
id="string.option"
|
||||
valueType="string">
|
||||
valueType="string"
|
||||
id="string.option">
|
||||
</option>
|
||||
<option
|
||||
defaultValue=""
|
||||
name="Another String Option in Category"
|
||||
category="category"
|
||||
command="-str"
|
||||
valueType="string"
|
||||
id="another.string.option">
|
||||
id="another.string.option"
|
||||
valueType="string">
|
||||
</option>
|
||||
<option
|
||||
name="Enumerated Option in Category"
|
||||
category="category"
|
||||
id="enumerated.option"
|
||||
valueType="enumerated">
|
||||
valueType="enumerated"
|
||||
id="enumerated.option">
|
||||
<enumeratedOptionValue
|
||||
name="Default Enum"
|
||||
isDefault="true"
|
||||
|
@ -139,8 +139,8 @@
|
|||
commandFalse="-nob"
|
||||
name="Boolean Option in Category"
|
||||
category="category"
|
||||
valueType="boolean"
|
||||
id="boolean.false.option">
|
||||
id="boolean.false.option"
|
||||
valueType="boolean">
|
||||
</option>
|
||||
</tool>
|
||||
<configuration
|
||||
|
@ -210,8 +210,9 @@
|
|||
defaultExtension="bus"
|
||||
isAbstract="false"
|
||||
binaryParser="org.eclipse.cdt.core.PE"
|
||||
makeArguments="-d"
|
||||
archList="x86,ppc"
|
||||
parent="test.root"
|
||||
makeArguments="-d"
|
||||
osList="win32,linux,solaris">
|
||||
<configuration
|
||||
name="Sub Config"
|
||||
|
@ -219,18 +220,18 @@
|
|||
</configuration>
|
||||
<tool
|
||||
natureFilter="both"
|
||||
name="Sub Tool"
|
||||
sources="yarf"
|
||||
name="Sub Tool"
|
||||
headerExtensions="arf,barf"
|
||||
outputPrefix="lib"
|
||||
outputs="bus"
|
||||
outputPrefix="lib"
|
||||
id="tool.sub">
|
||||
<option
|
||||
name="Include Paths"
|
||||
command="-I"
|
||||
id="sub.tool.opt.inc.paths"
|
||||
browseType="directory"
|
||||
valueType="includePath"
|
||||
browseType="directory">
|
||||
id="sub.tool.opt.inc.paths">
|
||||
<listOptionValue
|
||||
value="/usr/include">
|
||||
</listOptionValue>
|
||||
|
@ -238,47 +239,47 @@
|
|||
value="/opt/gnome/include">
|
||||
</listOptionValue>
|
||||
<listOptionValue
|
||||
builtIn="true"
|
||||
value="/usr/gnu/include">
|
||||
value="/usr/gnu/include"
|
||||
builtIn="true">
|
||||
</listOptionValue>
|
||||
</option>
|
||||
<option
|
||||
name="Defined Symbols"
|
||||
command="-D"
|
||||
id="sub.tool.opt.def.symbols"
|
||||
valueType="definedSymbols">
|
||||
valueType="definedSymbols"
|
||||
id="sub.tool.opt.def.symbols">
|
||||
<listOptionValue
|
||||
builtIn="true"
|
||||
value="BUILTIN">
|
||||
value="BUILTIN"
|
||||
builtIn="true">
|
||||
</listOptionValue>
|
||||
</option>
|
||||
<option
|
||||
name="More Includes"
|
||||
command="-I"
|
||||
id="sub.tool.opts.inc.paths.more"
|
||||
browseType="directory"
|
||||
valueType="includePath"
|
||||
browseType="directory">
|
||||
id="sub.tool.opts.inc.paths.more">
|
||||
<listOptionValue
|
||||
builtIn="false"
|
||||
value="C:\home\tester/include">
|
||||
value="C:\home\tester/include"
|
||||
builtIn="false">
|
||||
</listOptionValue>
|
||||
<listOptionValue
|
||||
builtIn="false"
|
||||
value=""../includes"">
|
||||
value=""../includes""
|
||||
builtIn="false">
|
||||
</listOptionValue>
|
||||
</option>
|
||||
<option
|
||||
name="User Objects"
|
||||
id="sub.tool.opt.objs"
|
||||
browseType="file"
|
||||
valueType="userObjs"
|
||||
browseType="file">
|
||||
id="sub.tool.opt.objs">
|
||||
<listOptionValue
|
||||
builtIn="false"
|
||||
value="obj1.o">
|
||||
value="obj1.o"
|
||||
builtIn="false">
|
||||
</listOptionValue>
|
||||
<listOptionValue
|
||||
builtIn="false"
|
||||
value="obj2.o">
|
||||
value="obj2.o"
|
||||
builtIn="false">
|
||||
</listOptionValue>
|
||||
</option>
|
||||
</tool>
|
||||
|
@ -286,8 +287,8 @@
|
|||
<target
|
||||
isTest="true"
|
||||
name="Test Sub Sub"
|
||||
binaryParser="org.eclipse.cdt.core.ELF"
|
||||
parent="test.sub"
|
||||
binaryParser="org.eclipse.cdt.core.ELF"
|
||||
defaultExtension="tss"
|
||||
makeCommand="nmake"
|
||||
id="test.sub.sub">
|
||||
|
@ -302,8 +303,8 @@
|
|||
<target
|
||||
isTest="true"
|
||||
name="Forward Grandchild"
|
||||
binaryParser="org.eclipse.cdt.core.tests.target1"
|
||||
parent="test.forward.child.target"
|
||||
binaryParser="org.eclipse.cdt.core.tests.target1"
|
||||
id="test.forward.grandchild.target">
|
||||
<toolReference
|
||||
command="newcommand"
|
||||
|
@ -314,8 +315,8 @@
|
|||
isTest="true"
|
||||
osList="win32,solaris,linux"
|
||||
name="Forward Child"
|
||||
parent="test.forward.parent.target"
|
||||
binaryParser="org.eclipse.cdt.core.tests.target2"
|
||||
parent="test.forward.parent.target"
|
||||
id="test.forward.child.target">
|
||||
<toolReference
|
||||
id="test.forward.tool">
|
||||
|
@ -359,16 +360,14 @@
|
|||
id="test.error.parsers">
|
||||
<tool
|
||||
natureFilter="cnature"
|
||||
name="EP Tool"
|
||||
sources="x,y"
|
||||
name="EP Tool"
|
||||
outputFlag="-o"
|
||||
command="EP"
|
||||
outputs="xy"
|
||||
command="EP"
|
||||
id="error.parsers.tool">
|
||||
</tool>
|
||||
</target>
|
||||
<!-- The old tool definitions exercised the model differently, so keep an example around for testing -->
|
||||
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -486,6 +486,13 @@ Additional special types exist to flag options of special relevance to the build
|
|||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="archList" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
This field is used by the managed build system to decide when to show the user the target. The value should be a comma-separated list. Current values include "x86", "sparc", "ppc"; or "all".
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="errorParsers" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
|
|
@ -29,6 +29,7 @@ public interface ITarget extends IBuildObject {
|
|||
public static final String MAKE_COMMAND = "makeCommand"; //$NON-NLS-1$
|
||||
public static final String MAKE_ARGS = "makeArguments"; //$NON-NLS-1$
|
||||
public static final String OS_LIST = "osList"; //$NON-NLS-1$
|
||||
public static final String ARCH_LIST = "archList"; //$NON-NLS-1$
|
||||
public static final String PARENT = "parent"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
|
@ -160,6 +161,13 @@ public interface ITarget extends IBuildObject {
|
|||
* @return String[]
|
||||
*/
|
||||
public String[] getTargetOSList();
|
||||
|
||||
/**
|
||||
* Answers an array of architectures the target can be created on.
|
||||
*
|
||||
* @return String[]
|
||||
*/
|
||||
public String[] getTargetArchList();
|
||||
|
||||
/**
|
||||
* Returns the list of platform specific tools associated with this
|
||||
|
|
|
@ -51,6 +51,7 @@ public class Target extends BuildObject implements ITarget {
|
|||
private IResource owner;
|
||||
private ITarget parent;
|
||||
private List targetOSList;
|
||||
private List targetArchList;
|
||||
private Map toolMap;
|
||||
private List toolList;
|
||||
private List toolReferences;
|
||||
|
@ -466,6 +467,22 @@ public class Target extends BuildObject implements ITarget {
|
|||
return (String[]) targetOSList.toArray(new String[targetOSList.size()]);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getTargetArchList()
|
||||
*/
|
||||
public String[] getTargetArchList() {
|
||||
if (targetArchList == null) {
|
||||
// Ask parent for its list
|
||||
if (parent != null) {
|
||||
return parent.getTargetArchList();
|
||||
} else {
|
||||
// I have no parent and no defined list
|
||||
return new String[] {"all"}; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
return (String[]) targetArchList.toArray(new String[targetArchList.size()]);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getOwner()
|
||||
*/
|
||||
|
|
|
@ -291,6 +291,7 @@ public class CProjectPlatformPage extends WizardPage {
|
|||
ITarget[] allTargets = ManagedBuildManager.getDefinedTargets(null);
|
||||
targets = new ArrayList();
|
||||
String os = BootLoader.getOS();
|
||||
String arch = BootLoader.getOSArch();
|
||||
// Add all of the concrete targets to the target list
|
||||
for (int index = 0; index < allTargets.length; ++index) {
|
||||
ITarget target = allTargets[index];
|
||||
|
@ -299,9 +300,13 @@ public class CProjectPlatformPage extends WizardPage {
|
|||
if (showAll != null && showAll.getSelection() == true) {
|
||||
targets.add(target);
|
||||
} else {
|
||||
// Apply the OS and ARCH filters to determine if the target should be shown
|
||||
List targetOSList = Arrays.asList(target.getTargetOSList());
|
||||
if (targetOSList.contains("all") || targetOSList.contains(os)) { //$NON-NLS-1$
|
||||
targets.add(target);
|
||||
List targetArchList = Arrays.asList(target.getTargetArchList());
|
||||
if (targetArchList.contains("all") || targetArchList.contains(arch)) { //$NON-NLS-1$
|
||||
targets.add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue