diff options
author | Tomohiro <gpuppur@gmail.com> | 2020-07-02 20:20:34 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-02 13:20:34 +0200 |
commit | 366b9a7e4a067cece3b1215de7fb4dffc703e88a (patch) | |
tree | 9f023a82645447ce24dc1618aead9e198a77d61e /compiler | |
parent | d590611fc5de48a281db946d223def3d94b0260f (diff) | |
download | Nim-366b9a7e4a067cece3b1215de7fb4dffc703e88a.tar.gz |
Fix #12745 (#14879)
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/extccomp.nim | 12 | ||||
-rw-r--r-- | compiler/main.nim | 5 |
2 files changed, 6 insertions, 11 deletions
diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 6feb68f81..7d5df0906 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -281,9 +281,6 @@ const hExt* = ".h" -proc libNameTmpl(conf: ConfigRef): string {.inline.} = - result = if conf.target.targetOS == osWindows: "$1.lib" else: "lib$1.a" - proc nameToCC*(name: string): TSystemCC = ## Returns the kind of compiler referred to by `name`, or ccNone ## if the name doesn't refer to any known compiler. @@ -663,14 +660,7 @@ proc addExternalFileToCompile*(conf: ConfigRef; filename: AbsoluteFile) = proc getLinkCmd(conf: ConfigRef; output: AbsoluteFile, objfiles: string, isDllBuild: bool): string = if optGenStaticLib in conf.globalOptions: - var libname: string - if not conf.outFile.isEmpty: - libname = conf.outFile.string.expandTilde - if not libname.isAbsolute(): - libname = getCurrentDir() / libname - else: - libname = (libNameTmpl(conf) % splitFile(conf.projectName).name) - result = CC[conf.cCompiler].buildLib % ["libfile", quoteShell(libname), + result = CC[conf.cCompiler].buildLib % ["libfile", quoteShell(output), "objfiles", objfiles] else: var linkerExe = getConfigVar(conf, conf.cCompiler, ".linkerexe") diff --git a/compiler/main.nim b/compiler/main.nim index e498dc6b9..25a42300f 100644 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -67,10 +67,15 @@ when not defined(leanCompiler): finishDoc2Pass(graph.config.projectName) proc setOutFile(conf: ConfigRef) = + proc libNameTmpl(conf: ConfigRef): string {.inline.} = + result = if conf.target.targetOS == osWindows: "$1.lib" else: "lib$1.a" + if conf.outFile.isEmpty: let base = conf.projectName let targetName = if optGenDynLib in conf.globalOptions: platform.OS[conf.target.targetOS].dllFrmt % base + elif optGenStaticLib in conf.globalOptions: + libNameTmpl(conf) % base else: base & platform.OS[conf.target.targetOS].exeExt conf.outFile = RelativeFile targetName |