New translations dcr-toml.mdx (Russian)

[ci skip]
This commit is contained in:
2026-07-06 02:21:41 +08:00
parent ec655d4783
commit 0d4c2399c9

View File

@@ -1,49 +1,50 @@
--- ---
sidebar_label: dcr.toml overview sidebar_label: Обзор dcr.toml
--- ---
# dcr.toml # Обзор dcr.toml
Main project configuration file. Located at the project root. Основной конфигурационный файл проекта. Располагается в корне проекта.
## Structure ## Структура
```toml ```toml
[package] [package]
# required fields # обязательные поля
[build] [build]
# build settings # настройки сборки
[build.debug] # optional: debug override [build.debug] # опционально: переопределение для debug
[build.release] # optional: release override [build.release] # опционально: переопределение для release
[build.linux] # optional: Linux override [build.linux] # опционально: переопределение для Linux
[build.windows] # optional: Windows override [build.windows] # опционально: переопределение для Windows
[build.windows.debug] # target + profile combination [build.windows.debug] # комбинация target + profile
[toolchain] [toolchain]
# compiler/linker paths # пути к компиляторам/линкеру
[dependencies] [dependencies]
# project dependencies # зависимости проекта
[workspace] [workspace]
# multi-package configuration # мультипакетная конфигурация
[run] [run]
# run settings [run.release] # опционально: переопределение для release
# настройки запуска
``` ```
## [package] ## [package]
| Field | Required | Description | | Поле | Обязательное | Описание |
| --------- | -------- | ----------------------- | | --------- | ------------ | --------------------------- |
| `name` | yes | Project name | | `name` | да | Имя проекта |
| `version` | yes | Semantic version | | `version` | да | Семантическая версия |
| `type` | yes | `app`, `lib`, `none` | | `type` | да | `app`, `lib`, `none` |
| `license` | no | SPDX license identifier | | `license` | нет | SPDX-идентификатор лицензии |
| `author` | no | Author | | `author` | нет | Автор |
```toml ```toml
[package] [package]
@@ -60,58 +61,55 @@ author = "John Doe"
* `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`. * `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`.
| Field | Default | Description | | Поле | По умолчанию | Описание |
| ---------------- | ------------------------------------------- | --------------------------------------------------------------------- | | ---------------- | ------------------------------------------- | --------------------------------------------------------------------- |
| `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"` | | `language` | `"c"` | `"c"`, `"cxx"`, `"cpp"` |
| `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) | | `standard` | `"c11"` | Стандарт C (`c11`, `c17`, `c23`) |
| `cxx_standard` | `"c++20"` | C++ standard (`c++17`, `c++20`, `c++23`) | | `cxx_standard` | `"c++20"` | Стандарт C++ (`c++17`, `c++20`, `c++23`) |
| `compiler` | `"clang"` | Preferred compiler | | `compiler` | `cxxflags` | Предпочитаемый компилятор |
| `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` | | `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` |
| `target` | host | Target triple for cross-compilation | | `target` | хост | Target triple для кросс-компиляции |
| `platform` | `"native"` | `native`, `efi` | | `platform` | `"native"` | `native`, `efi`, `freestanding` |
| `cflags` | `[]` | Additional C/C++/ASM flags | | `cflags` | `[]` | Дополнительные флаги C++ |
| `ldflags` | `[]` | Additional linker flags | | `ldflags` | `[]` | Дополнительные флаги линковки |
| `filename` | `""` | Custom output file name | | `filename` | `""` | Кастомное имя выходного файла |
| `extension` | `""` | Custom file extension | | `extension` | `""` | Custom file extension |
| `roots` | `["src"]` | Source root directories | | `roots` | `["src"]` | Корневые директории с исходниками |
| `exclude` | `[]` | Exclude patterns | | `exclude` | `[]` | Паттерны исключений |
| `include` | `[]` | Additional include directories | | `include` | `[]` | Дополнительные include-директории |
| `src_disable` | `false` | Disable auto source discovery | | `src_disable` | `false` | Disable auto source discovery |
| `inherit` | `false` | Inherit build from workspace root | | `inherit` | `false` | Наследовать build от корня workspace |
| `clean` | `[]` | Glob patterns for custom clean paths | | `clean` | `[]` | Glob patterns for custom clean paths |
| `out_dir` | `""` | Custom output directory | | `out_dir` | `""` | Custom output directory |
| `workspace_only` | `false` | Workspace-only, not built standalone | | `workspace_only` | `false` | Только для workspace, не собирать отдельно |
| `freestanding` | `false` | Compile in freestanding mode (`-ffreestanding` + `-nostdlib -static`) | | `freestanding` | `false` | Compile in freestanding mode (`-ffreestanding` + `-nostdlib -static`) |
| `opt_level` | `"0"` (debug) / `"3"` (release) | Optimization level: `0`-`3`, `"s"`, `"z"` | | `opt_level` | `"0"` (debug) / `"3"` (release) | Optimization level: `0`-`3`, `"s"`, `"z"` |
| `debug` | `true` (debug) / `false` (release) | Emit debug symbols (`-g`) | | `ldscript` | `true` (debug) / `false` (release) | Emit debug symbols (`-g`) |
| `lto` | `false` | Link-time optimization (`-flto` for both compiler and linker) | | `lto` | `false` | Link-time optimization (`-flto` for both compiler and linker) |
| `strip` | `false` | Strip symbols from output (`-s` in ldflags) | | `asflags` | `false` | Strip symbols from output (`-s` in ldflags) |
| `warnings` | `["all", "extra"]` (debug) / `[]` (release) | Warning flags (e.g. `"all"`, `"extra"`, `"pedantic"`) | | `true` | `["all", "extra"]` (debug) / `[]` (release) | Warning flags (e.g. `"all"`, `"extra"`, `"pedantic"`) |
| `panic` | `""` | Panic strategy: `"abort"` disables exceptions and unwind tables | | `panic` | `""` | Panic strategy: `"abort"` disables exceptions and unwind tables |
| `codegen-units` | `""` | Max parallel compilation jobs (`"0"` = auto) | | `codegen-units` | `""` | Max parallel compilation jobs (`"0"` = auto) |
| `qt` | `false` | Enable automatic Qt meta-object handling (MOC, UIC, RCC) | | `qt` | `false` | Enable automatic Qt meta-object handling (MOC, UIC, RCC) |
Settings from raw config (not in typed struct): Settings from raw config (not in typed struct):
* `pkg_config` — list of pkg-config packages * Пакеты для pkg-config
* `ldscript` — linker script path * Путь к linker script
* `build.steps` / `build.post_steps` — codegen steps * `build.steps` / `build.post_steps` — codegen steps
Example: Example:
```toml ```toml
[build] [build]
language = "c++" language = ["cpp", "c"]
standard = "c17"
standard = "c23" standard = "c23"
cxx_standard = "c++23" cxx_standard = "c++23"
compiler = "clang" compiler = "clang"
kind = "sharedlib" kind = "sharedlib"
cflags = ["-Wall", "-Wextra"] cflags = ["-Wall", "-Wextra"]
opt_level = "z" pkg_config = ["sdl2", "gl"]
lto = true
strip = true
panic = "abort"
codegen-units = "2"
``` ```
## [toolchain] ## [toolchain]
@@ -123,13 +121,16 @@ cxx = "/usr/bin/clang++"
as = "/usr/bin/as" as = "/usr/bin/as"
ar = "/usr/bin/ar" ar = "/usr/bin/ar"
ld = "/usr/bin/ld.lld" ld = "/usr/bin/ld.lld"
uic = "/usr/bin/uic" # Qt
moc = "/usr/bin/moc" # Qt
rcc = "/usr/bin/rcc" # Qt
``` ```
Raw config also supports `uic`, `moc`, `rcc` for Qt codegen. Raw config also supports `uic`, `moc`, `rcc` for Qt codegen.
## [dependencies] ## [dependencies]
See [dependencies](/docs/reference/dependencies). См. [dependencies](/docs/reference/dependencies).
## [run] ## [run]
@@ -138,15 +139,15 @@ See [dependencies](/docs/reference/dependencies).
cmd = "./target/{profile}/{name}" cmd = "./target/{profile}/{name}"
``` ```
Substitutions: Подстановки:
* `{version}` — package version * `{version}` — версия из [package]
* `{version_major}`, `{version_minor}`, `{version_patch}`, `{version_suffix}`, `{version_suffix_dash}` — version parts * `pkg_config`
* `{profile}` — debug / release * `{profile}` — debug / release
* `{name}` — package name * `{name}` — имя из [package]
Default `cmd` = `./target/{profile}/{name}` (macOS/Windows) or `./target/\<triple>/\<profile>/\<name>` (Linux). По умолчанию `cmd` вычисляется как `./target/{profile}/{name}`.
## [workspace] ## [workspace]
See [workspaces](/docs/reference/workspaces). См. [workspaces](/docs/reference/workspaces).