Spec-Zone.ru › Nim

std/compilesettings

Source Edit

Этот модуль позволяет запрашивать у компилятора различные настройки конфигурации. См. также compileOption.

Типы

MultipleValueSetting {.pure.} = enum
  nimblePaths,              ## the nimble path(s)
  searchPaths,              ## the search path for modules
  lazyPaths,                ## experimental: even more paths
  commandArgs,              ## the arguments passed to the Nim compiler
  cincludes,                ## the #include paths passed to the C/C++ compiler
  clibs                      ## libraries passed to the C/C++ compiler
настройки, приводящие к последовательности строковых значений Source Edit
SingleValueSetting {.pure.} = enum
  arguments,                ## experimental: the arguments passed after '-r'
  outFile,                  ## experimental: the output file
  outDir,                   ## the output directory
  nimcacheDir,              ## the location of the 'nimcache' directory
  projectName,              ## the project's name that is being compiled
  projectPath,              ## experimental: some path to the project that is being compiled
  projectFull,              ## the full path to the project that is being compiled
  command, ## experimental: the command (e.g. 'c', 'cpp', 'doc') passed to
            ## the Nim compiler
  commandLine,              ## experimental: the command line passed to Nim
  linkOptions,              ## additional options passed to the linker
  compileOptions,           ## additional options passed to the C/C++ compiler
  ccompilerPath,            ## the path to the C/C++ compiler
  backend, ## the backend (eg: c|cpp|objc|js); both `nim doc --backend:js`
            ## and `nim js` would imply backend=js
  libPath,                  ## the absolute path to the stdlib library, i.e. nim's `--lib`, since 1.5.1
  gc {....deprecated.},        ## gc selected
  mm                         ## memory management selected
настройки, приводящие к одному строковому значению Source Edit

Процедуры

proc querySetting(setting: SingleValueSetting): string {.compileTime,
    noSideEffect, ...raises: [], tags: [], forbids: [].}

Может использоваться для получения строкового параметра времени компиляции.

См. также:

  • compileOption для on|off параметров
  • compileOption для параметров перечислений

Пример:

const nimcache = querySetting(SingleValueSetting.nimcacheDir)
Source Edit
proc querySettingSeq(setting: MultipleValueSetting): seq[string] {.compileTime,
    noSideEffect, ...raises: [], tags: [], forbids: [].}

Может использоваться для получения многострочного параметра времени компиляции.

См. также:

  • compileOption для on|off параметров
  • compileOption для параметров перечислений

Пример:

const nimblePaths = querySettingSeq(MultipleValueSetting.nimblePaths)
Source Edit

© 2006–2024 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/compilesettings.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API