Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Wayland cmake definitions and linkage #250

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt install -y libgl1-mesa-dev
sudo apt install -y libgl1-mesa-dev libwayland-dev libwayland-egl-backend-dev
- uses: lukka/get-cmake@latest
with:
cmakeVersion: ${{ env.CMAKE_VERSION }}
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt install -y libgl1-mesa-dev
sudo apt install -y libgl1-mesa-dev libwayland-dev libwayland-egl-backend-dev
if: matrix.os == 'ubuntu-latest'

# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt install -y libgl1-mesa-dev
sudo apt install -y libgl1-mesa-dev libwayland-dev libwayland-egl-backend-dev
if: matrix.os == 'ubuntu-latest'

# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt install -y libgl1-mesa-dev
sudo apt install -y libgl1-mesa-dev libwayland-dev libwayland-egl-backend-dev
if: matrix.os == 'ubuntu-latest'
# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
- uses: lukka/get-cmake@latest
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ option(BGFX_INSTALL "Create installation target." ON)
cmake_dependent_option(
BGFX_INSTALL_EXAMPLES "Install examples and their runtimes." OFF "BGFX_INSTALL;BGFX_BUILD_EXAMPLES" OFF
)
cmake_dependent_option(BGFX_WITH_WAYLAND "Use Wayland backend." ON "CMAKE_SYSTEM_NAME STREQUAL 'Linux'" OFF)
cmake_dependent_option(BGFX_WITH_WAYLAND "Use Wayland backend." ON "CMAKE_SYSTEM_NAME STREQUAL Linux" OFF)
option(BGFX_CUSTOM_TARGETS "Include convenience custom targets." ON)
option(BGFX_CONFIG_MULTITHREADED "Build bgfx with multithreaded configuration" ON)
option(BGFX_CONFIG_RENDERER_WEBGPU "Enable the webgpu renderer" OFF)
Expand Down
1 change: 1 addition & 0 deletions cmake/bgfx/bgfx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ endif()

if(BGFX_WITH_WAYLAND)
target_compile_definitions(bgfx PRIVATE "WL_EGL_PLATFORM=1")
target_link_libraries(bgfx PRIVATE wayland-egl)
endif()

set(BGFX_CONFIG_OPTIONS "")
Expand Down
9 changes: 7 additions & 2 deletions cmake/bgfx/examples.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,19 @@ function(add_example ARG_NAME)
target_link_libraries(
example-${ARG_NAME} PUBLIC bgfx bx bimg bimg_decode ${DEAR_IMGUI_LIBRARIES} ${MESHOPTIMIZER_LIBRARIES}
)

if(BGFX_WITH_WAYLAND)
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_WAYLAND=1)
endif()

if(BGFX_WITH_GLFW)
find_package(glfw3 REQUIRED)
target_link_libraries(example-${ARG_NAME} PUBLIC glfw)
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_GLFW)
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_GLFW=1)
elseif(BGFX_WITH_SDL)
find_package(SDL2 REQUIRED)
target_link_libraries(example-${ARG_NAME} PUBLIC ${SDL2_LIBRARIES})
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_SDL)
target_compile_definitions(example-${ARG_NAME} PUBLIC ENTRY_CONFIG_USE_SDL=1)
elseif(UNIX AND NOT APPLE AND NOT ANDROID)
target_link_libraries(example-${ARG_NAME} PUBLIC X11)
endif()
Expand Down
Loading