Skip to content

Commit

Permalink
Provide GNU tool prefix for CDT GNU tool factory
Browse files Browse the repository at this point in the history
  • Loading branch information
jld01 committed May 23, 2023
1 parent 752ae80 commit 62a35fa
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
Copyright (c) 2009, 2011 Wind River Systems, Inc. and others.
Copyright (c) 2009, 2023 Wind River Systems, Inc. and others.
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
Expand All @@ -13,6 +13,7 @@
Doug Schaefer (Wind River) - initial API and implementation
Anna Dushistova (Mentor Graphics)- [329531][crossgcc] crossgcc fails to build a project
Liviu Ionescu - Arm version
John Dallaway - use GNU ELF binary parser (#567)
-->
<plugin>
<extension-point
Expand Down Expand Up @@ -1678,7 +1679,7 @@
targetTool="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker;cdt.managedbuild.tool.gnu.archiver">
<targetPlatform
archList="all"
binaryParser="org.eclipse.cdt.core.ELF"
binaryParser="org.eclipse.cdt.core.GNU_ELF"
id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"
isAbstract="false"
osList="all">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2013 Liviu Ionescu.
* Copyright (c) 2013, 2023 Liviu Ionescu and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -10,6 +10,7 @@
*
* Contributors:
* Liviu Ionescu - initial version
* John Dallaway - provide GNU tool prefix for CDT GNU tool factory (#567)
*******************************************************************************/

package org.eclipse.embedcdt.managedbuild.cross.arm.core;
Expand All @@ -34,6 +35,7 @@ public class ConfigurationBuildMacroSupplier implements IConfigurationBuildMacro
"cross_objdump", "cross_size", "cross_make", "cross_rm" };

private static String CROSS_FLAGS = "cross_toolchain_flags";
private static String GNU_TOOL_PREFIX = "gnu_tool_prefix"; // TODO: use IGnuToolFactory.GNU_TOOL_PREFIX_VARIABLE (since CDT 11.2)

// ------------------------------------------------------------------------

Expand Down Expand Up @@ -75,6 +77,14 @@ public IBuildMacro getMacro(String macroName, IConfiguration configuration, IBui
return new BuildMacro(macroName, BuildMacro.VALUE_TEXT, sValue);
}
}

if (GNU_TOOL_PREFIX.equals(macroName)) {
String sValue = Option.getOptionStringValue(configuration, Option.OPTION_PREFIX + ".command.prefix");
if (sValue != null && sValue.length() > 0) {
return new BuildMacro(GNU_TOOL_PREFIX, IBuildMacro.VALUE_TEXT, sValue);
}
}

// System.out.println("Missing value of " + macroName + " in "
// + configuration.getName());
return null;
Expand Down Expand Up @@ -106,6 +116,11 @@ public IBuildMacro[] getMacros(IConfiguration configuration, IBuildMacroProvider
oMacrosList.add(new BuildMacro(CROSS_FLAGS, BuildMacro.VALUE_TEXT, sValue));
}

IBuildMacro gnuToolPrefixMacro = getMacro(GNU_TOOL_PREFIX, configuration, provider);
if (gnuToolPrefixMacro != null) {
oMacrosList.add(gnuToolPrefixMacro);
}

return oMacrosList.toArray(new IBuildMacro[0]);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
Copyright (c) 2009, 2020 Wind River Systems, Inc. and others.
Copyright (c) 2009, 2023 Wind River Systems, Inc. and others.
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -15,6 +15,7 @@
Anna Dushistova (Mentor Graphics)- [329531][crossgcc] crossgcc fails to build a project
Liviu Ionescu - RISC-V version
Alexander Fedorov (ArSysOp) - extract UI part
John Dallaway - use GNU ELF binary parser (#567)
-->
<plugin>
<extension-point
Expand Down Expand Up @@ -603,7 +604,7 @@
targetTool="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker;ilg.gnumcueclipse.managedbuild.cross.riscv.tool.cpp.linker;cdt.managedbuild.tool.gnu.archiver">
<targetPlatform
archList="all"
binaryParser="org.eclipse.cdt.core.ELF"
binaryParser="org.eclipse.cdt.core.GNU_ELF"
id="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform"
isAbstract="false"
osList="all">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2013 Liviu Ionescu.
* Copyright (c) 2013, 2023 Liviu Ionescu and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -10,6 +10,7 @@
*
* Contributors:
* Liviu Ionescu - initial version
* John Dallaway - provide GNU tool prefix for CDT GNU tool factory (#567)
*******************************************************************************/

package org.eclipse.embedcdt.managedbuild.cross.riscv.core;
Expand All @@ -34,6 +35,7 @@ public class ConfigurationBuildMacroSupplier implements IConfigurationBuildMacro
"cross_objdump", "cross_size", "cross_make", "cross_rm" };

private static String CROSS_FLAGS = "cross_toolchain_flags";
private static String GNU_TOOL_PREFIX = "gnu_tool_prefix"; // TODO: use IGnuToolFactory.GNU_TOOL_PREFIX_VARIABLE (since CDT 11.2)

// ------------------------------------------------------------------------

Expand Down Expand Up @@ -75,6 +77,14 @@ public IBuildMacro getMacro(String macroName, IConfiguration configuration, IBui
return new BuildMacro(macroName, BuildMacro.VALUE_TEXT, sValue);
}
}

if (GNU_TOOL_PREFIX.equals(macroName)) {
String sValue = Option.getOptionStringValue(configuration, Option.OPTION_PREFIX + ".command.prefix");
if (sValue != null && sValue.length() > 0) {
return new BuildMacro(GNU_TOOL_PREFIX, IBuildMacro.VALUE_TEXT, sValue);
}
}

// System.out.println("Missing value of " + macroName + " in "
// + configuration.getName());
return null;
Expand Down Expand Up @@ -106,6 +116,11 @@ public IBuildMacro[] getMacros(IConfiguration configuration, IBuildMacroProvider
oMacrosList.add(new BuildMacro(CROSS_FLAGS, BuildMacro.VALUE_TEXT, sValue));
}

IBuildMacro gnuToolPrefixMacro = getMacro(GNU_TOOL_PREFIX, configuration, provider);
if (gnuToolPrefixMacro != null) {
oMacrosList.add(gnuToolPrefixMacro);
}

return oMacrosList.toArray(new IBuildMacro[0]);
}

Expand Down

0 comments on commit 62a35fa

Please sign in to comment.