配置Nim的默認編譯參數 release build並運行ui
默認狀況下nim編譯是debug build,若是須要release build, 須要加上-d:release ,
release編譯的命令以下:
nim c -d:release xx.nim
debug
release build並運行:
nim c -r -d:release xx.nim
code
debug build出來可執行文件體積稍大,而且目前對來我說沒有用。編譯器
我發現經過配置nim.cfg,能夠給nim編譯器配置默認的編譯參數,nim.cfg文件位於nim的安裝目錄/config下。it
相似以下在nim.cfg中添加參數r和d:release,一行一個參數:io
# Configuration file for the Nim Compiler. # (c) 2017 Andreas Rumpf # Feel free to edit the default values as you need. # You may set environment variables with # @putenv "key" "val" # Environment variables can be accessed like so: # gcc.path %= "$CC_PATH" cc = gcc r d:release ... ... ...
以後當你執行nim c xx.nim
的時候,配置文件中參數自動傳送給Nim編譯器:
等於 nim c -r -d:release xx.nim
編譯
2018-01-18 18:30:00 codegayclass