- Create some empty directory
Clear initClear build
This project uses vcpkg (deps), CMake (build), ANTLR (parser gen), and LLVM.
- Visual Studio 2022 with "Desktop development with C++"
- Java 11+ (for ANTLR codegen):
java -version - Optional: Ninja (for compile_commands.json)
winget install Ninja-build.Ninja - vcpkg (Visual Studio auto-acquire in manifest mode, or manual clone+bootstrap)
See language reference.
The repo contains vcpkg.json (llvm with lld/tools, antlr4). Visual Studio can auto-acquire vcpkg and install dependencies when configuring CMake.
Manual setup (optional):
git clone https://github.com/microsoft/vcpkg C:\src\vcpkg
C:\src\vcpkg\bootstrap-vcpkg.batUse the provided preset ninja-debug-vcpkg (see CMakePresets.json).
# configure
cmake --preset ninja-debug-vcpkg
# build (ANTLR codegen runs automatically via generate_parser)
cmake --build --preset ninja-debug-vcpkgNotes
- Generated parser sources/headers are under
out/build/ninja-debug/generated. - No need to call
--target generate_parsermanually;Cleardepends on it. - In Visual Studio, select the preset and run Configure/Build.
Ninja builds emit compile_commands.json in the build dir:
cmake --preset ninja-debug-vcpkg
cmake --build --preset ninja-debug-vcpkgPoint clangd to out/build/ninja-debug/compile_commands.json or copy it to the repo root if preferred.
Troubleshooting for Ninja
- Error: "Ninja does not support platform specification, but platform x64 was specified"
- Clear env before configure:
Remove-Item Env:Platform -ErrorAction SilentlyContinue Remove-Item Env:CMAKE_GENERATOR_PLATFORM -ErrorAction SilentlyContinue Remove-Item Env:VSCMD_ARG_TGT_ARCH -ErrorAction SilentlyContinue
-
LLVM not found (LLVMConfig.cmake)
- Configure with vcpkg toolchain/preset. If needed, set
LLVM_DIRto<build>/vcpkg_installed/x64-windows/share/llvm.
- Configure with vcpkg toolchain/preset. If needed, set
-
ANTLR headers not found (e.g., ClearLanguageLexer.h)
- Ensure Java is installed and
tools/antlr4.jarexists. - The build triggers ANTLR codegen automatically via
generate_parser.
- Ensure Java is installed and
Presets exist in the repo for convenience. Example (Visual Studio):
cmake --preset msvc-vs-release
cmake --build --preset msvc-vs-releaseIf using Ninja via presets, ensure you’ve cleared Platform variables as noted above.