Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,13 @@ dkms.conf
*.user
.vs

# Visual Studio Code files
/.vscode

# Clangd files
.cache
.clangd
compile_commands.json

# Build folder
[Bb]uild
37 changes: 37 additions & 0 deletions projects/CMAKE/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.11)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

project(rguilayout C)

find_package(Raylib REQUIRED)

# Directory Variables
set(RGUILAYOUT_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../src)
set(RGUILAYOUT_HEADERS "")
set(RGUILAYOUT_SOURCES "")

# Source files
file(GLOB RGUILAYOUT_HEADERS ${RGUILAYOUT_ROOT}/*.h)
file(GLOB RGUILAYOUT_SOURCES ${RGUILAYOUT_ROOT}/*.c)
file(GLOB EXTERNAL_HEADERS ${RGUILAYOUT_ROOT}/external/*.h)
file(GLOB EXTERNAL_SOURCES ${RGUILAYOUT_ROOT}/external/*.c)

# Create target
add_executable(rguilayout
${EXTERNAL_HEADERS}
${RGUILAYOUT_HEADERS}
${RGUILAYOUT_SOURCES}
${EXTERNAL_SOURCES}
)

# Add include dirs
target_include_directories(
rguilayout PRIVATE
${RGUILAYOUT_ROOT}/external
)

# Link raylib
target_link_libraries(
rguilayout PRIVATE
raylib
)
29 changes: 29 additions & 0 deletions projects/CMAKE/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# rGuiLayout CMake Definitions

This provides CMake definition files for rGuiLayout.

## Usage

1. create build dir
```bash
mkdir build
```

2. configure cmake
```bash
cmake -Sprojects/CMAKE -Bbuild
```

3. compile the project
```bash
cmake --build build --config Release --target all
```

## HTML5 target

Replace step 2 with:
```bash
cmake -Sprojects/CMAKE -Bbuild -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
```

The exact toolchain location may vary based on installation.
17 changes: 17 additions & 0 deletions projects/CMAKE/cmake/FindRaylib.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
find_package(raylib 5.0 QUIET CONFIG)
if (NOT raylib_FOUND)
include(FetchContent)
FetchContent_Declare(
raylib
GIT_REPOSITORY https://github.com/raysan5/raylib.git
GIT_TAG 5.0
)
FetchContent_GetProperties(raylib)
if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
set(FETCHCONTENT_QUIET NO)
FetchContent_Populate(raylib)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # or games
add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
endif()
endif()
3 changes: 3 additions & 0 deletions projects/VSCODE/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cmake.sourceDirectory": "${workspaceFolder}/projects/CMAKE"
}
15 changes: 15 additions & 0 deletions projects/VSCODE/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# rGuiLayout VSCODE configurations

This provides configurations for VS-Code to compile using CMAKE.

## Usage

Move .vscode folder 2 directories above.
```bash
mv .vscode ../../
```

That is it.

Note that you will have to install CMake Tools extension on vscode for this setup.
You also need to hae CMake installed on your computer.