DCR(1)

NAME
dcr - Cargo-like build tool and package manager for C/C++ projects

SYNOPSIS
dcr [command] [options]

DESCRIPTION
DCR is a comprehensive build tool and package manager for C and C++ projects, inspired by Cargo from the Rust ecosystem. It handles project creation, building, dependency management, testing, formatting, and IDE integration.

COMMANDS

new <name>
    Create a new C/C++ project with the given name. Only ASCII letters, digits, underscores and hyphens are allowed.

init
    Initialize the current (empty) directory as a DCR project.

build [options]
    Compile the project. Default profile is --debug.

run [options]
    Build and run the project. Only available for binary projects.

clean [options]
    Remove build artifacts from the target directory.

test [--init] [--debug|--release]
    Run project tests (alias: dcr tests).

add <name> <source> [options]
    Add a dependency to the project.

tree
    Display the dependency tree of the current project.

fmt Format all C/C++ source files using clang-format.

gen <subcommand>
    Generate IDE integration files (vscode, clion, compile-commands, project-info).

setup
    Set up DCR registries for dependency resolution.

GLOBAL FLAGS

--help
    Show this help message and exit.

--version
    Print version information and exit.

--update
    Update DCR to the latest version from GitHub Releases.

BUILD OPTIONS
The following options apply to build and run commands:

--debug
    Build with debug profile (default). Enables debug symbols and minimal optimization.

--release
    Build with release profile. Enables full optimization without debug symbols.

--target <triple>
    Cross-compile for the given target (e.g. aarch64-linux-gnu, x86_64-w64-mingw32). Short names like linux, macos, windows are also supported.

--force
    Force a full rebuild, ignoring cached build artifacts.

--clean
    Clean build artifacts before building.

--verbose
    Print detailed build output including compiler commands.

--workspace <name>
    Build a specific workspace member.

CLEAN OPTIONS

--debug
    Clean debug artifacts (default).

--release
    Clean release artifacts.

--target <triple>
    Clean artifacts for a specific target.

--all
    Clean all workspace members.

ADD OPTIONS

--branch <name>
    Use a specific branch when adding a git dependency.

--tag <name>
    Use a specific tag when adding a git dependency.

--rev <hash>
    Use a specific commit hash when adding a git dependency.

DEPENDENCY SOURCES

user/repo
    GitHub shorthand (e.g. user/repo).

github:user/repo
    Full GitHub repository URL shorthand.

gitlab:user/repo
    GitLab repository URL shorthand.

git:host.com/user/repo
    Generic git repository.

path:./path/to/lib
    Local path dependency.

<version>
    Version from registry (e.g. 1.2.3).

GEN SUBCOMMANDS

project-info
    Print project metadata as JSON to stdout.

compile-commands
    Generate compile_commands.json for IDE tooling.

vscode
    Generate .vscode/ integration files (tasks, launch configurations).

clion
    Generate .idea/ integration files for CLion.

TEST OPTIONS

--init
    Create tests/dcr_test.h in the current project.

--debug
    Build and run tests with debug profile (default).

--release
    Build and run tests with release profile.

PROJECT CONFIGURATION
DCR uses dcr.toml for project configuration. Key settings include:

package.name
    Project name (required).

package.version
    Project version (default: 0.1.0).

build.language
    Programming language: c or c++ (default: c).

build.standard
    Language standard (e.g. c11, c17, c++20; default: c11).

build.compiler
    Compiler to use: clang, gcc, cl, clang-cl (default: clang).

build.kind
    Output type: bin, lib (static or dynamic), staticlib, sharedlib (default: bin).

FILES

dcr.toml
    Project manifest file.

~/.dcr/config.toml
    User-level DCR configuration.

~/.dcr/index.json
    Local registry index.

ENVIRONMENT

DCR_COMPILER
    Override the compiler used for building.

DCR_CC
    Alternative way to override the compiler.

EXAMPLES

Create a new project:
    dcr new hello

Initialize from current directory:
    dcr init

Build with release profile:
    dcr build --release

Cross-compile for Windows:
    dcr build --target windows

Add a dependency:
    dcr add curl git:https://github.com/curl/curl.

Generate VS Code integration:
    dcr gen vscode

SEE ALSO
https://dcr.dexoron.su, https://github.com/dexoron/dcr

AUTHORS
Dexoron (Bezotechestvo Vladimir) <main@dexoron.su>