配置Nim的默认编译参数 release build并运行

配置Nim的默认编译参数 release build并运行ui

默认状况下nim编译是debug build,若是须要release build, 须要加上-d:release ,
release编译的命令以下:
nim c -d:release xx.nimdebug

release build并运行:
nim c -r -d:release xx.nimcode

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

相关文章
相关标签/搜索