Raylib CMake Template

Windows Clang and Ubuntu gcc/clang

Introduction

This project provides a CMake-supported template for RayLib projects, aiming to simplify and standardize the build process across different platforms. It leverages CMake's powerful cross-platform build system capabilities to enhance Raylib project development.

Features

  • CMake Support: Simplifies building and compiling Raylib projects across Windows, Linux, and MacOS.
  • Clang Format: Ensures consistent code style across your project.
  • Project Structure: Organized folders for source code (src/), game resources (resources/), and CMake modules (cmake/).

Requirements

  • CMake
  • Git
  • Clang-format (optional)
  • Visual Studio with C++ development tools (Windows)
  • XCode (macOS)

Status

  • Basic CMake support
  • Project generation
    • Windows
    • Linux
    • MacOS
  • Clang-format support
  • Resource copying

Installation Guide

Fork and Clone: Start by forking this project and cloning it to your local machine.

Building on MacOS

$ cmake -B build-mac -G Xcode -DCMAKE_BUILD_TYPE=Debug

Then go to the build-mac directory and open the generated Xcode project.

Building on Windows

$ cmake -B build-win -G"Visual Studio 17 2022"  -DCMAKE_BUILD_TYPE=Debug

Then go to the build-win directory and open the generated Visual Studio project.

Building in CLI

$ cmake -B build-cli -DCMAKE_BUILD_TYPE=Debug
$ cd build-cli
$ make -j$(nproc)

Usage

After building the project, you can start developing your project with Raylib by adding your source files to the src/ directory and resources to resources/. The CMake scripts are designed to handle the rest.

Every time you add a new source file and a new resources, you will need to re-run the CMake build command to update the project files before building the project.

Please note that the project is still in development and may contain bugs.

Acknowledgments