Hammer
Extension for the Hammer C/C++ build system.
For information on Hammer as a project, see the project README.
Prerequisites
You must have a working Hammer installation on your system. The extension checks for the hammer CLI on activation and will warn you with a link to the repository if it cannot be found.
Usage
Build — Ctrl+Shift+B
- If a
.hammer file exists, runs the recorded build executable immediately.
- If no
.hammer file exists, shows a picker over all .c/.cpp files in the workspace so you can select the build script to bootstrap from. Common names (build, compile, make, …) are sorted to the top. Once you confirm, hammer <script> runs, and as soon as the .hammer file appears the build executable is launched automatically — no need to press Ctrl+Shift+B a second time.
Run — Ctrl+Shift+R
Reads .hammer_run (written by Hammer at build time) to find executable targets.
- One target → runs immediately.
- Multiple targets → shows a picker so you can choose which one to run.
If no .hammer_run exists you will be prompted to build first.
Clear — Ctrl+Shift+C
Shows a confirmation dialog, then:
- Deletes the build artifacts recorded in
.hammer (the build executable and, if present, the shared library).
- Deletes
.hammer and .hammer_run.
Use this to re-bootstrap from scratch — for example after renaming or switching the build script.
Debug — F5
Launches the first executable target listed in .hammer_run under a debugger with full IDE integration (breakpoints, variable inspection, call stack).
Note: When .hammer_run contains multiple targets, the first one is always used. Per-session target selection for debugging is not yet supported.
Prerequisites for debugging
It is up to you to compile with debug symbols. Without debug symbols enabled at compile-time, the debugger cannot map instructions back to source lines.
This may be done with:
AddCompilerFlags(t, "/Zi /Od") (MSVC)
AddCompilerFlags(t, "-g -O0") (GCC/Clang, GDB)
AddCompilerFlags(t, "-g -gdwarf-4 -O0") (GCC/Clang, LLDB / CodeLLDB)
- or by setting those flags in the target's profile, if you're using
profile_t and SetProfile() in your build script.
Note for LLDB users: GCC 11 and later defaults to DWARF 5, which some versions of LLDB (including the one bundled with CodeLLDB) do not fully support. Adding -gdwarf-4 forces the older format and restores breakpoint support.
Install a C/C++ debugger extension. Either:
- C/C++ (
ms-vscode.cpptools) — uses GDB on Linux, LLDB on macOS.
- CodeLLDB (
vadimcn.vscode-lldb) — LLDB-based, works on both platforms.
GDB or LLDB installed on your system (if using ms-vscode.cpptools)