options
Imports
Types
TOption = enum optNone, optObjCheck, optFieldCheck, optRangeCheck, optBoundsCheck, optOverflowCheck, optRefCheck, optNaNCheck, optInfCheck, optStaticBoundsCheck, optStyleCheck, optAssert, optLineDir, optWarns, optHints, optOptimizeSpeed, optOptimizeSize, optStackTrace, optStackTraceMsgs, optLineTrace, optByRef, optProfiler, optImplicitStatic, optTrMacros, optMemTracker, optNilSeqs, optSinkInference, optCursorInference
- Source Edit
TOptions = set[TOption]
- Source Edit
TGlobalOption = enum gloptNone, optForceFullMake, optWasNimscript, optListCmd, optCompileOnly, optNoLinking, optCDebug, optGenDynLib, optGenStaticLib, optGenGuiApp, optGenScript, optGenMapping, optRun, optUseNimcache, optStyleHint, optStyleError, optStyleUsages, optSkipSystemConfigFile, optSkipProjConfigFile, optSkipUserConfigFile, optSkipParentConfigFiles, optNoMain, optUseColors, optThreads, optStdout, optThreadAnalysis, optTaintMode, optTlsEmulation, optGenIndex, optEmbedOrigSrc, optIdeDebug, optIdeTerse, optExcessiveStackTrace, optShowAllMismatches, optWholeProject, optDocInternal, optMixedMode, optListFullPaths, optNoNimblePath, optHotCodeReloading, optDynlibOverrideAll, optSeqDestructors, optTinyRtti, optOwnedRefs, optMultiMethods, optBenchmarkVM, optProduceAsm, optPanics, optNimV1Emulation, optNimV12Emulation, optSourcemap, optProfileVM, optEnableDeepCopy
- Source Edit
TGlobalOptions = set[TGlobalOption]
- Source Edit
TBackend = enum backendInvalid = "", backendC = "c", backendCpp = "cpp", backendJs = "js", backendObjc = "objc"
- Source Edit
TCommands = enum cmdNone, cmdCompileToC, cmdCompileToCpp, cmdCompileToOC, cmdCompileToJS, cmdCompileToLLVM, cmdInterpret, cmdPretty, cmdDoc, cmdGenDepend, cmdDump, cmdCheck, cmdParse, cmdScan, cmdIdeTools, cmdDef, cmdRst2html, cmdRst2tex, cmdInteractive, cmdRun, cmdJsonScript, cmdCompileToBackend
- Source Edit
TStringSeq = seq[string]
- Source Edit
TGCMode = enum gcUnselected, gcNone, gcBoehm, gcRegions, gcArc, gcOrc, gcMarkAndSweep, gcHooks, gcRefc, gcV2, gcGo
- Source Edit
IdeCmd = enum ideNone, ideSug, ideCon, ideDef, ideUse, ideDus, ideChk, ideMod, ideHighlight, ideOutline, ideKnown, ideMsg, ideProject
- Source Edit
Feature = enum implicitDeref, dotOperators, callOperator, parallel, destructor, notnil, dynamicBindSym, forLoopMacros, caseStmtMacros, codeReordering, compiletimeFFI, ## This requires building nim with `-d:nimHasLibFFI` ## which itself requires `nimble install libffi`, see #10150 ## Note: this feature can't be localized with {.push.} vmopsDanger, strictFuncs, views
- experimental features; DO NOT RENAME THESE! Source Edit
LegacyFeature = enum allowSemcheckedAstModification, ## Allows to modify a NimNode where the type has already been ## flagged with nfSem. If you actually do this, it will cause ## bugs. checkUnsignedConversions ## Historically and especially in version 1.0.0 of the language ## conversions to unsigned numbers were checked. In 1.0.4 they ## are not anymore.
- Source Edit
SymbolFilesOption = enum disabledSf, writeOnlySf, readOnlySf, v2Sf
- Source Edit
TSystemCC = enum ccNone, ccGcc, ccNintendoSwitch, ccLLVM_Gcc, ccCLang, ccBcc, ccVcc, ccTcc, ccEnv, ccIcl, ccIcc, ccClangCl
- Source Edit
ExceptionSystem = enum excNone, excSetjmp, excCpp, excGoto, excQuirky
- Source Edit
CfileFlag {...}{.pure.} = enum Cached, ## no need to recompile this time External ## file was introduced via .compile pragma
- Source Edit
Cfile = object nimname*: string cname*, obj*: AbsoluteFile flags*: set[CfileFlag] customArgs*: string
- Source Edit
CfileList = seq[Cfile]
- Source Edit
Suggest = ref object section*: IdeCmd qualifiedPath*: seq[string] name*: ptr string filePath*: string line*: int column*: int doc*: string forth*: string quality*: range[0 .. 100] isGlobal*: bool contextFits*: bool prefix*: PrefixMatch symkind*: byte scope*, localUsages*, globalUsages*: int tokenLen*: int version*: int
- Source Edit
Suggestions = seq[Suggest]
- Source Edit
ProfileInfo = object time*: float count*: int
- Source Edit
ProfileData = ref object data*: TableRef[TLineInfo, ProfileInfo]
- Source Edit
ConfigRef {...}{.acyclic.} = ref object backend*: TBackend target*: Target linesCompiled*: int options*: TOptions globalOptions*: TGlobalOptions macrosToExpand*: StringTableRef arcToExpand*: StringTableRef m*: MsgConfig evalTemplateCounter*: int evalMacroCounter*: int exitcode*: int8 cmd*: TCommands selectedGC*: TGCMode exc*: ExceptionSystem verbosity*: int numberOfProcessors*: int evalExpr*: string lastCmdTime*: float symbolFiles*: SymbolFilesOption cppDefines*: HashSet[string] headerFile*: string features*: set[Feature] legacyFeatures*: set[LegacyFeature] arguments*: string ## the arguments to be passed to the program that ## should be run ideCmd*: IdeCmd oldNewlines*: bool cCompiler*: TSystemCC modifiedyNotes*: TNoteKinds cmdlineNotes*: TNoteKinds foreignPackageNotes*: TNoteKinds notes*: TNoteKinds warningAsErrors*: TNoteKinds mainPackageNotes*: TNoteKinds mainPackageId*: int errorCounter*: int hintCounter*: int warnCounter*: int errorMax*: int maxLoopIterationsVM*: int ## VM: max iterations of all loops configVars*: StringTableRef symbols*: StringTableRef ## We need to use a StringTableRef here as defined ## symbols are always guaranteed to be style ## insensitive. Otherwise hell would break lose. packageCache*: StringTableRef nimblePaths*: seq[AbsoluteDir] searchPaths*: seq[AbsoluteDir] lazyPaths*: seq[AbsoluteDir] outFile*: RelativeFile outDir*: AbsoluteDir jsonBuildFile*: AbsoluteFile prefixDir*, libpath*, nimcacheDir*: AbsoluteDir dllOverrides, moduleOverrides*, cfileSpecificOptions*: StringTableRef projectName*: string projectPath*: AbsoluteDir projectFull*: AbsoluteFile projectIsStdin*: bool lastMsgWasDot*: bool projectMainIdx*: FileIndex projectMainIdx2*: FileIndex command*: string commandArgs*: seq[string] commandLine*: string extraCmds*: seq[string] keepComments*: bool implicitImports*: seq[string] implicitIncludes*: seq[string] docSeeSrcUrl*: string docRoot*: string ## see nim --fullhelp for --docRoot docCmd*: string ## see nim --fullhelp for --docCmd cIncludes*: seq[AbsoluteDir] cLibs*: seq[AbsoluteDir] cLinkedLibs*: seq[string] externalToLink*: seq[string] linkOptionsCmd*: string compileOptionsCmd*: seq[string] linkOptions*: string compileOptions*: string cCompilerPath*: string toCompile*: CfileList suggestionResultHook*: proc (result: Suggest) {...}{.closure.} suggestVersion*: int suggestMaxResults*: int lastLineInfo*: TLineInfo writelnHook*: proc (output: string) {...}{.closure.} structuredErrorHook*: proc (config: ConfigRef; info: TLineInfo; msg: string; severity: Severity) {...}{.closure, gcsafe.} cppCustomNamespace*: string vmProfileData*: ProfileData
- every global configuration fields marked with '*' are subject to the incremental compilation mechanisms (+) means "part of the dependency" Source Edit
Consts
hasTinyCBackend = false
- Source Edit
useEffectSystem = true
- Source Edit
useWriteTracking = false
- Source Edit
hasFFI = false
- Source Edit
copyrightYear = "2021"
- Source Edit
harmlessOptions = {optForceFullMake, optNoLinking, optRun, optUseColors, optStdout}
- Source Edit
oldExperimentalFeatures = {implicitDeref, dotOperators, callOperator, parallel}
- Source Edit
ChecksOptions = {optObjCheck, optFieldCheck, optRangeCheck, optOverflowCheck, optBoundsCheck, optAssert, optNaNCheck, optInfCheck, optStyleCheck}
- Source Edit
DefaultOptions = {optObjCheck, optFieldCheck, optRangeCheck, optBoundsCheck, optOverflowCheck, optAssert, optWarns, optRefCheck, optHints, optStackTrace, optLineTrace, optTrMacros, optStyleCheck, optCursorInference}
- Source Edit
DefaultGlobalOptions = {optThreadAnalysis, optExcessiveStackTrace, optListFullPaths}
- Source Edit
genSubDir = r"nimcache"
- Source Edit
NimExt = "nim"
- Source Edit
RodExt = "rod"
- Source Edit
HtmlExt = "html"
- Source Edit
JsonExt = "json"
- Source Edit
TagsExt = "tags"
- Source Edit
TexExt = "tex"
- Source Edit
IniExt = "ini"
- Source Edit
DefaultConfig = r"nim.cfg"
- Source Edit
DefaultConfigNims = r"config.nims"
- Source Edit
DocConfig = r"nimdoc.cfg"
- Source Edit
DocTexConfig = r"nimdoc.tex.cfg"
- Source Edit
htmldocsDir = "htmldocs"
- Source Edit
docRootDefault = "@default"
- Source Edit
oKeepVariableNames = true
- Source Edit
Procs
proc assignIfDefault[T](result: var T; val: T; def = default(T))
- if
result
was already assigned to a value (that wasn'tdef
), this is a noop. Source Edit proc setNoteDefaults(conf: ConfigRef; note: TNoteKind; enabled = true) {...}{. raises: [], tags: [].}
- Source Edit
proc setNote(conf: ConfigRef; note: TNoteKind; enabled = true) {...}{.raises: [], tags: [].}
- Source Edit
proc hasHint(conf: ConfigRef; note: TNoteKind): bool {...}{.raises: [], tags: [].}
- Source Edit
proc hasWarn(conf: ConfigRef; note: TNoteKind): bool {...}{.inline, raises: [], tags: [].}
- Source Edit
proc hcrOn(conf: ConfigRef): bool {...}{.raises: [], tags: [].}
- Source Edit
proc getDateStr(): string {...}{.raises: [], tags: [ReadEnvEffect, TimeEffect].}
- Source Edit
proc getClockStr(): string {...}{.raises: [], tags: [ReadEnvEffect, TimeEffect].}
- Source Edit
proc newConfigRef(): ConfigRef {...}{.raises: [], tags: [].}
- Source Edit
proc newPartialConfigRef(): ConfigRef {...}{.raises: [], tags: [].}
- create a new ConfigRef that is only good enough for error reporting. Source Edit
proc cppDefine(c: ConfigRef; define: string) {...}{.raises: [], tags: [].}
- Source Edit
proc isDefined(conf: ConfigRef; symbol: string): bool {...}{.raises: [], tags: [].}
- Source Edit
proc importantComments(conf: ConfigRef): bool {...}{.inline, raises: [], tags: [].}
- Source Edit
proc usesWriteBarrier(conf: ConfigRef): bool {...}{.inline, raises: [], tags: [].}
- Source Edit
proc mainCommandArg(conf: ConfigRef): string {...}{.raises: [], tags: [].}
- This is intended for commands like check or parse which will work on the main project file unless explicitly given a specific file argument Source Edit
proc existsConfigVar(conf: ConfigRef; key: string): bool {...}{.raises: [], tags: [].}
- Source Edit
proc getConfigVar(conf: ConfigRef; key: string; default = ""): string {...}{. raises: [], tags: [].}
- Source Edit
proc setConfigVar(conf: ConfigRef; key, val: string) {...}{.raises: [], tags: [].}
- Source Edit
proc getOutFile(conf: ConfigRef; filename: RelativeFile; ext: string): AbsoluteFile {...}{. raises: [OSError], tags: [].}
- Source Edit
proc absOutFile(conf: ConfigRef): AbsoluteFile {...}{.raises: [OSError], tags: [ReadDirEffect].}
- Source Edit
proc prepareToWriteOutput(conf: ConfigRef): AbsoluteFile {...}{. raises: [OSError, IOError], tags: [ReadDirEffect, WriteDirEffect].}
- Create the output directory and returns a full path to the output file Source Edit
proc getPrefixDir(conf: ConfigRef): AbsoluteDir {...}{.raises: [], tags: [ReadIOEffect].}
-
Gets the prefix dir, usually the parent directory where the binary resides.
This is overridden by some tools (namely nimsuggest) via the
conf.prefixDir
field.- This should resolve to root of nim sources, whether running nim from a local
- clone or using installed nim, so that these exist:
result/doc/advopt.txt
and
Source Editresult/lib/system.nim
proc setDefaultLibpath(conf: ConfigRef) {...}{.raises: [OSError], tags: [ReadIOEffect, ReadDirEffect, ReadEnvEffect].}
- Source Edit
proc canonicalizePath(conf: ConfigRef; path: AbsoluteFile): AbsoluteFile {...}{. raises: [OSError], tags: [ReadDirEffect].}
- Source Edit
proc removeTrailingDirSep(path: string): string {...}{.raises: [], tags: [].}
- Source Edit
proc disableNimblePath(conf: ConfigRef) {...}{.raises: [], tags: [].}
- Source Edit
proc clearNimblePath(conf: ConfigRef) {...}{.raises: [], tags: [].}
- Source Edit
proc getNimbleFile(conf: ConfigRef; path: string): string {...}{.raises: [KeyError], tags: [ReadDirEffect].}
- returns absolute path to nimble file, e.g.: /pathto/cligen.nimble Source Edit
proc getPackageName(conf: ConfigRef; path: string): string {...}{.raises: [KeyError], tags: [ReadDirEffect].}
- returns nimble package name, e.g.:
cligen
Source Edit proc fakePackageName(conf: ConfigRef; path: AbsoluteFile): string {...}{. raises: [Exception], tags: [RootEffect].}
- Source Edit
proc demanglePackageName(path: string): string {...}{.raises: [], tags: [].}
- Source Edit
proc withPackageName(conf: ConfigRef; path: AbsoluteFile): AbsoluteFile {...}{. raises: [KeyError, OSError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc getNimcacheDir(conf: ConfigRef): AbsoluteDir {...}{.raises: [OSError], tags: [ReadEnvEffect, ReadIOEffect].}
- Source Edit
proc pathSubs(conf: ConfigRef; p, config: string): string {...}{. raises: [ValueError, OSError], tags: [ReadEnvEffect, ReadIOEffect].}
- Source Edit
proc toGeneratedFile(conf: ConfigRef; path: AbsoluteFile; ext: string): AbsoluteFile {...}{. raises: [OSError], tags: [ReadEnvEffect, ReadIOEffect].}
- converts "/home/a/mymodule.nim", "rod" to "/home/a/nimcache/mymodule.rod" Source Edit
proc completeGeneratedFilePath(conf: ConfigRef; f: AbsoluteFile; createSubDir: bool = true): AbsoluteFile {...}{. raises: [OSError, IOError], tags: [ReadEnvEffect, ReadIOEffect, WriteDirEffect, ReadDirEffect, WriteIOEffect].}
- Source Edit
proc getRelativePathFromConfigPath(conf: ConfigRef; f: AbsoluteFile): RelativeFile {...}{. raises: [Exception], tags: [RootEffect].}
- Source Edit
proc findFile(conf: ConfigRef; f: string; suppressStdlib = false): AbsoluteFile {...}{. raises: [OSError, KeyError], tags: [ReadDirEffect].}
- Source Edit
proc findModule(conf: ConfigRef; modulename, currentModule: string): AbsoluteFile {...}{. raises: [OSError, KeyError], tags: [ReadDirEffect].}
- Source Edit
proc findProjectNimFile(conf: ConfigRef; pkg: string): string {...}{. raises: [OSError], tags: [ReadDirEffect].}
- Source Edit
proc inclDynlibOverride(conf: ConfigRef; lib: string) {...}{.raises: [], tags: [].}
- Source Edit
proc isDynlibOverride(conf: ConfigRef; lib: string): bool {...}{.raises: [], tags: [].}
- Source Edit
proc parseIdeCmd(s: string): IdeCmd {...}{.raises: [], tags: [].}
- Source Edit
proc `$`(c: IdeCmd): string {...}{.raises: [], tags: [].}
- Source Edit
proc floatInt64Align(conf: ConfigRef): int16 {...}{.raises: [], tags: [].}
- Returns either 4 or 8 depending on reasons. Source Edit
proc setOutFile(conf: ConfigRef) {...}{.raises: [ValueError], tags: [].}
- Source Edit
Iterators
iterator nimbleSubs(conf: ConfigRef; p: string): string {...}{.raises: [ValueError], tags: [].}
- Source Edit
Templates
template setErrorMaxHighMaybe(conf: ConfigRef)
- do not stop after first error (but honor --errorMax if provided) Source Edit
template depConfigFields(fn) {...}{.dirty.}
- Source Edit
template newPackageCache(): untyped
- Source Edit
template compilationCachePresent(conf: ConfigRef): untyped
- Source Edit
template optPreserveOrigSource(conf: ConfigRef): untyped
- Source Edit
© 2006–2021 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/compiler/options.html