build
Build the C++ backend using CMake. Use when user asks to compile, build, rebuild, or mentions CMake, compilation errors, or linking issues.
When & Why to Use This Skill
This Claude skill automates the C++ backend build process using CMake, specifically optimized for the OrderParserProcessor project. It streamlines the development lifecycle by managing environment prerequisites, handling complex ANTLR grammar generation, and executing various build configurations—from standard compilation to high-speed parallel builds—while providing intelligent diagnostics for compilation and linking errors.
Use Cases
- Automated Project Compilation: Efficiently compile, build, or rebuild the C++ backend with a single request, ensuring all CMake configurations are correctly applied.
- Build Optimization and Testing: Execute parallel builds to significantly reduce wait times or initiate specialized builds with test suites enabled to maintain high code quality.
- Troubleshooting and Debugging: Identify and resolve complex C++ compilation errors, linking issues, and ANTLR-related generation problems through automated environment checks and detailed error reporting.
- Environment Setup and Validation: Automatically verify essential system variables like ORDER_PARSER_PROCESSOR_ROOT and ANTLR_VERSION to ensure a consistent and error-free build environment.
- Clean Rebuild Management: Perform deep cleans of the build directory and fresh re-configurations to resolve persistent artifacts or dependency conflicts.
| name | build |
|---|---|
| description | Build the C++ backend using CMake. Use when user asks to compile, build, rebuild, or mentions CMake, compilation errors, or linking issues. |
| allowed-tools | Bash, Read |
Build Project Skill
Build the OrderParserProcessor C++ backend using CMake.
Prerequisites
Ensure required environment variables are set:
ORDER_PARSER_PROCESSOR_ROOT: Project root directoryANTLR_VERSION: ANTLR version (e.g., antlr-4.13.0)
Check with:
echo $ORDER_PARSER_PROCESSOR_ROOT
echo $ANTLR_VERSION
Instructions
- Verify environment variables are set
- Check if build directory exists, if not it will be created by CMake
- Run CMake configuration:
cmake -B build - Run CMake build:
cmake --build build - Report any compilation or linking errors found
- If successful, confirm the build completed and show executable location
Build Options
Standard Build
cmake -B build
cmake --build build
Build with Tests
cmake -B build -DBUILD_TESTS=ON
cmake --build build
Clean Rebuild
rm -rf build
cmake -B build
cmake --build build
Parallel Build (faster)
cmake --build build -j4
ANTLR Handling
CMake automatically handles ANTLR file generation from .g4 grammar files.
Important: For significant grammar modifications, it's better to work directly with antlr4 command to avoid recompiling every time:
# Generate parser from grammar (for testing)
antlr4 -Dlanguage=Cpp -visitor rules/parser/FiScript.g4
# Test grammar with input
grun FiScript <start_rule> -gui < input.txt
Common Issues
- ANTLR not found: Check
ANTLR_VERSIONenvironment variable is set - Protobuf errors: Ensure proto files are generated in
generated/cpp/(use proto-gen skill) - Link errors: Check library dependency order in CMakeLists.txt
- ORDER_PARSER_PROCESSOR_ROOT not set: Export it in your shell profile
Success Criteria
- CMake configuration completes without errors
- All targets compile successfully
- Executable
OrderParserProcessoris created inbuild/backend/directory