Nimscript knows about the command line defines
This commit is contained in:
parent
749abfc39c
commit
bcc91a319c
2 changed files with 4 additions and 4 deletions
|
|
@ -56,12 +56,12 @@ proc handleCmdLine() =
|
||||||
loadConfigs(DefaultConfig) # load all config files
|
loadConfigs(DefaultConfig) # load all config files
|
||||||
let scriptFile = gProjectFull.changeFileExt("nims")
|
let scriptFile = gProjectFull.changeFileExt("nims")
|
||||||
if fileExists(scriptFile):
|
if fileExists(scriptFile):
|
||||||
runNimScript(scriptFile)
|
runNimScript(scriptFile, freshDefines=false)
|
||||||
# 'nim foo.nims' means to just run the NimScript file and do nothing more:
|
# 'nim foo.nims' means to just run the NimScript file and do nothing more:
|
||||||
if scriptFile == gProjectFull: return
|
if scriptFile == gProjectFull: return
|
||||||
elif fileExists(gProjectPath / "config.nims"):
|
elif fileExists(gProjectPath / "config.nims"):
|
||||||
# directory wide NimScript file
|
# directory wide NimScript file
|
||||||
runNimScript(gProjectPath / "config.nims")
|
runNimScript(gProjectPath / "config.nims", freshDefines=false)
|
||||||
# now process command line arguments again, because some options in the
|
# now process command line arguments again, because some options in the
|
||||||
# command line can overwite the config file's settings
|
# command line can overwite the config file's settings
|
||||||
extccomp.initVars()
|
extccomp.initVars()
|
||||||
|
|
|
||||||
|
|
@ -118,10 +118,10 @@ proc setupVM*(module: PSym; scriptName: string): PEvalContext =
|
||||||
processSwitch(a.getString 0, a.getString 1, passPP, unknownLineInfo())
|
processSwitch(a.getString 0, a.getString 1, passPP, unknownLineInfo())
|
||||||
|
|
||||||
|
|
||||||
proc runNimScript*(scriptName: string) =
|
proc runNimScript*(scriptName: string; freshDefines=true) =
|
||||||
passes.gIncludeFile = includeModule
|
passes.gIncludeFile = includeModule
|
||||||
passes.gImportModule = importModule
|
passes.gImportModule = importModule
|
||||||
initDefines()
|
if freshDefines: initDefines()
|
||||||
|
|
||||||
defineSymbol("nimscript")
|
defineSymbol("nimscript")
|
||||||
defineSymbol("nimconfig")
|
defineSymbol("nimconfig")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue