Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub actions #1

Merged
merged 3 commits into from
Jan 24, 2024
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
47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: CMake on a single platform

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

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install raylib dependencies
run: |
sudo apt-get update
sudo apt-get install xorg-dev libglu1-mesa-dev

- name: Fetch submodules
run: git submodule update --init

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --target adagio_test --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "third_party/Catch2"]
path = third_party/Catch2
url = https://github.com/catchorg/Catch2.git
branch = v2.x

[submodule "third_party/entt"]
path = third_party/entt
url = https://github.com/skypjack/entt
branch = v3.13.x
35 changes: 28 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,34 @@ file(GLOB_RECURSE TESTS "${CMAKE_SOURCE_DIR}/src/math/*.cpp" "${CMAKE_SOURCE_DIR
"${CMAKE_SOURCE_DIR}/test/*.cpp")
file(COPY "${CMAKE_SOURCE_DIR}/assets" DESTINATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")

add_executable(game ${SOURCES})
target_link_libraries(game raylib)
include_directories(/usr/include/entt)
# Raylib include
# This is temporary; eventually raylib will not be included in this engine
# Ideally we would use git submodules like we're using with Catch, but... again, this is just a
# stopover until we have fully removed raylib from the equation.
# This is sourced from: https://github.com/SasLuca/raylib-cmake-template/blob/master/CMakeLists.txt
include(FetchContent)
set(FETCHCONTENT_QUIET FALSE)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # don't build the supplied example games

add_executable(game_test ${TESTS})
find_package(Catch2 REQUIRED)
target_link_libraries(game_test Catch2::Catch2 raylib)
FetchContent_Declare(
raylib
GIT_REPOSITORY "https://github.com/raysan5/raylib.git"
GIT_TAG "master"
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(raylib)

add_executable(adagio ${SOURCES})
target_link_libraries(adagio raylib)


add_subdirectory(third_party/entt)
add_subdirectory(third_party/Catch2)
add_executable(adagio_test ${TESTS})
target_link_libraries(adagio_test PRIVATE Catch2::Catch2 raylib EnTT::EnTT)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/third_party/Catch2/contrib)
include(CTest)
include(Catch)
catch_discover_tests(game_test)
catch_discover_tests(adagio_test)
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# libadagio-plusplus

This is a WIP 2D game engine I'm working on. The main focus of this engine is to make it easy to switch between
underlying libraries without changing any code besides some humble adapter classes.

This engine is still in a very WIP state. To get it working, make sure that git submodules are properly fetched by
running:

```shell
git submodule update
```
1 change: 1 addition & 0 deletions third_party/Catch2
Submodule Catch2 added at d4b0b3
1 change: 1 addition & 0 deletions third_party/entt
Submodule entt added at 60703f