Installation

Install KapRaylib on your project

Step 1 - main install

Submodules

We advise you to use submodules if your project use github. Submodules allow you to update KapRaylib if you want in latest release.

To install KapRaylib with submodules, you juste have to excute this command on your terminal :

> git submodule add git@github.com:benji-35/KapRaylib.git Packages/KapRaylib

Zip file

If you do not use github or you do not want to use submodules, you can download the version you want of KapRaylib with this link.

Step 2 - Init CMakes

Because KapEngine uses cmakes, you have to do some stuff to init KapRaylib to your project.

First of all you have to add lines below in your CMakeList.txt

# RayLib version
set(raylib_VERSION 4.0.0)
find_package(raylib REQUIRED)
message(STATUS "RayLib version: ${raylib_VERSION}")

target_link_libraries(${EXE_NAME} raylib)

You also have to create a CMake folder. Inside you will create Findraylib.cmake file.

In this file you have to write these lines :

if (NOT raylib_FOUND)
    include(FetchContent)
    FetchContent_Declare(raylib URL https://github.com/raysan5/raylib/archive/refs/tags/${raylib_VERSION}.tar.gz)
    FetchContent_GetProperties(raylib)
    if (NOT raylib_POPULATED)
        set(FETCHCONTENT_QUIET NO)
        FetchContent_Populate(raylib)
        set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
        add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
        set(raylib_FOUND TRUE)
    endif()
endif()

Directory : {Project Root}/CMake/Findraylib.cmake

This file gonna take Raylib if you do not have it.

In Packages folder you have a file named packages.cmake.

Inside you have to write this line :

include(Packages/KapRaylib/KapRaylib.cmake)

Step 3 - Play

Now you installed KapRaylib ! You can build and play your game with Raylib.

Step 4 - Advanced tools

KapRaylib is made of several defines. Each of them can be rewrite by adding flag in your cmake command.

$> cmake -DKAPRAYLIB_BETA_OPT=ON #here beta version gonna be compile
$> cmake -DKAPRAYLIB_3D_ACTIVE_OPT=ON #here KapRaylib gonna use 3D
$> cmake -DKAPRAYLIB_2D_ACTIVE_OPT=ON #here KapRaylib gonna use 2D
$> cmake -DKAPRAYLIB_SOUND_ACTIVE_OPT=ON #here KapRaylib gonna use sound

these flags can be execute in same line to add several options.

Last updated