Skip to content

Commit

Permalink
explicit inits for target options; no more toolchain index, use
Browse files Browse the repository at this point in the history
hash(name); echo default tool to avoid initial error; ? required for
enums initialised by hand
  • Loading branch information
ilg-ul committed Oct 10, 2013
1 parent 8a954e0 commit 21cabe9
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 114 deletions.
18 changes: 11 additions & 7 deletions ilg.gnuarmeclipse.managedbuild.cross/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,6 @@
valueType="includePath">
</option>
<option
defaultValue="-fmessage-length=0"
id="ilg.gnuarmeclipse.managedbuild.cross.option.base.compiler.other"
isAbstract="true"
name="%option.compiler.other"
Expand Down Expand Up @@ -840,6 +839,7 @@
id="ilg.gnuarmeclipse.managedbuild.cross.option.base.arm.target.family"
isAbstract="true"
name="%option.target.arm.family"
value="?"
valueType="enumerated">
<enablement
type="UI_ENABLEMENT|CMD_USAGE">
Expand Down Expand Up @@ -1432,6 +1432,7 @@
isAbstract="true"
name="%option.target.arm.instructionset"
tip="Select between generating code that executes in ARM and Thumb states. The default for most configurations is to generate code that executes in ARM state, but the default can be changed by configuring GCC with the --with-mode=state configure option."
value="?"
valueType="enumerated">
<enablement
type="UI_ENABLEMENT|CMD_USAGE">
Expand Down Expand Up @@ -1773,6 +1774,7 @@
<option
id="ilg.gnuarmeclipse.managedbuild.cross.option.base.aarch64.target.family"
name="%option.target.aarch64.family"
value="?"
valueType="enumerated">
<enablement
type="UI_ENABLEMENT|CMD_USAGE">
Expand Down Expand Up @@ -1920,6 +1922,7 @@
<option
id="ilg.gnuarmeclipse.managedbuild.cross.option.base.aarch64.target.feature.simd"
name="%option.target.aarch64.feature.simd"
value="?"
valueType="enumerated">
<enablement
type="UI_ENABLEMENT|CMD_USAGE">
Expand Down Expand Up @@ -1959,6 +1962,7 @@
<option
id="ilg.gnuarmeclipse.managedbuild.cross.option.base.aarch64.target.cmodel"
name="%option.target.aarch64.cmodel"
value="?"
valueType="enumerated">
<enablement
type="UI_ENABLEMENT|CMD_USAGE">
Expand All @@ -1971,22 +1975,22 @@
</enablement>
<enumeratedOptionValue
command="-mcmodel=tiny"
id="ilg.gnuarmeclipse.managedbuild.cross.option.cross.gnu.aarch64.base.target.cmodel.tiny"
id="ilg.gnuarmeclipse.managedbuild.cross.option.base.aarch64.target.cmodel.tiny"
name="%option.target.aarch64.cmodel.tiny">
</enumeratedOptionValue>
<enumeratedOptionValue
command="-mcmodel=small"
id="ilg.gnuarmeclipse.managedbuild.cross.option.cross.gnu.aarch64.base.target.cmodel.small"
id="ilg.gnuarmeclipse.managedbuild.cross.option.base.aarch64.target.cmodel.small"
isDefault="true"
name="%option.target.aarch64.cmodel.small">
</enumeratedOptionValue>
<enumeratedOptionValue
command="-mcmodel=large"
id="ilg.gnuarmeclipse.managedbuild.cross.option.cross.gnu.aarch64.base.target.cmodel.large"
id="ilg.gnuarmeclipse.managedbuild.cross.option.base.aarch64.target.cmodel.large"
name="%option.target.aarch64.cmodel.large">
</enumeratedOptionValue>
<enumeratedOptionValue
id="ilg.gnuarmeclipse.managedbuild.cross.option.cross.gnu.aarch64.base.target.cmodel.default"
id="ilg.gnuarmeclipse.managedbuild.cross.option.base.aarch64.target.cmodel.default"
name="%option.target.aarch64.cmodel.default">
</enumeratedOptionValue>
</option>
Expand Down Expand Up @@ -2113,7 +2117,6 @@
</option>
<option
category="ilg.gnuarmeclipse.managedbuild.cross.optionCategory.toolchain"
defaultValue="?"
id="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix"
isAbstract="false"
name="%option.toolchain.prefix"
Expand All @@ -2132,6 +2135,7 @@
</option>
<option
category="ilg.gnuarmeclipse.managedbuild.cross.optionCategory.toolchain"
defaultValue="echo"
id="ilg.gnuarmeclipse.managedbuild.cross.option.command.c"
isAbstract="false"
name="%option.toolchain.command.c"
Expand All @@ -2141,6 +2145,7 @@
</option>
<option
category="ilg.gnuarmeclipse.managedbuild.cross.optionCategory.toolchain"
defaultValue="echo"
id="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp"
isAbstract="false"
name="%option.toolchain.command.cpp"
Expand Down Expand Up @@ -2655,7 +2660,6 @@
</option>
<option
category="ilg.gnuarmeclipse.managedbuild.cross.optionCategory.assembler.misc"
defaultValue="-c -fmessage-length=0"
id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.other"
name="%option.assembler.other"
valueType="string">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ public static String getToolChainFlags(IConfiguration config) {
sValue = null;
if (sFamilyId.endsWith("." + FAMILY_ARM)) {
sValue = getArmTargetFlags(config);
} else if (sFamilyId.endsWith("." + FAMILY_ARM)) {
} else if (sFamilyId.endsWith("." + FAMILY_AARCH64)) {
sValue = getAarch64TargetFlags(config);
}
if (sValue != null && sValue.length() > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException,
SetCrossCommandWizardPage.PAGE_ID,
SetCrossCommandWizardPage.CROSS_PROJECT_NAME);

String toolchainIndex = (String) MBSCustomPageManager.getPageProperty(
// String toolchainIndex = (String)
// MBSCustomPageManager.getPageProperty(
// SetCrossCommandWizardPage.PAGE_ID,
// SetCrossCommandWizardPage.CROSS_TOOLCHAIN_INDEX);
String toolchainName = (String) MBSCustomPageManager.getPageProperty(
SetCrossCommandWizardPage.PAGE_ID,
SetCrossCommandWizardPage.CROSS_TOOLCHAIN_INDEX);
SetCrossCommandWizardPage.CROSS_TOOLCHAIN_NAME);
String path = (String) MBSCustomPageManager.getPageProperty(
SetCrossCommandWizardPage.PAGE_ID,
SetCrossCommandWizardPage.CROSS_COMMAND_PATH);
Expand All @@ -73,14 +77,14 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException,
// workspace/.plugins/org.eclipse.cdt.core/shareddefaults.xml

String pathKey = SetCrossCommandWizardPage.SHARED_CROSS_COMMAND_PATH
+ "." + toolchainIndex;
+ "." + toolchainName.hashCode();
SharedDefaults.getInstance().getSharedDefaultsMap().put(pathKey, path);

SharedDefaults
.getInstance()
.getSharedDefaultsMap()
.put(SetCrossCommandWizardPage.SHARED_CROSS_TOOLCHAIN_INDEX,
toolchainIndex);
.put(SetCrossCommandWizardPage.SHARED_CROSS_TOOLCHAIN_NAME,
toolchainName);
SharedDefaults.getInstance().updateShareDefaultsMap(
SharedDefaults.getInstance().getSharedDefaultsMap());

Expand Down Expand Up @@ -116,32 +120,37 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException,
}
}


System.out.println("SetCrossCommandOperation.run() end");

}

private void updateOptions(IConfiguration config) throws BuildException {

String sToolchainIndex = (String) MBSCustomPageManager.getPageProperty(
String sToolchainName = (String) MBSCustomPageManager.getPageProperty(
SetCrossCommandWizardPage.PAGE_ID,
SetCrossCommandWizardPage.CROSS_TOOLCHAIN_INDEX);
SetCrossCommandWizardPage.CROSS_TOOLCHAIN_NAME);

int toolchainIndex;
try {
toolchainIndex = ToolchainDefinition
.findToolchainByName(sToolchainName);
} catch (IndexOutOfBoundsException e) {
toolchainIndex = ToolchainDefinition.getDefault();
}

IToolChain toolchain = config.getToolChain();

IOption option;
String val;
IToolChain toolchain = config.getToolChain();

String sId;
sId = Activator.getOptionPrefix() + ".toolchain.index";
option = toolchain.getOptionBySuperClassId(sId); //$NON-NLS-1$
val = sId + "." + sToolchainIndex;
String val = sId + "." + String.valueOf(toolchainIndex);
// Do not use config.setOption() to DO NOT save it on .cproject...
// option.setValue(val);
config.setOption(toolchain, option, val); // temporarily
option.setValue(val);
//config.setOption(toolchain, option, val); // temporarily

Utils.updateOptions(config, toolchainIndex);

Utils.updateOptions(config, sToolchainIndex);

String path = (String) MBSCustomPageManager.getPageProperty(
SetCrossCommandWizardPage.PAGE_ID,
SetCrossCommandWizardPage.CROSS_COMMAND_PATH);
Expand Down
Loading

0 comments on commit 21cabe9

Please sign in to comment.