diff options
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/modules/cpp/CppModule.qbs | 1 | ||||
-rw-r--r-- | share/qbs/modules/cpp/cosmic.js | 151 | ||||
-rw-r--r-- | share/qbs/modules/cpp/cosmic.qbs | 18 | ||||
-rw-r--r-- | share/qbs/modules/cpp/iar.js | 255 | ||||
-rw-r--r-- | share/qbs/modules/cpp/iar.qbs | 26 | ||||
-rw-r--r-- | share/qbs/modules/cpp/keil.js | 146 | ||||
-rw-r--r-- | share/qbs/modules/cpp/keil.qbs | 22 | ||||
-rw-r--r-- | share/qbs/modules/cpp/sdcc.js | 44 | ||||
-rw-r--r-- | share/qbs/modules/cpp/sdcc.qbs | 10 |
9 files changed, 242 insertions, 431 deletions
diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs index b88248725..c47dab129 100644 --- a/share/qbs/modules/cpp/CppModule.qbs +++ b/share/qbs/modules/cpp/CppModule.qbs @@ -213,6 +213,7 @@ Module { property string linkerScriptFlag property stringList knownArchitectures: [] + property var toolchainDetails property string linkerMode: "automatic" PropertyOptions { diff --git a/share/qbs/modules/cpp/cosmic.js b/share/qbs/modules/cpp/cosmic.js index 7d4aa04a0..a60b78687 100644 --- a/share/qbs/modules/cpp/cosmic.js +++ b/share/qbs/modules/cpp/cosmic.js @@ -37,114 +37,43 @@ var Process = require("qbs.Process"); var TemporaryDir = require("qbs.TemporaryDir"); var TextFile = require("qbs.TextFile"); -function compilerName(qbs) { +function toolchainDetails(qbs) { var architecture = qbs.architecture; - if (architecture.startsWith("arm")) - return "cxcorm"; - else if (architecture === "stm8") - return "cxstm8"; - else if (architecture === "hcs8") - return "cx6808"; - else if (architecture === "hcs12") - return "cx6812"; - else if (architecture === "m68k") - return "cx332"; -} - -function assemblerName(qbs) { - var architecture = qbs.architecture; - if (architecture.startsWith("arm")) - return "cacorm"; - if (architecture === "stm8") - return "castm8"; - else if (architecture === "hcs8") - return "ca6808"; - else if (architecture === "hcs12") - return "ca6812"; - else if (architecture === "m68k") - return "ca332"; -} - -function linkerName(qbs) { - var architecture = qbs.architecture; - if (architecture.startsWith("arm") - || architecture === "stm8" - || architecture === "hcs8" - || architecture === "hcs12" - || architecture === "m68k") { - return "clnk"; - } -} - -function listerName(qbs) { - var architecture = qbs.architecture; - if (architecture.startsWith("arm") - || architecture === "stm8" - || architecture === "hcs8" - || architecture === "hcs12" - || architecture === "m68k") { - return "clabs"; - } -} - -function archiverName(qbs) { - var architecture = qbs.architecture; - if (architecture.startsWith("arm") - || architecture === "stm8" - || architecture === "hcs8" - || architecture === "hcs12" - || architecture === "m68k") { - return "clib"; - } -} - -function staticLibrarySuffix(qbs) { - var architecture = qbs.architecture; - if (architecture.startsWith("arm")) - return ".cxm"; - else if (architecture === "stm8") - return ".sm8"; - else if (architecture === "hcs8") - return ".h08"; - else if (architecture === "hcs12") - return ".h12"; - else if (architecture === "m68k") - return ".332"; -} - -function executableSuffix(qbs) { - var architecture = qbs.architecture; - if (architecture.startsWith("arm")) - return ".cxm"; - else if (architecture === "stm8") - return ".sm8"; - else if (architecture === "hcs8") - return ".h08"; - else if (architecture === "hcs12") - return ".h12"; - else if (architecture === "m68k") - return ".332"; -} - -function objectSuffix(qbs) { - var architecture = qbs.architecture; - if (architecture.startsWith("arm") - || architecture === "stm8" - || architecture === "hcs8" - || architecture === "hcs12" - || architecture === "m68k") { - return ".o"; - } -} - -function imageFormat(qbs) { - var architecture = qbs.architecture; - if (architecture.startsWith("arm") - || architecture === "stm8" - || architecture === "hcs8" - || architecture === "hcs12" - || architecture === "m68k") { - return "cosmic"; + if (architecture.startsWith("arm")) { + return { + "executableSuffix": ".cxm", + "staticLibrarySuffix": ".cxm", + "assemblerName": "cacorm", + "compilerName": "cxcorm" + }; + } else if (architecture === "stm8") { + return { + "executableSuffix": ".sm8", + "staticLibrarySuffix": ".sm8", + "assemblerName": "castm8", + "compilerName": "cxstm8" + }; + } else if (architecture === "hcs8") { + return { + "executableSuffix": ".h08", + "staticLibrarySuffix": ".h08", + "assemblerName": "ca6808", + "compilerName": "cx6808" + }; + } else if (architecture === "hcs12") { + return { + "executableSuffix": ".h12", + "staticLibrarySuffix": ".h12", + "assemblerName": "ca6812", + "compilerName": "cx6812" + }; + } else if (architecture === "m68k") { + return { + "executableSuffix": ".332", + "staticLibrarySuffix": ".332", + "assemblerName": "ca332", + "compilerName": "cx332" + }; } } @@ -216,13 +145,7 @@ function dumpVersion(compilerFilePath) { function guessEndianness(architecture) { // There is no mention of supported endianness in the cosmic compiler. - if (architecture.startsWith("arm") - || architecture === "stm8" - || architecture === "hcs8" - || architecture === "hcs12" - || architecture === "m68k") { - return "big"; - } + return "big"; } function dumpDefaultPaths(compilerFilePath, architecture) { diff --git a/share/qbs/modules/cpp/cosmic.qbs b/share/qbs/modules/cpp/cosmic.qbs index c1ed51859..16872cd38 100644 --- a/share/qbs/modules/cpp/cosmic.qbs +++ b/share/qbs/modules/cpp/cosmic.qbs @@ -72,26 +72,26 @@ CppModule { property string cCompilerName: compilerName property string cxxCompilerName: compilerName - compilerName: COSMIC.compilerName(qbs) + compilerExtension + compilerName: toolchainDetails.compilerName + compilerExtension compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) - assemblerName: COSMIC.assemblerName(qbs) + compilerExtension + assemblerName: toolchainDetails.assemblerName + compilerExtension assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName) - linkerName: COSMIC.linkerName(qbs) + compilerExtension + linkerName: "clnk" + compilerExtension linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName) - property string archiverName: COSMIC.archiverName(qbs) + compilerExtension + property string archiverName: "clib" + compilerExtension property string archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName) runtimeLibrary: "static" - staticLibrarySuffix: COSMIC.staticLibrarySuffix(qbs) - executableSuffix: COSMIC.executableSuffix(qbs) + staticLibrarySuffix: toolchainDetails.staticLibrarySuffix + executableSuffix: toolchainDetails.executableSuffix - property string objectSuffix: COSMIC.objectSuffix(qbs) + property string objectSuffix: ".o" - imageFormat: COSMIC.imageFormat(qbs) + imageFormat: "cosmic" enableExceptions: false enableRtti: false @@ -104,6 +104,8 @@ CppModule { libraryPathFlag: "-l" linkerScriptFlag: "" + toolchainDetails: COSMIC.toolchainDetails(qbs) + knownArchitectures: ["arm", "hcs12", "hcs8", "m68k", "stm8"] Rule { diff --git a/share/qbs/modules/cpp/iar.js b/share/qbs/modules/cpp/iar.js index 434e57bc8..5193b1814 100644 --- a/share/qbs/modules/cpp/iar.js +++ b/share/qbs/modules/cpp/iar.js @@ -210,172 +210,103 @@ function architectureCode(architecture) { } } -function compilerName(qbs) { +function toolchainDetails(qbs) { var architecture = qbs.architecture; - if (architecture.startsWith("arm")) - return "iccarm"; - else if (architecture === "78k") - return "icc78k"; - else if (architecture === "avr") - return "iccavr"; - else if (architecture === "avr32") - return "iccavr32"; - else if (architecture === "cr16") - return "icccr16c"; - else if (architecture === "hcs12") - return "icchcs12"; - else if (architecture === "hcs8") - return "iccs08"; - else if (architecture === "m16c") - return "iccm16c"; - else if (architecture === "m32c") - return "iccm32c"; - else if (architecture === "m68k") - return "icccf"; - else if (architecture === "mcs51") - return "icc8051"; - else if (architecture === "msp430") - return "icc430"; - else if (architecture === "r32c") - return "iccr32c"; - else if (architecture === "rh850") - return "iccrh850"; - else if (architecture === "riscv") - return "iccriscv"; - else if (architecture === "rl78") - return "iccrl78"; - else if (architecture === "rx") - return "iccrx"; - else if (architecture === "sh") - return "iccsh"; - else if (architecture === "stm8") - return "iccstm8"; - else if (architecture === "v850") - return "iccv850"; -} - -function assemblerName(qbs) { - var architecture = qbs.architecture; - if (architecture.startsWith("arm")) - return "iasmarm"; - else if (architecture === "78k") - return "a78k"; - else if (architecture === "avr") - return "aavr"; - else if (architecture === "avr32") - return "aavr32"; - else if (architecture === "cr16") - return "acr16c"; - else if (architecture === "hcs12") - return "ahcs12"; - else if (architecture === "hcs8") - return "as08"; - else if (architecture === "m16c") - return "am16c"; - else if (architecture === "m32c") - return "am32c"; - else if (architecture === "m68k") - return "acf"; - else if (architecture === "mcs51") - return "a8051"; - else if (architecture === "msp430") - return "a430"; - else if (architecture === "r32c") - return "ar32c"; - else if (architecture === "rh850") - return "iasmrh850"; - else if (architecture === "riscv") - return "iasmriscv"; - else if (architecture === "rl78") - return "iasmrl78"; - else if (architecture === "rx") - return "iasmrx"; - else if (architecture === "sh") - return "iasmsh"; - else if (architecture === "stm8") - return "iasmstm8"; - else if (architecture === "v850") - return "av850"; -} - -function linkerName(qbs) { - var architecture = qbs.architecture; - if (supportXLinker(architecture)) - return "xlink"; - else if (supportILinker(architecture)) - return architecture.startsWith("arm") ? "ilinkarm" : ("ilink" + architecture); -} + var code = architectureCode(architecture); + var details = {}; + + if (supportXLinker(architecture)) { + details.libraryPathFlag = "-I"; + details.linkerScriptFlag = "-f"; + details.linkerName = "xlink"; + details.linkerSilentFlag = "-S"; + details.linkerMapFileFlag = "-l"; + details.linkerEntryPointFlag = "-s"; + } else if (supportILinker(architecture)) { + details.libraryPathFlag = "-L"; + details.linkerScriptFlag = "--config"; + details.linkerSilentFlag = "--silent"; + details.linkerMapFileFlag = "--map"; + details.linkerEntryPointFlag = "--entry"; + details.linkerName = architecture.startsWith("arm") + ? "ilinkarm" : ("ilink" + architecture); + } -function archiverName(qbs) { - var architecture = qbs.architecture; if (supportXArchiver(architecture)) - return "xar"; + details.archiverName = "xar"; else if (supportIArchiver(architecture)) - return "iarchive"; -} - -function staticLibrarySuffix(qbs) { - var architecture = qbs.architecture; - var code = architectureCode(architecture); - return (code !== "") ? (".r" + code) : ".a"; -} - -function executableSuffix(qbs) { - var architecture = qbs.architecture; - var code = architectureCode(architecture); - return (code !== "") ? ((qbs.debugInformation) ? (".d" + code) : (".a" + code)) : ".out"; -} - -function objectSuffix(qbs) { - var architecture = qbs.architecture; - var code = architectureCode(architecture); - return (code !== "") ? (".r" + code) : ".o"; -} - -function imageFormat(qbs) { - var architecture = qbs.architecture; - var code = architectureCode(architecture); - return (code !== "") ? "ubrof" : "elf"; -} - -function libraryPathFlag(qbs) { - var architecture = qbs.architecture; - if (supportILinker(architecture)) - return "-L"; - else if (supportXLinker((architecture))) - return "-I"; -} + details.archiverName = "iarchive"; -function linkerScriptFlag(qbs) { - var architecture = qbs.architecture; - if (supportILinker(architecture)) - return "--config"; - else if (supportXLinker((architecture))) - return "-f"; -} - -function linkerSilentFlag(qbs) { - var architecture = qbs.architecture; - if (supportILinker(architecture)) - return "--silent"; - else if (supportXLinker(architecture)) - return "-S"; -} + var hasCode = (code !== ""); + details.staticLibrarySuffix = hasCode ? (".r" + code) : ".a"; + details.executableSuffix = hasCode + ? ((qbs.debugInformation) ? (".d" + code) : (".a" + code)) : ".out"; + details.objectSuffix = hasCode ? (".r" + code) : ".o"; + details.imageFormat = hasCode ? "ubrof" : "elf"; -function linkerMapFileFlag(qbs) { - var architecture = qbs.architecture; - if (supportILinker(architecture)) - return "--map"; - else if (supportXLinker(architecture)) - return "-l"; -} + if (architecture.startsWith("arm")) { + details.compilerName = "iccarm"; + details.assemblerName = "iasmarm"; + } else if (architecture === "78k") { + details.compilerName = "icc78k"; + details.assemblerName = "a78k"; + } else if (architecture === "avr") { + details.compilerName = "iccavr"; + details.assemblerName = "aavr"; + } else if (architecture === "avr32") { + details.compilerName = "iccavr32"; + details.assemblerName = "aavr32"; + } else if (architecture === "cr16") { + details.compilerName = "icccr16c"; + details.assemblerName = "acr16c"; + } else if (architecture === "hcs12") { + details.compilerName = "icchcs12"; + details.assemblerName = "ahcs12"; + } else if (architecture === "hcs8") { + details.compilerName = "iccs08"; + details.assemblerName = "as08"; + } else if (architecture === "m16c") { + details.compilerName = "iccm16c"; + details.assemblerName = "am16c"; + } else if (architecture === "m32c") { + details.compilerName = "iccm32c"; + details.assemblerName = "am32c"; + } else if (architecture === "m68k") { + details.compilerName = "icccf"; + details.assemblerName = "acf"; + } else if (architecture === "mcs51") { + details.compilerName = "icc8051"; + details.assemblerName = "a8051"; + } else if (architecture === "msp430") { + details.compilerName = "icc430"; + details.assemblerName = "a430"; + } else if (architecture === "r32c") { + details.compilerName = "iccr32c"; + details.assemblerName = "ar32c"; + } else if (architecture === "rh850") { + details.compilerName = "iccrh850"; + details.assemblerName = "iasmrh850"; + } else if (architecture === "riscv") { + details.compilerName = "iccriscv"; + details.assemblerName = "iasmriscv"; + } else if (architecture === "rl78") { + details.compilerName = "iccrl78"; + details.assemblerName = "iasmrl78"; + } else if (architecture === "rx") { + details.compilerName = "iccrx"; + details.assemblerName = "iasmrx"; + } else if (architecture === "sh") { + details.compilerName = "iccsh"; + details.assemblerName = "iasmsh"; + } else if (architecture === "stm8") { + details.compilerName = "iccstm8"; + details.assemblerName = "iasmstm8"; + } else if (architecture === "v850") { + details.compilerName = "iccv850"; + details.assemblerName = "av850"; + } -function linkerEntryPointFlag(qbs) { - var architecture = qbs.architecture; - if (supportILinker(architecture)) - return "--entry"; - else if (supportXLinker(architecture)) - return "-s"; + return details; } function guessArmArchitecture(core) { @@ -757,15 +688,15 @@ function linkerFlags(project, product, inputs, outputs) { args = args.concat(Cpp.collectLinkerScriptPathsArguments(product, inputs)); // Silent output generation flag. - args.push(linkerSilentFlag(product.qbs)); + args.push(product.cpp.linkerSilentFlag); // Map file generation flag. if (product.cpp.generateLinkerMapFile) - args.push(linkerMapFileFlag(product.qbs), outputs.mem_map[0].filePath); + args.push(product.cpp.linkerMapFileFlag, outputs.mem_map[0].filePath); // Entry point flag. if (product.cpp.entryPoint) - args.push(linkerEntryPointFlag(product.qbs), product.cpp.entryPoint); + args.push(product.cpp.linkerEntryPointFlag, product.cpp.entryPoint); // Debug information flag. if (supportXLinker(product.qbs.architecture)) { diff --git a/share/qbs/modules/cpp/iar.qbs b/share/qbs/modules/cpp/iar.qbs index 092d1a092..ed63bd13c 100644 --- a/share/qbs/modules/cpp/iar.qbs +++ b/share/qbs/modules/cpp/iar.qbs @@ -72,25 +72,25 @@ CppModule { property string cCompilerName: compilerName property string cxxCompilerName: compilerName - compilerName: IAR.compilerName(qbs) + compilerExtension + compilerName: toolchainDetails.compilerName + compilerExtension compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) - assemblerName: IAR.assemblerName(qbs) + compilerExtension + assemblerName: toolchainDetails.assemblerName + compilerExtension assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName) - linkerName: IAR.linkerName(qbs) + compilerExtension + linkerName: toolchainDetails.linkerName + compilerExtension linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName) - property string archiverName: IAR.archiverName(qbs) + compilerExtension + property string archiverName: toolchainDetails.archiverName + compilerExtension property string archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName) runtimeLibrary: "static" - staticLibrarySuffix: IAR.staticLibrarySuffix(qbs) - executableSuffix: IAR.executableSuffix(qbs) - objectSuffix: IAR.objectSuffix(qbs) + staticLibrarySuffix: toolchainDetails.staticLibrarySuffix + executableSuffix: toolchainDetails.executableSuffix + objectSuffix: toolchainDetails.objectSuffix - imageFormat: IAR.imageFormat(qbs) + imageFormat: toolchainDetails.imageFormat enableExceptions: false enableRtti: false @@ -100,8 +100,14 @@ CppModule { systemIncludeFlag: "-I" preincludeFlag: "--preinclude" libraryDependencyFlag: "" - libraryPathFlag: IAR.libraryPathFlag(qbs) - linkerScriptFlag: IAR.linkerScriptFlag(qbs) + libraryPathFlag: toolchainDetails.libraryPathFlag + linkerScriptFlag: toolchainDetails.linkerScriptFlag + + property string linkerSilentFlag: toolchainDetails.linkerSilentFlag + property string linkerMapFileFlag: toolchainDetails.linkerMapFileFlag + property string linkerEntryPointFlag: toolchainDetails.linkerEntryPointFlag + + toolchainDetails: IAR.toolchainDetails(qbs) knownArchitectures: ["78k", "arm", "avr", "avr32", "cr16", "hcs12", "hcs8", "m16c", "m32c", "m68k", "mcs51", "msp430", diff --git a/share/qbs/modules/cpp/keil.js b/share/qbs/modules/cpp/keil.js index 9eb2098c1..b398396df 100644 --- a/share/qbs/modules/cpp/keil.js +++ b/share/qbs/modules/cpp/keil.js @@ -77,102 +77,6 @@ function isArmClangCompiler(compilerPath) { return FileInfo.baseName(compilerPath).toLowerCase() === "armclang"; } -function compilerName(qbs) { - var architecture = qbs.architecture; - if (isMcs51Architecture(architecture)) - return "c51"; - if (isMcs251Architecture(architecture)) - return "c251"; - if (isC166Architecture(architecture)) - return "c166"; - if (isArmArchitecture(architecture)) - return "armcc"; -} - -function assemblerName(qbs) { - var architecture = qbs.architecture; - if (isMcs51Architecture(architecture)) - return "a51"; - if (isMcs251Architecture(architecture)) - return "a251"; - if (isC166Architecture(architecture)) - return "a166"; - if (isArmArchitecture(architecture)) - return "armasm"; -} - -function linkerName(qbs) { - var architecture = qbs.architecture; - if (isMcs51Architecture(architecture)) - return "bl51"; - if (isMcs251Architecture(architecture)) - return "l251"; - if (isC166Architecture(architecture)) - return "l166"; - if (isArmArchitecture(architecture)) - return "armlink"; -} - -function archiverName(qbs) { - var architecture = qbs.architecture; - if (isMcs51Architecture(architecture)) - return "lib51"; - if (isMcs251Architecture(architecture)) - return "lib251"; - if (isC166Architecture(architecture)) - return "lib166"; - if (isArmArchitecture(architecture)) - return "armar"; -} - -function disassemblerName(qbs) { - var architecture = qbs.architecture; - return isArmArchitecture(architecture) ? "fromelf" : undefined; -} - -function staticLibrarySuffix(qbs) { - var architecture = qbs.architecture; - if (isMcsArchitecture(architecture) || isC166Architecture(architecture) - || isArmArchitecture(architecture)) { - return ".lib"; - } -} - -function executableSuffix(qbs) { - var architecture = qbs.architecture; - if (isMcsArchitecture(architecture) || isC166Architecture(architecture)) - return ".abs"; - if (isArmArchitecture(architecture)) - return ".axf"; -} - -function objectSuffix(qbs) { - var architecture = qbs.architecture; - if (isMcsArchitecture(architecture) || isC166Architecture(architecture)) - return ".obj"; - if (isArmArchitecture(architecture)) - return ".o"; -} - -function linkerMapSuffix(qbs) { - var architecture = qbs.architecture; - if (isMcs51Architecture(architecture)) - return ".m51"; - if (isC166Architecture(architecture)) - return ".m66"; - return ".map"; -} - -function imageFormat(qbs) { - var architecture = qbs.architecture; - if (isMcsArchitecture(architecture) || isC166Architecture(architecture)) - // Keil OMF51 or OMF2 Object Module Format (which is an - // extension of the original Intel OMF51). - return "omf"; - if (isArmArchitecture(architecture)) - return "elf"; -} - function preincludeFlag(compilerPath) { if (isArmCCCompiler(compilerPath)) return "--preinclude"; @@ -180,6 +84,56 @@ function preincludeFlag(compilerPath) { return "-include"; } +function toolchainDetails(qbs) { + var architecture = qbs.architecture; + if (isMcs51Architecture(architecture)) { + return { + "imageFormat": "omf", + "linkerMapSuffix":".m51", + "objectSuffix": ".obj", + "executableSuffix": ".abs", + "compilerName": "c51", + "assemblerName": "a51", + "linkerName": "bl51", + "archiverName": "lib51" + }; + } else if (isMcs251Architecture(architecture)) { + return { + "imageFormat": "omf", + "linkerMapSuffix":".m51", + "objectSuffix": ".obj", + "executableSuffix": ".abs", + "compilerName": "c251", + "assemblerName": "a251", + "linkerName": "l251", + "archiverName": "lib251" + }; + } else if (isC166Architecture(architecture)) { + return { + "imageFormat": "omf", + "linkerMapSuffix":".m66", + "objectSuffix": ".obj", + "executableSuffix": ".abs", + "compilerName": "c166", + "assemblerName": "a166", + "linkerName": "l166", + "archiverName": "lib166" + }; + } else if (isArmArchitecture(architecture)) { + return { + "imageFormat": "elf", + "linkerMapSuffix":".map", + "objectSuffix": ".o", + "executableSuffix": ".axf", + "disassemblerName": "fromelf", + "compilerName": "armcc", + "assemblerName": "armasm", + "linkerName": "armlink", + "archiverName": "armar" + }; + } +} + function guessArmCCArchitecture(targetArchArm, targetArchThumb) { var arch = "arm"; if (targetArchArm === "4" && targetArchThumb === "0") diff --git a/share/qbs/modules/cpp/keil.qbs b/share/qbs/modules/cpp/keil.qbs index 7aab9ba3b..b9d3f8264 100644 --- a/share/qbs/modules/cpp/keil.qbs +++ b/share/qbs/modules/cpp/keil.qbs @@ -70,29 +70,29 @@ CppModule { property string cCompilerName: compilerName property string cxxCompilerName: compilerName - compilerName: KEIL.compilerName(qbs) + compilerExtension + compilerName: toolchainDetails.compilerName + compilerExtension compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) - assemblerName: KEIL.assemblerName(qbs) + compilerExtension + assemblerName: toolchainDetails.assemblerName + compilerExtension assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName) - linkerName: KEIL.linkerName(qbs) + compilerExtension + linkerName: toolchainDetails.linkerName + compilerExtension linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName) - property string archiverName: KEIL.archiverName(qbs) + compilerExtension + property string archiverName: toolchainDetails.archiverName + compilerExtension property string archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName) - property string disassemblerName: KEIL.disassemblerName(qbs) + compilerExtension + property string disassemblerName: toolchainDetails.disassemblerName + compilerExtension property string disassemblerPath: FileInfo.joinPaths(toolchainInstallPath, disassemblerName) runtimeLibrary: "static" - staticLibrarySuffix: KEIL.staticLibrarySuffix(qbs) - executableSuffix: KEIL.executableSuffix(qbs) - objectSuffix: KEIL.objectSuffix(qbs) - linkerMapSuffix: KEIL.linkerMapSuffix(qbs) + staticLibrarySuffix: ".lib" + executableSuffix: toolchainDetails.executableSuffix + objectSuffix: toolchainDetails.objectSuffix + linkerMapSuffix: toolchainDetails.linkerMapSuffix - imageFormat: KEIL.imageFormat(qbs) + imageFormat: toolchainDetails.imageFormat enableExceptions: false enableRtti: false @@ -105,6 +105,8 @@ CppModule { libraryPathFlag: "--userlibpath=" linkerScriptFlag: "--scatter" + toolchainDetails: KEIL.toolchainDetails(qbs) + knownArchitectures: ["arm", "c166", "mcs251", "mcs51"] Rule { diff --git a/share/qbs/modules/cpp/sdcc.js b/share/qbs/modules/cpp/sdcc.js index 1c99b902c..fe9406baa 100644 --- a/share/qbs/modules/cpp/sdcc.js +++ b/share/qbs/modules/cpp/sdcc.js @@ -41,36 +41,26 @@ var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); var WindowsUtils = require("qbs.WindowsUtils"); -function compilerName(qbs) { - return "sdcc"; -} - -function assemblerName(qbs) { - switch (qbs.architecture) { - case "mcs51": - return "sdas8051"; - case "stm8": - return "sdasstm8"; - case "hcs8": - return "sdas6808"; - } -} - -function linkerName(qbs) { - switch (qbs.architecture) { - case "mcs51": - return "sdld"; - case "stm8": - return "sdldstm8"; - case "hcs8": - return "sdld6808"; +function toolchainDetails(qbs) { + var architecture = qbs.architecture; + if (architecture === "mcs51") { + return { + "assemblerName": "sdas8051", + "linkerName": "sdld" + } + } else if (architecture === "stm8") { + return { + "assemblerName": "sdasstm8", + "linkerName": "sdldstm8" + } + } else if (architecture === "hcs8") { + return { + "assemblerName": "sdas6808", + "linkerName": "sdld6808" + } } } -function archiverName(qbs) { - return "sdar"; -} - function targetArchitectureFlag(architecture) { if (architecture === "mcs51") return "-mmcs51"; diff --git a/share/qbs/modules/cpp/sdcc.qbs b/share/qbs/modules/cpp/sdcc.qbs index f2b182059..3f7691769 100644 --- a/share/qbs/modules/cpp/sdcc.qbs +++ b/share/qbs/modules/cpp/sdcc.qbs @@ -73,16 +73,16 @@ CppModule { property string linkerMode: "automatic" - compilerName: SDCC.compilerName(qbs) + compilerExtension + compilerName: "sdcc" + compilerExtension compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) - assemblerName: SDCC.assemblerName(qbs) + compilerExtension + assemblerName: toolchainDetails.assemblerName + compilerExtension assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName) - linkerName: SDCC.linkerName(qbs) + compilerExtension + linkerName: toolchainDetails.linkerName + compilerExtension linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName) - property string archiverName: SDCC.archiverName(qbs) + compilerExtension + property string archiverName: "sdar" + compilerExtension property string archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName) runtimeLibrary: "static" @@ -104,6 +104,8 @@ CppModule { libraryPathFlag: "-L" linkerScriptFlag: "-f" + toolchainDetails: SDCC.toolchainDetails(qbs) + knownArchitectures: ["hcs8", "mcs51", "stm8"] Rule { |