--- sidebar_label: Обзор dcr.toml --- # Обзор dcr.toml Основной конфигурационный файл проекта. Располагается в корне проекта. ## Структура ```toml [package] # обязательные поля [build] # настройки сборки [build.debug] # опционально: переопределение для debug [build.release] # опционально: переопределение для release [build.linux] # опционально: переопределение для Linux [build.windows] # опционально: переопределение для Windows [build.windows.debug] # комбинация target + profile [toolchain] # пути к компиляторам/линкеру [dependencies] # зависимости проекта [workspace] # мультипакетная конфигурация [run] [run.release] # опционально: переопределение для release # настройки запуска ``` ## [package] | Поле | Обязательное | Описание | | --------- | ------------ | --------------------------- | | `name` | да | Имя проекта | | `version` | да | Семантическая версия | | `type` | да | `app`, `lib`, `none` | | `license` | нет | SPDX-идентификатор лицензии | | `author` | нет | Автор | ```toml [package] name = "my-app" version = "0.1.0" type = "app" license = "MIT" author = "John Doe" ``` ## [build] ... * `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`. | Поле | По умолчанию | Описание | | ---------------- | ------------------------------------------- | --------------------------------------------------------------------- | | `language` | `"c"` | `"c"`, `"cxx"`, `"cpp"` | | `standard` | `"c11"` | Стандарт C (`c11`, `c17`, `c23`) | | `cxx_standard` | `"c++20"` | Стандарт C++ (`c++17`, `c++20`, `c++23`) | | `compiler` | `cxxflags` | Предпочитаемый компилятор | | `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` | | `target` | хост | Target triple для кросс-компиляции | | `platform` | `"native"` | `native`, `efi`, `freestanding` | | `cflags` | `[]` | Дополнительные флаги C++ | | `ldflags` | `[]` | Дополнительные флаги линковки | | `filename` | `""` | Кастомное имя выходного файла | | `extension` | `""` | Custom file extension | | `roots` | `["src"]` | Корневые директории с исходниками | | `exclude` | `[]` | Паттерны исключений | | `include` | `[]` | Дополнительные include-директории | | `src_disable` | `false` | Disable auto source discovery | | `inherit` | `false` | Наследовать build от корня workspace | | `clean` | `[]` | Glob patterns for custom clean paths | | `out_dir` | `""` | Custom output directory | | `workspace_only` | `false` | Только для workspace, не собирать отдельно | | `freestanding` | `false` | Compile in freestanding mode (`-ffreestanding` + `-nostdlib -static`) | | `opt_level` | `"0"` (debug) / `"3"` (release) | Optimization level: `0`-`3`, `"s"`, `"z"` | | `ldscript` | `true` (debug) / `false` (release) | Emit debug symbols (`-g`) | | `lto` | `false` | Link-time optimization (`-flto` for both compiler and linker) | | `asflags` | `false` | Strip symbols from output (`-s` in ldflags) | | `true` | `["all", "extra"]` (debug) / `[]` (release) | Warning flags (e.g. `"all"`, `"extra"`, `"pedantic"`) | | `panic` | `""` | Panic strategy: `"abort"` disables exceptions and unwind tables | | `codegen-units` | `""` | Max parallel compilation jobs (`"0"` = auto) | | `qt` | `false` | Enable automatic Qt meta-object handling (MOC, UIC, RCC) | Settings from raw config (not in typed struct): * Пакеты для pkg-config * Путь к linker script * `build.steps` / `build.post_steps` — codegen steps Example: ```toml [build] language = ["cpp", "c"] standard = "c17" standard = "c23" cxx_standard = "c++23" compiler = "clang" kind = "sharedlib" cflags = ["-Wall", "-Wextra"] pkg_config = ["sdl2", "gl"] ``` ## [toolchain] ```toml [toolchain] cc = "/usr/bin/clang" cxx = "/usr/bin/clang++" as = "/usr/bin/as" ar = "/usr/bin/ar" 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. ## [dependencies] См. [dependencies](/docs/reference/dependencies). ## [run] ```toml [run] cmd = "./target/{profile}/{name}" ``` Подстановки: * `{version}` — версия из [package] * `pkg_config` * `{profile}` — debug / release * `{name}` — имя из [package] По умолчанию `cmd` вычисляется как `./target/{profile}/{name}`. ## [workspace] См. [workspaces](/docs/reference/workspaces).