diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2019-08-16 15:47:01 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2019-08-19 15:21:11 +0000 |
commit | 3865c5d052949f8ec6cc26545933edb6e17ceb00 (patch) | |
tree | e08662e940cb97c0c7a9baff48b0a4a9c93c068e /share/qbs/modules/cpp/keil.qbs | |
parent | 9e5fb5581e680442dbf1e66746bfa765e274415b (diff) |
baremetal: Improve JS code in KEIL module a bit
* Move an architecture-specific code to a functions in the keil.js file.
* Remove the redundant copy-paste code.
* Align order for assembler, compiler, linker and archiver flags to
the unified form, like:
<inputs> <outputs> <defines> <includes> <flags>
* Add some comments.
* Fix handling of c{xx}LanguageVersion property.
* Fix JS warnings about the variables re-definition.
Change-Id: I708a446292e6f5c6bfb56ef3fa92815123808ccf
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'share/qbs/modules/cpp/keil.qbs')
-rw-r--r-- | share/qbs/modules/cpp/keil.qbs | 83 |
1 files changed, 12 insertions, 71 deletions
diff --git a/share/qbs/modules/cpp/keil.qbs b/share/qbs/modules/cpp/keil.qbs index cb6094f51..2d29112cd 100644 --- a/share/qbs/modules/cpp/keil.qbs +++ b/share/qbs/modules/cpp/keil.qbs @@ -78,85 +78,26 @@ CppModule { property string cCompilerName: compilerName property string cxxCompilerName: compilerName - compilerName: { - switch (qbs.architecture) { - case "mcs51": - return "c51" + compilerExtension; - case "arm": - return "armcc" + compilerExtension; - } - } + compilerName: KEIL.compilerName(qbs) + compilerExtension compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) - assemblerName: { - switch (qbs.architecture) { - case "mcs51": - return "a51" + compilerExtension; - case "arm": - return "armasm" + compilerExtension; - } - } + assemblerName: KEIL.assemblerName(qbs) + compilerExtension assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName) - linkerName: { - switch (qbs.architecture) { - case "mcs51": - return "bl51" + compilerExtension; - case "arm": - return "armlink" + compilerExtension; - } - } + linkerName: KEIL.linkerName(qbs) + compilerExtension linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName) - property string archiverName: { - switch (qbs.architecture) { - case "mcs51": - return "lib51" + compilerExtension; - case "arm": - return "armar" + compilerExtension; - } - } + property string archiverName: KEIL.archiverName(qbs) + compilerExtension property string archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName) runtimeLibrary: "static" - staticLibrarySuffix: { - switch (qbs.architecture) { - case "mcs51": - return ".lib"; - case "arm": - return ".lib"; - } - } - - executableSuffix: { - switch (qbs.architecture) { - case "mcs51": - return ".abs"; - case "arm": - return ".axf"; - } - } + staticLibrarySuffix: KEIL.staticLibrarySuffix(qbs) + executableSuffix: KEIL.executableSuffix(qbs) - property string objectSuffix: { - switch (qbs.architecture) { - case "mcs51": - return ".obj"; - case "arm": - return ".o"; - } - } + property string objectSuffix: KEIL.objectSuffix(qbs) - imageFormat: { - switch (qbs.architecture) { - case "mcs51": - // Keil OMF51 or OMF2 Object Module Format (which is an - // extension of the original Intel OMF51). - return "omf"; - case "arm": - return "elf"; - } - } + imageFormat: KEIL.imageFormat(qbs) enableExceptions: false enableRtti: false @@ -171,7 +112,7 @@ CppModule { + input.fileName + input.cpp.objectSuffix } - prepare: KEIL.prepareAssembler.apply(KEIL, arguments); + prepare: KEIL.prepareAssembler.apply(KEIL, arguments) } FileTagger { @@ -190,7 +131,7 @@ CppModule { + input.fileName + input.cpp.objectSuffix } - prepare: KEIL.prepareCompiler.apply(KEIL, arguments); + prepare: KEIL.prepareCompiler.apply(KEIL, arguments) } Rule { @@ -223,7 +164,7 @@ CppModule { return artifacts; } - prepare:KEIL.prepareLinker.apply(KEIL, arguments); + prepare: KEIL.prepareLinker.apply(KEIL, arguments) } Rule { @@ -239,6 +180,6 @@ CppModule { PathTools.staticLibraryFilePath(product)) } - prepare: KEIL.prepareArchiver.apply(KEIL, arguments); + prepare: KEIL.prepareArchiver.apply(KEIL, arguments) } } |