Skip to content

Commit

Permalink
CMake modernization
Browse files Browse the repository at this point in the history
Re-write the CMake project from scratch up to some extent using modern
CMake conventions. Tested with GLFW, OpenGL 3 and rlottie.
Available samples: benchmark, demo, lottie
  • Loading branch information
hobyst committed Jul 9, 2023
1 parent 0df1bbb commit a80bed8
Show file tree
Hide file tree
Showing 24 changed files with 1,299 additions and 149 deletions.
55 changes: 29 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,45 @@ on: [push, pull_request]

jobs:
Linux:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

env:
BUILD_TYPE: Release
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CC: "${{ matrix.cc }}"
CXX: "${{ matrix.cxx }}"

strategy:
fail-fast: false
matrix:
include:
- cc: clang
cxx: clang++
cmake_options: -DENABLE_PRECOMPILED_HEADERS=OFF -DSAMPLES_BACKEND=GLFW_GL2
cmake_options: -DRMLUI_ENABLE_PRECOMPILED_HEADERS=OFF -DRMLUI_SAMPLES_BACKEND=GLFW_GL2
- cc: clang
cxx: clang++
cmake_options: -DSAMPLES_BACKEND=SDL_VK
- cmake_options: -DBUILD_TESTING=ON -DENABLE_PRECOMPILED_HEADERS=OFF
cmake_options: -DRMLUI_SAMPLES_BACKEND=SDL_VK -DSDL_LIBRARY=SDL2 -DSDL_INCLUDE_DIR=/usr/include/SDL2
- cmake_options: -DRMLUI_BUILD_TESTING=ON -DRMLUI_ENABLE_PRECOMPILED_HEADERS=OFF
enable_testing: true
- cmake_options: -DNO_FONT_INTERFACE_DEFAULT=ON -DENABLE_LOTTIE_PLUGIN=ON -DSAMPLES_BACKEND=X11_GL2
- cmake_options: -DDISABLE_RTTI_AND_EXCEPTIONS=ON -DSAMPLES_BACKEND=SDL_GL2
- cmake_options: -DNO_THIRDPARTY_CONTAINERS=ON -DSAMPLES_BACKEND=SFML_GL2
- cmake_options: -DSAMPLES_BACKEND=SDL_VK -DRMLUI_VK_DEBUG=ON -DENABLE_PRECOMPILED_HEADERS=OFF -DCMAKE_BUILD_TYPE=Debug
- cmake_options: -DRMLUI_ENABLE_LOTTIE_PLUGIN=ON -DRMLUI_SAMPLES_BACKEND=X11_GL2
- cmake_options: -DRMLUI_DISABLE_RTTI_AND_EXCEPTIONS=ON -DRMLUI_SAMPLES_BACKEND=SDL_GL2 -DSDL_LIBRARY=SDL2 -DSDL_INCLUDE_DIR=/usr/include/SDL2 -DSDL_IMAGE_LIBRARY=/usr/lib/x86_64-linux-gnu/libSDL2_image-2.0.so.0 -DSDL_IMAGE_INCLUDE_DIR=/usr/include/SDL2
- cmake_options: -DRMLUI_NO_THIRDPARTY_CONTAINERS=ON -DRMLUI_SAMPLES_BACKEND=SFML_GL2
- cmake_options: -DRMLUI_SAMPLES_BACKEND=SDL_VK -DRMLUI_VK_DEBUG=ON -DRMLUI_ENABLE_PRECOMPILED_HEADERS=OFF -DCMAKE_BUILD_TYPE=Debug -DSDL_LIBRARY=SDL2 -DSDL_INCLUDE_DIR=/usr/include/SDL2

steps:
- uses: actions/checkout@v3

- name: Install Dependencies
run: |-
sudo apt-get update
sudo apt-get install cmake ninja-build libsdl2-dev libsdl2-image-dev libfreetype6-dev libglew-dev liblua5.2-dev libsfml-dev librlottie-dev libglfw3-dev
sudo apt update -yq
sudo apt install -yq cmake ninja-build clang libsdl2-dev libsdl2-image-dev libfreetype6-dev libglew-dev liblua5.2-dev libsfml-dev librlottie-dev libglfw3-dev
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/Build

- name: Configure CMake
working-directory: ${{github.workspace}}/Build
run: >-
cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_LUA_BINDINGS=ON -DBUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON
cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_BUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON
${{ matrix.cmake_options }}
- name: Build
Expand All @@ -65,8 +65,8 @@ jobs:
fail-fast: false
matrix:
include:
- cmake_options: -DSAMPLES_BACKEND=auto
- cmake_options: -DSAMPLES_BACKEND=GLFW_GL2
# - cmake_options: -DRMLUI_SAMPLES_BACKEND=auto
- cmake_options: -DRMLUI_SAMPLES_BACKEND=GLFW_GL2

steps:
- uses: actions/checkout@v3
Expand All @@ -80,7 +80,7 @@ jobs:
- name: Configure CMake
working-directory: ${{github.workspace}}/Build
run: >-
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_LUA_BINDINGS=ON -DBUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_BUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON
${{ matrix.cmake_options }}
- name: Build
Expand All @@ -99,25 +99,28 @@ jobs:
fail-fast: false
matrix:
include:
- cmake_options: -DSAMPLES_BACKEND=auto -DENABLE_PRECOMPILED_HEADERS=OFF
- cmake_options: -DSAMPLES_BACKEND=Win32_VK -DRMLUI_VK_DEBUG=ON
- cmake_options: -DSAMPLES_BACKEND=SDL_VK -DBUILD_LUA_BINDINGS_FOR_LUAJIT=ON
# - cmake_options: -DRMLUI_SAMPLES_BACKEND=auto -DRMLUI_ENABLE_PRECOMPILED_HEADERS=OFF
# After upgrading minimum CMake to >= 3.18, CMake should automatically find Vulkan using the VULKAN_SDK environment variable
- cmake_options: -DRMLUI_SAMPLES_BACKEND=Win32_VK -DRMLUI_VK_DEBUG=ON -DVulkan_LIBRARY="C:\VulkanSDK\1.3.250.1\Lib\vulkan-1.lib" -DVulkan_INCLUDE_DIR="C:\VulkanSDK\1.3.250.1\Include\vulkan"
- cmake_options: -DRMLUI_SAMPLES_BACKEND=SDL_VK -DRMLUI_BUILD_LUA_BINDINGS_FOR_LUAJIT=ON -DVulkan_LIBRARY="C:\VulkanSDK\1.3.250.1\Lib\vulkan-1.lib" -DVulkan_INCLUDE_DIR="C:\VulkanSDK\1.3.250.1\Include\vulkan"

steps:
- uses: actions/checkout@v3

- name: Install Dependencies
run: C:\vcpkg\vcpkg install freetype[core] sdl2[core,vulkan] lua[core] luajit
run: |-
Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/1.3.250.1/windows/VulkanSDK-1.3.250.1-Installer.exe -OutFile vulkansdk.exe
.\vulkansdk.exe --confirm-command --accept-licenses --default-answer in com.lunarg.vulkan
C:\vcpkg\vcpkg install freetype[core] sdl2[core,vulkan] lua[core] luajit --triplet x64-windows
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/Build

- name: Configure CMake
working-directory: ${{github.workspace}}/Build
run: >-
cmake $env:GITHUB_WORKSPACE -A x64 -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$env:BUILD_TYPE -DBUILD_LUA_BINDINGS=ON -DBUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON
-DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
${{ matrix.cmake_options }}
cmake $env:GITHUB_WORKSPACE -A x64 -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$env:BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_BUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON
-DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" ${{ matrix.cmake_options }} -DRMLUI_USING_VCPKG=TRUE
- name: Build
working-directory: ${{github.workspace}}/Build
Expand All @@ -131,8 +134,8 @@ jobs:

- name: Install Dependencies
run: |-
sudo apt-get update
sudo apt-get install cmake
sudo apt update -yq
sudo apt install -yq cmake
wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
tar -xvf master.tar.gz
emsdk-master/emsdk update
Expand All @@ -146,7 +149,7 @@ jobs:
run: |-
source emsdk-master/emsdk_env.sh
cd Build
emcmake cmake $GITHUB_WORKSPACE -DBUILD_SAMPLES=ON -DBUILD_SHARED_LIBS=OFF -DWARNINGS_AS_ERRORS=ON -DEMSCRIPTEN_EXE_FLAGS="-O1"
emcmake cmake $GITHUB_WORKSPACE -DRMLUI_BUILD_SAMPLES=ON -DBUILD_SHARED_LIBS=OFF -DWARNINGS_AS_ERRORS=ON -DRMLUI_EMSCRIPTEN_EXE_FLAGS="-O1"
- name: Build
run: |-
Expand Down
121 changes: 0 additions & 121 deletions CMake/BackendFileList.cmake

This file was deleted.

Loading

0 comments on commit a80bed8

Please sign in to comment.