--usenimcache (implied by nim r main) now caches some compile options to avoid recompiling when project was previously compiled with such options. (#17829)

* `--usenimcache` (implied by `nim r main`) now caches some compile options
to avoid recompiling when project was previously compiled with such options.

* works
* add test
* changelog
* use std/with
This commit is contained in:
Timothee Cour 2021-04-25 01:25:31 -07:00 • committed by GitHub
commit ffe4328b35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 91 additions and 52 deletions

View file

@ -970,18 +970,3 @@ proc floatInt64Align*(conf: ConfigRef): int16 =
# to 4bytes (except with -malign-double)
return 4
return 8
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