Skip to content

Commit 542a91f

Browse files
committed
Change: Github Workflow for Platform Detection
1 parent e1510db commit 542a91f

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

.github/workflows/cmake-multi-platform.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: CMake Build Test
22
on: [push, pull_request]
33

44
jobs:
5+
# ─── Reusable setup steps are handled via composite or just duplicated minimally ───
6+
57
linux-lib:
68
name: Linux Lib (${{ matrix.display_server }})
79
runs-on: ubuntu-latest
@@ -37,7 +39,6 @@ jobs:
3739
run: |
3840
cmake -B build \
3941
-DEOS_BUILD_EXAMPLES=OFF \
40-
-DWAYLAND_DISPLAY=${{ matrix.display_server == 'Wayland' && 'wayland-0' || '' }} \
4142
-DUSE_WAYLAND=${{ matrix.display_server == 'Wayland' && 'ON' || 'OFF' }} \
4243
-DUSE_X11=${{ matrix.display_server == 'X11' && 'ON' || 'OFF' }} \
4344
-DCMAKE_BUILD_TYPE=Release
@@ -79,7 +80,6 @@ jobs:
7980
run: |
8081
cmake -B build \
8182
-DEOS_BUILD_EXAMPLES=ON \
82-
-DWAYLAND_DISPLAY=${{ matrix.display_server == 'Wayland' && 'wayland-0' || '' }} \
8383
-DUSE_WAYLAND=${{ matrix.display_server == 'Wayland' && 'ON' || 'OFF' }} \
8484
-DUSE_X11=${{ matrix.display_server == 'X11' && 'ON' || 'OFF' }} \
8585
-DCMAKE_BUILD_TYPE=Release

cmake/CmakeMacros.cmake

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,23 @@ macro(DEFINE_PLATFORM)
120120
target_compile_definitions(EOS PUBLIC EOS_PLATFORM_WINDOWS)
121121
set(USE_WINDOWS TRUE)
122122
elseif(UNIX AND NOT APPLE)
123-
if(DEFINED ENV{WAYLAND_DISPLAY})
123+
if(USE_WAYLAND)
124124
message(STATUS "Wayland session detected")
125125
target_compile_definitions(EOS PUBLIC EOS_PLATFORM_WAYLAND)
126-
set(USE_WAYLAND TRUE)
127-
else()
126+
elseif(USE_X11)
128127
message(STATUS "X11 session detected")
129128
target_compile_definitions(EOS PUBLIC EOS_PLATFORM_X11)
130-
set(USE_X11 TRUE)
129+
else()
130+
# Fallback: detect from environment
131+
if(DEFINED ENV{WAYLAND_DISPLAY})
132+
message(STATUS "Wayland session detected (env)")
133+
target_compile_definitions(EOS PUBLIC EOS_PLATFORM_WAYLAND)
134+
set(USE_WAYLAND TRUE)
135+
else()
136+
message(STATUS "X11 session detected (env)")
137+
target_compile_definitions(EOS PUBLIC EOS_PLATFORM_X11)
138+
set(USE_X11 TRUE)
139+
endif()
131140
endif()
132141
endif()
133142
endmacro()

examples/ModelPBR/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void LoadModel(const std::filesystem::path& modelPath, std::vector<Vertex>& vert
3434
modelPath.string().c_str(),
3535
aiProcess_Triangulate
3636
);
37-
CHECK(scene && scene->HasMeshes(), "Could not load mesh: {}", modelPath.c_str());
37+
CHECK(scene && scene->HasMeshes(), "Could not load mesh: {}", modelPath.string());
3838

3939
const aiMesh* mesh = scene->mMeshes[0];
4040

0 commit comments

Comments
 (0)