Building the Software

Clone and Build

# Clone the repository
git clone https://github.com/strvdr/kirin-autonomous-chess.git
cd kirin-autonomous-chess/kirin

# Create build directory
mkdir build && cd build

# Configure with GPIO support
cmake .. -DCMAKE_BUILD_TYPE=Release \
         -DKIRIN_ENABLE_GPIOD=ON

# Build
cmake --build . --parallel

Warning

The -DKIRIN_ENABLE_GPIOD=ON option is essential on the Raspberry Pi. Without it, the board scanner and button controller compile in stub mode and GPIO calls are no-ops. The build will succeed either way, but sensors and buttons will not work without GPIO support enabled.

Install Dependencies

# Install libgpiod for GPIO access (no root required at runtime)
sudo apt install libgpiod-dev

# Verify installation
dpkg -l | grep libgpiod

Run the Tests

Before connecting any hardware, verify the software is correct:

cd build

# Run all tests
ctest --output-on-failure

# Or run individually
./board_scanner_test     # Sensor move detection logic
./ui_controller_test     # OLED/button controller logic
./game_controller_test   # Engine-to-physical bridge
./board_interpreter_test # Path planning
./engine_test            # Engine validation
./captured_piece_test    # Capture encoding

All tests should pass. The board scanner tests run entirely in simulation mode and do not require GPIO hardware.