advopt.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. Advanced commands:
  2. //compileToC, cc compile project with C code generator
  3. //compileToCpp, cpp compile project to C++ code
  4. //compileToOC, objc compile project to Objective C code
  5. //js compile project to Javascript
  6. //e run a Nimscript file
  7. //rst2html convert a reStructuredText file to HTML
  8. use `--docCmd:skip` to skip compiling snippets
  9. //rst2tex convert a reStructuredText file to LaTeX
  10. //doc2tex extract the documentation to a LaTeX file
  11. //jsondoc extract the documentation to a json file
  12. //ctags create a tags file
  13. //buildIndex build an index for the whole documentation
  14. //genDepend generate a DOT file containing the
  15. module dependency graph
  16. //dump dump all defined conditionals and search paths
  17. see also: --dump.format:json (useful with: `| jq`)
  18. //check checks the project for syntax and semantics
  19. (can be combined with --defusages)
  20. Runtime checks (see -x):
  21. --objChecks:on|off turn obj conversion checks on|off
  22. --fieldChecks:on|off turn case variant field checks on|off
  23. --rangeChecks:on|off turn range checks on|off
  24. --boundChecks:on|off turn bound checks on|off
  25. --overflowChecks:on|off turn int over-/underflow checks on|off
  26. --floatChecks:on|off turn all floating point (NaN/Inf) checks on|off
  27. --nanChecks:on|off turn NaN checks on|off
  28. --infChecks:on|off turn Inf checks on|off
  29. Advanced options:
  30. --defusages:FILE,LINE,COL
  31. find the definition and all usages of a symbol
  32. -o:FILE, --out:FILE set the output filename
  33. --outdir:DIR set the path where the output file will be written
  34. --usenimcache will use `outdir=$$nimcache`, whichever it resolves
  35. to after all options have been processed
  36. --stdout:on|off output to stdout
  37. --colors:on|off turn compiler messages coloring on|off
  38. --filenames:abs|canonical|legacyRelProj
  39. customize how filenames are rendered in compiler messages,
  40. defaults to `abs` (absolute)
  41. --processing:dots|filenames|off
  42. show files as they're being processed by nim compiler
  43. --unitsep:on|off use the ASCII unit separator (31) between error
  44. messages, useful for IDE-like tooling
  45. --declaredLocs:on|off show declaration locations in messages
  46. --spellSuggest|:num show at most `num >= 0` spelling suggestions on typos.
  47. if `num` is not specified (or `auto`), return
  48. an implementation defined set of suggestions.
  49. --hints:on|off|list. `on|off` enables or disables hints.
  50. `list` reports which hints are selected.
  51. --hint:X:on|off turn specific hint X on|off. `hint:X` means `hint:X:on`,
  52. as with similar flags. `all` is the set of all hints
  53. (only `all:off` is supported).
  54. --hintAsError:X:on|off turn specific hint X into an error on|off
  55. -w:on|off|list, --warnings:on|off|list
  56. `on|off` enables or disables warnings.
  57. `list` reports which warnings are selected.
  58. --warning:X:on|off turn specific warning X on|off. `warning:X` means `warning:X:on`,
  59. as with similar flags. `all` is the set of all warning
  60. (only `all:off` is supported).
  61. --warningAsError:X:on|off
  62. turn specific warning X into an error on|off
  63. --styleCheck:off|hint|error
  64. produce hints or errors for Nim identifiers that
  65. do not adhere to Nim's official style guide
  66. https://nim-lang.org/docs/nep1.html
  67. --styleCheck:usages only enforce consistent spellings of identifiers,
  68. do not enforce the style on declarations
  69. --showAllMismatches:on|off
  70. show all mismatching candidates in overloading
  71. resolution
  72. --lib:PATH set the system library path
  73. --import:PATH add an automatically imported module
  74. see also `patchFile` in nimscript which offers more flexibility.
  75. --include:PATH add an automatically included module
  76. --nimcache:PATH set the path used for generated files
  77. see also https://nim-lang.org/docs/nimc.html#compiler-usage-generated-c-code-directory
  78. -c, --compileOnly:on|off compile Nim files only; do not assemble or link
  79. --noLinking:on|off compile Nim and generated files but do not link
  80. --noMain:on|off do not generate a main procedure
  81. --genScript:on|off generate a compile script (in the 'nimcache'
  82. subdirectory named 'compile_$$project$$scriptext'),
  83. and a '.deps' file containing the dependencies;
  84. implies --compileOnly
  85. --os:SYMBOL set the target operating system (cross-compilation)
  86. --cpu:SYMBOL set the target processor (cross-compilation)
  87. --debuginfo:on|off enables debug information
  88. -t, --passC:OPTION pass an option to the C compiler
  89. -l, --passL:OPTION pass an option to the linker
  90. --cc:SYMBOL specify the C compiler
  91. --cincludes:DIR modify the C compiler header search path
  92. --clibdir:DIR modify the linker library search path
  93. --clib:LIBNAME link an additional C library
  94. (you should omit platform-specific extensions)
  95. --project document the whole project (doc)
  96. --docRoot:path `nim doc --docRoot:/foo --project --outdir:docs /foo/sub/main.nim`
  97. generates: docs/sub/main.html
  98. if path == @pkg, will use nimble file enclosing dir
  99. if path == @path, will use first matching dir in `--path`
  100. if path == @default (the default and most useful), will use
  101. best match among @pkg,@path.
  102. if these are nonexistent, will use project path
  103. -b, --backend:c|cpp|js|objc
  104. sets backend to use with commands like `nim doc` or `nim r`
  105. --docCmd:cmd if `cmd == skip`, skips runnableExamples
  106. else, runs runnableExamples with given options, e.g.:
  107. `--docCmd:"-d:foo --threads:on"`
  108. --docSeeSrcUrl:url activate 'see source' for doc command
  109. (see doc.item.seesrc in config/nimdoc.cfg)
  110. --docInternal also generate documentation for non-exported symbols
  111. --lineDir:on|off generation of #line directive on|off
  112. --embedsrc:on|off embeds the original source code as comments
  113. in the generated output
  114. --tlsEmulation:on|off turn thread local storage emulation on|off
  115. --implicitStatic:on|off turn implicit compile time evaluation on|off
  116. --trmacros:on|off turn term rewriting macros on|off
  117. --multimethods:on|off turn multi-methods on|off
  118. --hotCodeReloading:on|off
  119. turn support for hot code reloading on|off
  120. --excessiveStackTrace:on|off
  121. stack traces use full file paths
  122. --stackTraceMsgs:on|off enable user defined stack frame msgs via `setFrameMsg`
  123. --skipCfg:on|off do not read the nim installation's configuration file
  124. --skipUserCfg:on|off do not read the user's configuration file
  125. --skipParentCfg:on|off do not read the parent dirs' configuration files
  126. --skipProjCfg:on|off do not read the project's configuration file
  127. --mm:orc|arc|refc|markAndSweep|boehm|go|none|regions
  128. select which memory management to use; default is 'orc'
  129. --exceptions:setjmp|cpp|goto|quirky
  130. select the exception handling implementation
  131. --index:on|off turn index file generation on|off
  132. --putenv:key=value set an environment variable
  133. --NimblePath:PATH add a path for Nimble support
  134. --noNimblePath deactivate the Nimble path
  135. --clearNimblePath empty the list of Nimble package search paths
  136. --cppCompileToNamespace:namespace
  137. use the provided namespace for the generated C++ code,
  138. if no namespace is provided "Nim" will be used
  139. --nimMainPrefix:prefix use `{prefix}NimMain` instead of `NimMain` in the produced
  140. C/C++ code
  141. --expandMacro:MACRO dump every generated AST from MACRO
  142. --expandArc:PROCNAME show how PROCNAME looks like after diverse optimizations
  143. before the final backend phase (mostly ARC/ORC specific)
  144. --excludePath:PATH exclude a path from the list of search paths
  145. --dynlibOverride:SYMBOL marks SYMBOL so that dynlib:SYMBOL
  146. has no effect and can be statically linked instead;
  147. symbol matching is fuzzy so
  148. that --dynlibOverride:lua matches
  149. dynlib: "liblua.so.3"
  150. --dynlibOverrideAll
  151. disables the effects of the dynlib pragma
  152. --listCmd list the compilation commands; can be combined with
  153. `--hint:exec:on` and `--hint:link:on`
  154. --asm produce assembler code
  155. --parallelBuild:0|1|... perform a parallel build
  156. value = number of processors (0 for auto-detect)
  157. --incremental:on|off only recompile the changed modules (experimental!)
  158. --verbosity:0|1|2|3 set Nim's verbosity level (1 is default)
  159. --errorMax:N stop compilation after N errors; 0 means unlimited
  160. --maxLoopIterationsVM:N set max iterations for all VM loops
  161. --experimental:$1
  162. enable experimental language feature
  163. --legacy:$2
  164. enable obsolete/legacy language feature
  165. --useVersion:1.0|1.2|1.6 emulate Nim version X of the Nim compiler, for testing
  166. --benchmarkVM:on|off turn benchmarking of VM code with cpuTime() on|off
  167. --profileVM:on|off turn compile time VM profiler on|off
  168. --sinkInference:on|off turn sink parameter inference on|off (default: on)
  169. --panics:on|off turn panics into process terminations (default: off)
  170. --deepcopy:on|off enable 'system.deepCopy' for ``--mm:arc|orc``