mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Resynced with Processing/Wiring IDE code: improved auto-format, better performance for EditorConsole, etc...
This commit is contained in:
@ -76,7 +76,9 @@ public class Compiler implements MessageConsumer {
|
||||
|
||||
String userdir = System.getProperty("user.dir") + File.separator;
|
||||
|
||||
String baseCommandCompiler[] = new String[] {
|
||||
LibraryManager libraryManager = new LibraryManager();
|
||||
|
||||
String preCommandCompiler[] = new String[] {
|
||||
((!Base.isMacOS()) ? "tools/avr/bin/avr-gcc" :
|
||||
userdir + "tools/avr/bin/avr-gcc"),
|
||||
"-c", // compile, don't link
|
||||
@ -86,11 +88,19 @@ public class Compiler implements MessageConsumer {
|
||||
"-w", // surpress all warnings
|
||||
"-mmcu=" + Preferences.get("build.mcu"),
|
||||
"-DF_CPU=" + Preferences.get("build.f_cpu"),
|
||||
" ",
|
||||
" "
|
||||
};
|
||||
|
||||
String baseCommandCompilerCPP[] = new String[] {
|
||||
// use lib directories as include paths
|
||||
String[] libDirs = libraryManager.getFolderPaths();
|
||||
|
||||
// Last two arguments will specify the file being compiled and the output file.
|
||||
String[] baseCommandCompiler = new String[preCommandCompiler.length + libDirs.length + 2];
|
||||
System.arraycopy(preCommandCompiler, 0, baseCommandCompiler, 0, preCommandCompiler.length);
|
||||
for (int i = 0; i < libDirs.length; ++i) {
|
||||
baseCommandCompiler[preCommandCompiler.length + i] = "-I" + libDirs[i];
|
||||
}
|
||||
|
||||
String preCommandCompilerCPP[] = new String[] {
|
||||
((!Base.isMacOS()) ? "tools/avr/bin/avr-g++" :
|
||||
userdir + "tools/avr/bin/avr-g++"),
|
||||
"-c", // compile, don't link
|
||||
@ -101,46 +111,33 @@ public class Compiler implements MessageConsumer {
|
||||
"-fno-exceptions",
|
||||
"-mmcu=" + Preferences.get("build.mcu"),
|
||||
"-DF_CPU=" + Preferences.get("build.f_cpu"),
|
||||
" ",
|
||||
" "
|
||||
};
|
||||
|
||||
String baseCommandLinker[] = new String[] {
|
||||
// use lib directories as include paths
|
||||
// Last two arguments will specify the file being compiled and the output file.
|
||||
String[] baseCommandCompilerCPP = new String[preCommandCompilerCPP.length + libDirs.length + 2];
|
||||
System.arraycopy(preCommandCompilerCPP, 0, baseCommandCompilerCPP, 0, preCommandCompilerCPP.length);
|
||||
for (int i = 0; i < libDirs.length; ++i) {
|
||||
baseCommandCompilerCPP[preCommandCompilerCPP.length + i] = "-I" + libDirs[i];
|
||||
}
|
||||
|
||||
String preCommandLinker[] = new String[] {
|
||||
((!Base.isMacOS()) ? "tools/avr/bin/avr-gcc" :
|
||||
userdir + "tools/avr/bin/avr-gcc"),
|
||||
" ",
|
||||
"-mmcu=" + Preferences.get("build.mcu"),
|
||||
"-o",
|
||||
" ",
|
||||
// ((!Base.isMacOS()) ? "" : userdir) + "lib/uart.o",
|
||||
// ((!Base.isMacOS()) ? "" : userdir) + "lib/buffer.o",
|
||||
// ((!Base.isMacOS()) ? "" : userdir) + "lib/timer.o",
|
||||
// ((!Base.isMacOS()) ? "" : userdir) + "lib/wiring.o",
|
||||
// ((!Base.isMacOS()) ? "" : userdir) + "lib/pins_arduino.o",
|
||||
//((!Base.isMacOS()) ? "lib/WApplet.o" :
|
||||
//userdir + "lib/WApplet.o"),
|
||||
//((!Base.isMacOS()) ? "lib/WSerial.o" :
|
||||
//userdir + "lib/WSerial.o"),
|
||||
//((!Base.isMacOS()) ? "lib/WTimer.o" :
|
||||
//userdir + "lib/WTimer.o"),
|
||||
//((!Base.isMacOS()) ? "lib/Servo.o" :
|
||||
//userdir + "lib/Servo.o"),
|
||||
////((!Base.isMacOS()) ? "lib/Wire.o" :
|
||||
//// userdir + "lib/Wire.o"),
|
||||
////((!Base.isMacOS()) ? "lib/WServo.o" :
|
||||
//// userdir + "lib/WServo.o"),
|
||||
//((!Base.isMacOS()) ? "lib/WDisplay.o" :
|
||||
//userdir + "lib/WDisplay.o"),
|
||||
//((!Base.isMacOS()) ? "lib/WEncoder.o" :
|
||||
//userdir + "lib/WEncoder.o"),
|
||||
//((!Base.isMacOS()) ? "lib/WInterrupts.o" :
|
||||
//userdir + "lib/WInterrupts.o"),
|
||||
//((!Base.isMacOS()) ? "lib/WCounter.o" :
|
||||
//userdir + "lib/WCounter.o"),
|
||||
//((!Base.isMacOS()) ? "tools/avr/avr/lib/libm.a" :
|
||||
//userdir + "tools/avr/avr/lib/libm.a")
|
||||
};
|
||||
|
||||
// use lib object files during include
|
||||
String[] libObjectFiles = libraryManager.getObjectFiles();
|
||||
String[] baseCommandLinker = new String[preCommandLinker.length + libObjectFiles.length];
|
||||
System.arraycopy(preCommandLinker, 0, baseCommandLinker, 0, preCommandLinker.length);
|
||||
for (int i = 0; i < libObjectFiles.length; ++i) {
|
||||
baseCommandLinker[preCommandLinker.length + i] = libObjectFiles[i];
|
||||
}
|
||||
|
||||
String baseCommandObjcopy[] = new String[] {
|
||||
((!Base.isMacOS()) ? "tools/avr/bin/avr-objcopy" :
|
||||
userdir + "tools/avr/bin/avr-objcopy"),
|
||||
@ -295,8 +292,8 @@ public class Compiler implements MessageConsumer {
|
||||
Process process;
|
||||
boolean compiling = true;
|
||||
for(int i = 0; i < fileCount; i++) {
|
||||
baseCommandCompiler[8] = sourceNames[i];
|
||||
baseCommandCompiler[9] = "-o"+ objectNames[i];
|
||||
baseCommandCompiler[baseCommandCompiler.length - 2] = sourceNames[i];
|
||||
baseCommandCompiler[baseCommandCompiler.length - 1] = "-o"+ objectNames[i];
|
||||
//System.arraycopy(baseCommandCompiler.length
|
||||
//for(int j = 0; j < baseCommandCompiler.length; j++) {
|
||||
// System.out.println(baseCommandCompiler[j]);
|
||||
@ -325,8 +322,8 @@ public class Compiler implements MessageConsumer {
|
||||
}
|
||||
|
||||
for(int i = 0; i < fileCountCPP; i++) {
|
||||
baseCommandCompilerCPP[9] = sourceNamesCPP[i];
|
||||
baseCommandCompilerCPP[10] = "-o"+ objectNamesCPP[i];
|
||||
baseCommandCompilerCPP[baseCommandCompilerCPP.length - 2] = sourceNamesCPP[i];
|
||||
baseCommandCompilerCPP[baseCommandCompilerCPP.length - 1] = "-o"+ objectNamesCPP[i];
|
||||
//for(int j = 0; j < baseCommandCompilerCPP.length; j++) {
|
||||
// System.out.println(baseCommandCompilerCPP[j]);
|
||||
//}
|
||||
|
Reference in New Issue
Block a user