Construire le backend C++ avec CMake

VérifiéSûr

Cette compétence compile le backend C++ OrderParserProcessor avec CMake. Utilisez-la pour compiler, reconstruire ou résoudre des erreurs de compilation ou d'édition de liens. Elle prend en charge les constructions standard, les tests et la compilation parallèle.

Spar Skills Guide Bot
DeveloppementIntermédiaire
6002/06/2026
Claude Code
#cpp#cmake#build#compilation

Recommandé pour

Notre avis

Compile le backend C++ en utilisant CMake, avec gestion des dépendances ANTLR et options de build.

Points forts

  • Automatisation complète de la configuration et de la compilation CMake
  • Support des tests et du rebuild propre
  • Gestion automatique des fichiers générés par ANTLR

Limites

  • Nécessite des variables d'environnement préconfigurées
  • Ne gère pas les erreurs de protobuf ou de dépendances externes
  • Pas de support pour des builds cross-platform avancés
Quand l'utiliser

Quand l'utilisateur demande de compiler le backend C++ ou de résoudre des erreurs de compilation/linkage.

Quand l'éviter

Pour des builds simples en un seul fichier ou des projets sans CMake.

Analyse de sécurité

Sûr
Score qualité90/100

The skill uses standard CMake build commands and a scoped 'rm -rf build' for clean rebuilds. No exfiltration, token handling, or destructive actions outside the build directory.

Aucun point d'attention détecté

Exemples

Standard Build
Build the C++ backend using CMake.
Build with Tests
Build the project with tests enabled using CMake.
Clean Rebuild
Perform a clean rebuild of the C++ project.

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 directory
  • ANTLR_VERSION: ANTLR version (e.g., antlr-4.13.0)

Check with:

echo $ORDER_PARSER_PROCESSOR_ROOT
echo $ANTLR_VERSION

Instructions

  1. Verify environment variables are set
  2. Check if build directory exists, if not it will be created by CMake
  3. Run CMake configuration: cmake -B build
  4. Run CMake build: cmake --build build
  5. Report any compilation or linking errors found
  6. 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_VERSION environment 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 OrderParserProcessor is created in build/backend/ directory
Skills similaires