diff --git a/.github/workflows/lucent_cross_platform_build.yml b/.github/workflows/lucent_cross_platform_build.yml new file mode 100644 index 0000000..a6f963a --- /dev/null +++ b/.github/workflows/lucent_cross_platform_build.yml @@ -0,0 +1,89 @@ +# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml +name: Lucent Build + +on: + push: + branches: [ "master", "ci" ] + pull_request: + branches: [ "master", "ci" ] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. + fail-fast: false + + # Set up a matrix to run the following 3 configurations: + # 1. + # 2. + # 3. + # + # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. + matrix: + #os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest] + build_type: [Release] + c_compiler: [gcc, clang, cl] + include: + #- os: windows-latest + # c_compiler: cl + # cpp_compiler: cl + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + exclude: + #- os: windows-latest + # c_compiler: gcc + #- os: windows-latest + # c_compiler: clang + - os: ubuntu-latest + c_compiler: cl + + steps: + - uses: actions/checkout@v4 + + - name: Set reusable strings + # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Install dependencies + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + ./script/install_deps.sh + elif [ "$RUNNER_OS" == "Windows" ]; then + echo "$RUNNER_OS not yet supported for CI." + exit 1 + else + echo "$RUNNER_OS not supported" + exit 1 + fi + shell: bash + + - 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 ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Build + # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + + #- name: Test + # working-directory: ${{ steps.strings.outputs.build-output-dir }} + # # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + # # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + # run: ctest --build-config ${{ matrix.build_type }} diff --git a/.gitignore b/.gitignore index 8cbb132..0e6ce1a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ CMakeCache.txt ########### [Bb]in/ [Rr]elease/ +[Vv]endor/ # clangd # ########## diff --git a/CMakeLists.txt b/CMakeLists.txt index e30070b..0a57c4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,12 +2,20 @@ cmake_minimum_required(VERSION 3.5.2 FATAL_ERROR) project(Lucent) +# Compiler +message("Using compiler ${CMAKE_CXX_COMPILER_ID}") + # Enable c++26 set(CMAKE_CXX_STANDARD 26) # Export compile_commands.json for LSPs set(CMAKE_EXPORT_COMPILE_COMMANDS 1) +# set the output directory for built objects. +# This makes sure that the dynamic library goes into the build directory automatically. +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$") + # Dependencies directory set(LucentDependencies ${PROJECT_SOURCE_DIR}/deps) @@ -25,6 +33,10 @@ include_directories(${OUR_SRC_DIR} ${OUR_INC_DIR}) find_package(OpenGL REQUIRED) include_directories(${OPENGL_INCLUDE_DIRS}) +# SDL3 (./script/install_deps.sh has to be run) +add_subdirectory(vendor/SDL EXCLUDE_FROM_ALL) +include_directories(vendor/SDL/include) + if(WIN32) set(WIN_DEP_INCLUDES ${LucentDependencies}/include/Windows) @@ -53,7 +65,7 @@ elseif(UNIX) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMAKE) # Sets SDL2_INCLUDE_DIR and SDL2_LIBRARY - find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3) + # find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3) # Sets GLEW libraries and includes find_package(GLEW REQUIRED) diff --git a/README.md b/README.md index 69dff9e..e848af4 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,9 @@ █████▄▄██ ████████▀ ████████▀ ██████████ ▀█ █▀ ▄████▀ ▀ ``` + +[![Lucent Build](https://github.com/Dequilla/Lucent/actions/workflows/lucent_cross_platform_build.yml/badge.svg?branch=master)](https://github.com/Dequilla/Lucent/actions/workflows/lucent_cross_platform_build.yml) + # A crossplatform game engine using OpenGL ## Contributing diff --git a/SDL b/SDL deleted file mode 160000 index 7c11a8c..0000000 --- a/SDL +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7c11a8cb9f66a2cac63f9a24ab2f49f6d4bf12a0 diff --git a/script/install_deps.sh b/script/install_deps.sh index 89a9a22..a683bdc 100755 --- a/script/install_deps.sh +++ b/script/install_deps.sh @@ -4,7 +4,16 @@ source /etc/os-release case $ID in ubuntu) - echo "Ubuntu Linux TODO" + echo "Ubuntu Linux" + sudo apt update + sudo apt install -y libglew-dev libassimp-dev libfreetype-dev + sudo apt install -y build-essential git make \ + pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \ + libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev \ + libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxtst-dev \ + libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \ + libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev \ + libpipewire-0.3-dev libwayland-dev libdecor-0-dev liburing-dev libx11-dev ;; debian) @@ -13,7 +22,8 @@ case $ID in arch) echo "Arch Linux" - sudo pacman -S sdl3 glew assimp freetype2 + sudo pacman -S glew assimp freetype2 ;; esac +git clone https://github.com/libsdl-org/SDL.git vendor/SDL