Nimscript: the compiler supports a directory wide config.nims file

This commit is contained in:
Araq 2015-09-29 21:01:26 +02:00
commit 29dac5ed60
2 changed files with 5 additions and 1 deletions

View file

@ -59,6 +59,9 @@ proc handleCmdLine() =
runNimScript(scriptFile) runNimScript(scriptFile)
# '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"):
# directory wide NimScript file
runNimScript(gProjectPath / "config.nims")
# 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()

View file

@ -9,7 +9,8 @@ system.
So instead of a ``myproject.nim.cfg`` configuration file, you can use So instead of a ``myproject.nim.cfg`` configuration file, you can use
a ``myproject.nims`` file that simply contains Nim code controlling the a ``myproject.nims`` file that simply contains Nim code controlling the
compilation process. compilation process. For a directory wide configuration, use ``config.nims``
instead of ``nim.cfg``.
The VM cannot deal with ``importc``, the FFI is not available, so there are not The VM cannot deal with ``importc``, the FFI is not available, so there are not
many stdlib modules that you can use with Nim's VM. However, at least the many stdlib modules that you can use with Nim's VM. However, at least the