diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml new file mode 100644 index 0000000..8e2d0c5 --- /dev/null +++ b/.github/workflows/c-cpp.yml @@ -0,0 +1,71 @@ +name: C/C++ CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + # Step 1: Checkout Code + - name: Checkout Code + uses: actions/checkout@v4 + + # Step 2: Install GCC 11.4.0 and Base Dependencies + - name: Install GCC 11.4.0 and Base Dependencies + run: | + sudo apt-get update + sudo apt-get install -y software-properties-common wget \ + build-essential cmake make + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install -y gcc-11 g++-11 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 11 + gcc --version + + # Step 3: Install SDL2 + - name: Install SDL2 Dependency + run: | + sudo apt-get update && sudo apt-get install -y libsdl2-dev + + # Step 4: Install SDL2 Mixer + - name: Install SDL Mixer Dependency + run: | + sudo apt-get update + sudo apt-get install -y libopusfile-dev libxmp-dev fluidsynth libfluidsynth-dev \ + wavpack libwavpack-dev libsdl2-mixer-dev + + # Step 5: Install SDL2 TTF + - name: Install SDL2 TTF Dependency + run: | + sudo apt-get update + sudo apt-get install -y libfreetype6-dev + mkdir -p dependencies + cd dependencies + wget https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.24.0/SDL2_ttf-2.24.0.tar.gz + tar -xzf SDL2_ttf-2.24.0.tar.gz + cd SDL2_ttf-2.24.0 + mkdir build && cd build + cmake .. + make + sudo make install + + # Step 6: Build Project + - name: Build Project + run: | + mkdir -p build + cd build + cmake -DSDL2_mixer_DIR=/usr/lib/x86_64-linux-gnu/cmake/SDL2_mixer .. + make + + # # Step 7: Run Tests + # - name: Run Tests + # run: | + # ./scripts/run_tests.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d50161..2d35ba6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.16) # Set the project name and version project(engine VERSION 1.0 LANGUAGES CXX) diff --git a/README.md b/README.md index 3acd7ac..c82f924 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,13 @@ You have to install LLVM for formatting your code. Refer to [this](https://llvm. - (**PROBABLY ONLY FOR WSL USERS**)When SDL library tries to popup a textbox or etc. via using xServer over windows, it fails and gets a core dump fail. To fix this, you need to install the correct GUI package for your wsl. It is most probably gets fixed with ```sudo apt install zenity ``` but it may depend on the linux version and distribution you are currently using. For further questions, go and search it on Google, Stackoverflow or ask ChatGPT. Don't bother me. - In systems other than Ubuntu 22.04LTS, some building problems might occur (for example, i could not build Logger class because i had to include each C++ standard library by hand, such as **`#include `** **`#include `**). If you know how to fix it, please feel free to contribute to this file. + + +### ** Test `Action` on local +In order to test the project on local computer before you push, you can use [`act`](https://github.com/nektos/act) module. This module uses the Docker API to either pull or build the necessary images, as defined in your workflow files and finally determines the execution path baseed on the dependencies that were defined. +Please look at the [act user guide](https://nektosact.com/) for more documentation. + +```bash +curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | bash +act .github/workflows/c-cpp.yml +``` diff --git a/include/CollisionManager.hpp b/include/CollisionManager.hpp index 032b111..5e7de9c 100644 --- a/include/CollisionManager.hpp +++ b/include/CollisionManager.hpp @@ -6,6 +6,8 @@ #include #include #include +#include + namespace game::engine { class CollisionManager diff --git a/include/Logger.hpp b/include/Logger.hpp index ac70266..7c015a6 100644 --- a/include/Logger.hpp +++ b/include/Logger.hpp @@ -1,8 +1,10 @@ #pragma once +#include #include #include #include #include +#include namespace utils { class Logger