Skip to content

Commit

Permalink
More CI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
texus committed Apr 9, 2024
1 parent 9fc7827 commit 9aec0c6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
34 changes: 27 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ jobs:
-DSDL3_DIR="$GITHUB_WORKSPACE/SDL_INSTALL/lib/cmake/SDL3/"
-DSDL3_ttf_DIR="$GITHUB_WORKSPACE/SDL_TTF_INSTALL/lib/cmake/SDL3_ttf/"
-Dglfw3_DIR="$GITHUB_WORKSPACE/GLFW_INSTALL/lib/cmake/glfw3/"
-Draylib_ROOT="$GITHUB_WORKSPACE/RAYLIB_INSTALL/"
-Draylib_INCLUDE_DIR="$GITHUB_WORKSPACE/RAYLIB_INSTALL/include"
-Draylib_LIBRARY="$GITHUB_WORKSPACE/RAYLIB_INSTALL/lib/libraylib.so"
-DBUILD_SHARED_LIBS=ON
Expand Down Expand Up @@ -247,9 +248,9 @@ jobs:
SFML_VERSION: 2.5.1 # 2.5.0 has issue with mesa
SDL_VERSION: 2.0.18 # older versions aren't supported in SDL_RENDERER backend
SDL_TTF_VERSION: 2.0.15 # 2.0.14 has no cmake script
GLFW_VERSION: 3.2
RAYLIB_VERSION: 4.0.0
CMAKE_VERSION: 3.16
GLFW_VERSION: '3.2'
RAYLIB_VERSION: '4.0.0'
CMAKE_VERSION: '3.16'
CMAKE_VERSION_PATCH: 0
GCC_VERSION: 7
CLANG_VERSION: '6.0'
Expand Down Expand Up @@ -347,6 +348,7 @@ jobs:
-DSDL2_DIR="$GITHUB_WORKSPACE/SDL_INSTALL/lib/cmake/SDL2/"
-DSDL2_TTF_PATH="$GITHUB_WORKSPACE/SDL_TTF_INSTALL"
-Dglfw3_DIR="$GITHUB_WORKSPACE/GLFW_INSTALL/lib/cmake/glfw3/"
-Draylib_ROOT="$GITHUB_WORKSPACE/RAYLIB_INSTALL/"
-Draylib_INCLUDE_DIR="$GITHUB_WORKSPACE/RAYLIB_INSTALL/include"
-Draylib_LIBRARY="$GITHUB_WORKSPACE/RAYLIB_INSTALL/lib/libraylib.so"
-DBUILD_SHARED_LIBS=ON
Expand Down Expand Up @@ -505,8 +507,8 @@ jobs:
SFML_VERSION: 2.6.0
SDL_VERSION: 2.28.3
SDL_TTF_VERSION: 2.20.2
GLFW_VERSION: 3.4
RAYLIB_VERSION: 5.0
GLFW_VERSION: '3.4'
RAYLIB_VERSION: '5.0'
FREETYPE_VERSION: 2.13.2
MSVC_TOOLSET_VERSION: 143 # VS2022
steps:
Expand All @@ -528,17 +530,35 @@ jobs:
7z x v${env:FREETYPE_VERSION}.zip
7z x raylib-${env:RAYLIB_VERSION}_win32_msvc16.zip
- name: Cache raylib
uses: actions/cache@v4
id: cache-raylib
with:
path: RAYLIB_INSTALL
key: CACHE_WINDOWS_RAYLIB_${{env.RAYLIB_VERSION}}

- name: Build raylib
if: steps.cache-raylib.outputs.cache-hit != 'true'
run: |
mkdir raylib
wget -nv -O- "https://github.com/raysan5/raylib/archive/refs/tags/${env:RAYLIB_VERSION}.zip" | tar --strip-components=1 -xz -C raylib
cmake -GNinja -DCMAKE_INSTALL_PREFIX=RAYLIB_INSTALL -DBUILD_SHARED_LIBS=ON -S raylib -B raylib-build
cmake --build raylib-build --config Release --target install
- name: Build TGUI
run: >
dir "${env:GITHUB_WORKSPACE}/RAYLIB_INSTALL/lib/"
cmake -B TGUI-build -T v${env:MSVC_TOOLSET_VERSION} -A Win32
-DSFML_DIR="${env:GITHUB_WORKSPACE}/SFML-${env:SFML_VERSION}/lib/cmake/SFML/"
-DSDL2_DIR="${env:GITHUB_WORKSPACE}/SDL2-${env:SDL_VERSION}/cmake/"
-DSDL2_ttf_DIR="${env:GITHUB_WORKSPACE}/SDL2_ttf-${env:SDL_TTF_VERSION}/cmake/"
-DGLFW_INCLUDE_DIR="${env:GITHUB_WORKSPACE}/glfw-${env:GLFW_VERSION}.bin.WIN32/include"
-DGLFW_LIBRARY="${env:GITHUB_WORKSPACE}/glfw-${env:GLFW_VERSION}.bin.WIN32/lib-vc2022/glfw3dll.lib"
-DFREETYPE_WINDOWS_BINARIES_PATH="${env:GITHUB_WORKSPACE}/freetype-windows-binaries-${env:FREETYPE_VERSION}"
-Draylib_INCLUDE_DIR="${env:GITHUB_WORKSPACE}/raylib-${env:RAYLIB_VERSION}_win32_msvc16/include"
-Draylib_LIBRARY="${env:GITHUB_WORKSPACE}/raylib-${env:RAYLIB_VERSION}_win32_msvc16/lib/raylibdll.lib"
-Draylib_DIR="${env:GITHUB_WORKSPACE}/RAYLIB_INSTALL/lib/cmake/raylib/"
-Draylib_INCLUDE_DIR="${env:GITHUB_WORKSPACE}/RAYLIB_INSTALL/include"
-Draylib_LIBRARY="${env:GITHUB_WORKSPACE}/RAYLIB_INSTALL/lib/raylib.lib"
-DCMAKE_UNITY_BUILD=OFF
-DBUILD_SHARED_LIBS=ON
-DTGUI_CXX_STANDARD=23
Expand Down
11 changes: 7 additions & 4 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -596,12 +596,15 @@ endmacro()

# Find OpenGL and add it as a dependency
macro(tgui_add_dependency_raylib)
find_package(raylib REQUIRED)
target_link_libraries(tgui PUBLIC raylib)
if(NOT TARGET raylib)
find_package(raylib CONFIG REQUIRED)

if (raylib_VERSION VERSION_LESS "4")
message(FATAL_ERROR "raylib 4 or higher is required")
if (raylib_VERSION VERSION_LESS "4")
message(FATAL_ERROR "raylib 4 or higher is required")
endif()
endif()

target_link_libraries(tgui PUBLIC raylib)
endmacro()


Expand Down
2 changes: 1 addition & 1 deletion src/Backend/Font/Raylib/BackendFontRaylib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ namespace tgui
// The getGlyph function will update m_cachedAscents when we didn't have a cached value yet.
const unsigned int scaledTextSize = static_cast<unsigned int>(characterSize * m_fontScale);
if (!m_cachedAscents[scaledTextSize])
getGlyph(U' ', characterSize, false, 0);
(void)getGlyph(U' ', characterSize, false, 0);

return static_cast<float>(m_cachedAscents[scaledTextSize]) / m_fontScale;
}
Expand Down

0 comments on commit 9aec0c6

Please sign in to comment.