Skip to content
This repository was archived by the owner on Aug 2, 2026. It is now read-only.
Merged
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
38 changes: 25 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
name: ci
name: ci

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
name: build with cmake
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: install deps
run: sudo apt install libsdl2-2.0-0 libsdl2-dev libsdl2-image-dev libfreetype6-dev

- name: configure
run: cmake -DCMAKE_BUILD_TYPE=Debug -S . -B build
- uses: actions/checkout@v4

- name: Install latest CMake and Ninja
uses: lukka/get-cmake@v3.29.3

- name: Fix Linux-specific issues
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libltdl-dev build-essential pkg-config ninja-build

- name: Setup anew (or from cache) vcpkg (and does not build any package)
uses: lukka/run-vcpkg@v11
with:
configurePreset: vcpkg-release
buildPreset: vcpkg-release

- name: build
run: cd build; make
- name: Run CMake consuming CMakePreset.json and run vcpkg to build packages
uses: lukka/run-cmake@v10
with:
configurePreset: 'vcpkg-release'
buildPreset: 'vcpkg-release'

# style:
# runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ example/build
*cmake-tools*
out
release
vcpkg_installed
CMakeUserPresets.json
.idea
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

29 changes: 5 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# SDL2
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(Freetype REQUIRED)
find_package(glm CONFIG REQUIRED)
find_package(SDL2 CONFIG REQUIRED)
find_package(SDL2_image CONFIG REQUIRED)
find_path(EARCUT_HPP_INCLUDE_DIRS "mapbox/earcut.hpp")

# Download git submodule
message(STATUS "Updating all submodules recursively...")
execute_process(
COMMAND git submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_VARIABLE err
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
if(NOT res EQUAL 0)
message(WARNING "Recursive submodule update failed: ${err}")
else()
message(STATUS "All submodules updated recursively.")
endif()

set(SDLK_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SDLK_IS_MAIN_PROJECT OFF)
Expand All @@ -42,22 +27,18 @@ set(SDLK_LIB_VERSION ${PROJECT_VERSION})
set(SDLK_LIB_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(SDLK_VERSION ${PROJECT_VERSION})
set(SDLK_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(SDLK_BUILD_EXAMPLE OFF)

# list of options
option(BUILD_SHARED_LIBS "Build rcli as a shared library" ON)
option(SDLK_LIB_BUILD "Build sdlk lib" ON)
option(SDLK_LIB_INSTALL "Install sdlk lib" OFF)
option(SDLK_BUILD_EXAMPLE "Build sdlk example" OFF)

# configure build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()

if(WIN32)
add_compile_options(WIN32)
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(SDLK_TEST OFF)
set(SDLK_BUILD_EXAMPLE OFF)
Expand Down
45 changes: 45 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"version": 2,
"configurePresets": [
{
"name": "vcpkg",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
},
{
"name": "vcpkg-debug",
"inherits": "vcpkg",
"displayName": "Build with vcpkg (Debug)",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"SDLK_BUILD_EXAMPLE": "ON"
}
},
{
"name": "vcpkg-release",
"inherits": "vcpkg",
"displayName": "Build with vcpkg (Release)",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"SDLK_BUILD_EXAMPLE": "OFF"
}
}
],
"buildPresets": [
{
"name": "vcpkg-debug",
"configurePreset": "vcpkg-debug",
"displayName": "Build Debug",
"description": "Build project in Debug configuration"
},
{
"name": "vcpkg-release",
"configurePreset": "vcpkg-release",
"displayName": "Build Release",
"description": "Build project in Release configuration"
}
]
}
Loading
Loading