mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 13:18:29 +00:00
- `dcr gen` command for IDE integration and build tool support
- `dcr gen project-info`: Output project metadata as JSON
- `dcr gen compile-commands`: Generate `compile_commands.json` for clangd and clang-tidy
- `dcr gen vscode`: Generate VS Code `.vscode/` integration (launch.json, tasks.json, settings.json)
- `dcr gen clion`: Generate JetBrains CLion `.idea/` integration (run configurations, build targets)
- Full workspace support for all `gen` subcommands
2.5 KiB
2.5 KiB
Compilers & linking
Compiler backend selection
DCR picks a backend from build.compiler:
- contains
clang-cl-> MSVC backend - equals
asor containsgas-> GAS backend (standalone assembler) - contains
gccorg++-> GCC backend - contains
clangorclang++-> Clang backend - equals
clor containsmsvc-> MSVC backend - contains
nasm-> NASM backend - otherwise -> Clang backend fallback
Compilation model
- Source files are found recursively in
src/based onbuild.language. build.rootsandbuild.src_disablecan replace the defaultsrc/root.- Mixed language builds use arrays, for example
build.language = ["c", "asm"]. - Each source is compiled to
target/<profile>/obj/<relative-path>.o(.objon MSVC). - Recompile happens when source mtime is newer than object mtime.
build.excluderemoves paths from source/header collection;build.includere-allows matching paths and has priority overexclude.
Default build flags
These flags are applied automatically based on profile and compiler backend.
GCC/Clang:
debug:-O0 -g -Wall -Wextra -fno-omit-frame-pointer -DDCR_DEBUGrelease:-O3 -DNDEBUG -march=native
MSVC:
debug:/Od /Zi /W4 /DDCR_DEBUG /Oy-release:/O2 /DNDEBUG
Platform hint
If build.platform is set, DCR passes it as an architecture hint:
- GCC/Clang:
-march=<platform> - MSVC: maps to
/arch:*for known values (x86,i386,i486,i586,i686,sse2,avx,avx2)
Toolchain overrides
If [toolchain] is set, DCR uses its values to override compiler/linker tools:
cc,cxx,asoverride compilers for C/C++/ASMaroverrides the archiver (used forstaticlib)ldoverrides the linker (used by GCC/Clang/NASM/GAS backends)uic,moc,rccoverride Qt tools used inbuild.steps
Environment overrides (highest priority):
DCR_COMPILER(all languages)DCR_CC,DCR_CXX,DCR_AS,DCR_AR,DCR_LDDCR_DEBUGenables verbose build logging
Linking
For kind = "bin":
- Object files are linked into executable artifact.
- Dependency lib dirs and library names are passed to linker.
build.ldflagsare appended to link command.
For kind = "staticlib":
- Linux/macOS (GCC/Clang):
ar rcscreates.aarchive. - Windows (MSVC):
libcreates.libarchive.
For kind = "sharedlib":
- Linux (GCC/Clang):
-sharedwith output.so. - macOS (Clang):
-dynamiclibwith output.dylib. - Windows (MSVC):
/LDwith output.dll.