FIX: Exclude GLFW from test builds
All checks were successful
Tests / test (push) Successful in 2m37s

This commit is contained in:
sebastian 2026-04-17 11:48:34 +02:00
parent ed86dd78dd
commit 00d10e4f0e
2 changed files with 39 additions and 34 deletions

View File

@ -32,7 +32,7 @@ jobs:
run: git submodule update --init --recursive run: git submodule update --init --recursive
- name: Konfigurieren - name: Konfigurieren
run: cmake -B build run: cmake -B build -DBUILD_GAME=OFF
- name: Nur Test-Target bauen - name: Nur Test-Target bauen
run: cmake --build build --target LayoutEngineTests run: cmake --build build --target LayoutEngineTests

View File

@ -1,11 +1,14 @@
cmake_minimum_required(VERSION 3.31) cmake_minimum_required(VERSION 3.20)
project(Dicewars_Siedler) project(Dicewars_Siedler)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(OpenGL REQUIRED) option(BUILD_GAME "Build the game executable" ON)
# GLFW/OpenGL/Freetype nur laden wenn das Spiel gebaut wird
if(BUILD_GAME)
find_package(OpenGL REQUIRED)
add_subdirectory(lib/glfw) add_subdirectory(lib/glfw)
add_library(glad STATIC add_library(glad STATIC
@ -17,7 +20,9 @@ target_include_directories(glad PUBLIC
find_package(Freetype REQUIRED) find_package(Freetype REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIRS}) include_directories(${FREETYPE_INCLUDE_DIRS})
endif()
# Catch2 und Tests immer verfügbar
include(FetchContent) include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
Catch2 Catch2
@ -29,18 +34,17 @@ FetchContent_MakeAvailable(Catch2)
add_executable(LayoutEngineTests add_executable(LayoutEngineTests
tests/layout/LayoutEngineTest.cpp tests/layout/LayoutEngineTest.cpp
) )
target_include_directories(LayoutEngineTests PRIVATE target_include_directories(LayoutEngineTests PRIVATE
src src
lib/glm lib/glm
) )
target_link_libraries(LayoutEngineTests PRIVATE Catch2::Catch2WithMain) target_link_libraries(LayoutEngineTests PRIVATE Catch2::Catch2WithMain)
include(CTest) include(CTest)
include(Catch) include(Catch)
catch_discover_tests(LayoutEngineTests) catch_discover_tests(LayoutEngineTests)
if(BUILD_GAME)
add_executable(Dicewars_Siedler src/main.cpp add_executable(Dicewars_Siedler src/main.cpp
src/engine/core/Window.cpp src/engine/core/Window.cpp
src/engine/core/Window.h src/engine/core/Window.h
@ -286,7 +290,6 @@ add_executable(Dicewars_Siedler src/main.cpp
src/game/GameWorldSystems.h src/game/GameWorldSystems.h
src/engine/core/gui/uiComponent/layout/LayoutEngine.h src/engine/core/gui/uiComponent/layout/LayoutEngine.h
) )
target_compile_options(Dicewars_Siedler PRIVATE target_compile_options(Dicewars_Siedler PRIVATE
-Wall -Wall
-Wextra -Wextra
@ -310,3 +313,5 @@ target_link_libraries(Dicewars_Siedler
OpenGL::GL OpenGL::GL
${FREETYPE_LIBRARIES} ${FREETYPE_LIBRARIES}
) )
endif()