|
7 | 7 | import java.util.List;
|
8 | 8 |
|
9 | 9 | import org.eclipse.cdt.core.CCorePlugin;
|
| 10 | +import org.eclipse.cdt.core.envvar.IEnvironmentVariable; |
10 | 11 | import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
|
11 | 12 | import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsEditableProvider;
|
12 | 13 | import org.eclipse.cdt.core.language.settings.providers.IWorkingDirectoryTracker;
|
@@ -153,17 +154,25 @@ protected String getCompilerCommand(String languageId) {
|
153 | 154 | // End of Bug fix for CDT 8.1 fixed in 8.2
|
154 | 155 | if (languageId.equals("org.eclipse.cdt.core.gcc")) {
|
155 | 156 | compilerCommand = envManager.getVariable(ArduinoConst.ENV_KEY_recipe_c_o_pattern, confDesc, true).getValue().replace(" -o ", "");
|
156 |
| - compilerCommand = compilerCommand + " " |
157 |
| - + envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_COMPILE_OPTIONS, confDesc, true).getValue(); |
158 |
| - compilerCommand = compilerCommand + " " |
159 |
| - + envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_C_COMPILE_OPTIONS, confDesc, true).getValue(); |
| 157 | + IEnvironmentVariable op1 = envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_COMPILE_OPTIONS, confDesc, true); |
| 158 | + IEnvironmentVariable op2 = envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_C_COMPILE_OPTIONS, confDesc, true); |
| 159 | + if (op1 != null) { |
| 160 | + compilerCommand = compilerCommand + " " + op1.getValue(); |
| 161 | + } |
| 162 | + if (op2 != null) { |
| 163 | + compilerCommand = compilerCommand + " " + op2.getValue(); |
| 164 | + } |
160 | 165 | compilerCommand = compilerCommand + " -D__IN_ECLIPSE__=1";
|
161 | 166 | } else if (languageId.equals("org.eclipse.cdt.core.g++")) {
|
162 | 167 | compilerCommand = envManager.getVariable(ArduinoConst.ENV_KEY_recipe_cpp_o_pattern, confDesc, true).getValue().replace(" -o ", "");
|
163 |
| - compilerCommand = compilerCommand + " " |
164 |
| - + envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_COMPILE_OPTIONS, confDesc, true).getValue(); |
165 |
| - compilerCommand = compilerCommand + " " |
166 |
| - + envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_CPP_COMPILE_OPTIONS, confDesc, true).getValue(); |
| 168 | + IEnvironmentVariable op1 = envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_COMPILE_OPTIONS, confDesc, true); |
| 169 | + IEnvironmentVariable op2 = envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_CPP_COMPILE_OPTIONS, confDesc, true); |
| 170 | + if (op1 != null) { |
| 171 | + compilerCommand = compilerCommand + " " + op1.getValue(); |
| 172 | + } |
| 173 | + if (op2 != null) { |
| 174 | + compilerCommand = compilerCommand + " " + op2.getValue(); |
| 175 | + } |
167 | 176 | compilerCommand = compilerCommand + " -D__IN_ECLIPSE__=1";
|
168 | 177 | } else {
|
169 | 178 | ManagedBuilderCorePlugin.error("Unable to find compiler command for language " + languageId + " in toolchain=" + getToolchainId()); //$NON-NLS-1$
|
|
0 commit comments