Skip to content

Commit b6ca47e

Browse files
oomekmickelsonsubstring
authored andcommitted
DRM Implementation
Ported sfml-pi DRM/KMS backend written by @mickelson Port co-authored by @substring Co-authored-by: Andrew Mickelson <[email protected]> Co-authored-by: Gil Delescluse <[email protected]>
1 parent f7c88ee commit b6ca47e

27 files changed

+3041
-54
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,17 @@ jobs:
3131
config: { name: x86, flags: -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r18b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 }
3232
- platform: { name: Android, os: ubuntu-latest }
3333
config: { name: armeabi-v7a, flags: -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r18b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 }
34+
- platform: { name: Linux GCC, os: ubuntu-latest }
35+
config: { name: Static DRM, flags: -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_DRM=TRUE }
36+
- platform: { name: Linux GCC, os: ubuntu-latest }
37+
config: { name: Shared DRM, flags: -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_DRM=TRUE }
3438
steps:
3539
- name: Checkout Code
3640
uses: actions/checkout@v2
3741

3842
- name: Install Linux Dependencies
3943
if: runner.os == 'Linux'
40-
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev
44+
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev
4145

4246

4347
- name: Install Android Components

cmake/Modules/FindDRM.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#
2+
# Try to find EGL library and include path.
3+
# Once done this will define
4+
#
5+
# DRM_FOUND
6+
# DRM_INCLUDE_PATH
7+
# DRM_LIBRARY
8+
#
9+
10+
if(PKG_CONFIG_FOUND)
11+
pkg_check_modules(PC_DRM drm QUIET)
12+
endif()
13+
14+
find_path(DRM_INCLUDE_DIR NAMES libdrm/drm.h)
15+
find_library(DRM_LIBRARY NAMES drm)
16+
17+
include(FindPackageHandleStandardArgs)
18+
find_package_handle_standard_args(DRM DEFAULT_MSG DRM_LIBRARY DRM_INCLUDE_DIR)

cmake/Modules/FindGBM.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#
2+
# Try to find GBM library and include path.
3+
# Once done this will define
4+
#
5+
# GBM_FOUND
6+
# GBM_INCLUDE_PATH
7+
# GBM_LIBRARY
8+
#
9+
10+
if(PKG_CONFIG_FOUND)
11+
pkg_check_modules(PC_GBM gbm QUIET)
12+
endif()
13+
14+
find_path(GBM_INCLUDE_DIR NAMES gbm.h)
15+
find_library(GBM_LIBRARY NAMES gbm)
16+
17+
include(FindPackageHandleStandardArgs)
18+
find_package_handle_standard_args(GBM DEFAULT_MSG GBM_LIBRARY GBM_INCLUDE_DIR)

examples/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ if(SFML_BUILD_GRAPHICS)
3131
if(SFML_OS_WINDOWS)
3232
add_subdirectory(win32)
3333
elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD)
34-
add_subdirectory(X11)
34+
if(NOT SFML_USE_DRM)
35+
add_subdirectory(X11)
36+
endif()
3537
elseif(SFML_OS_MACOSX AND ${CMAKE_GENERATOR} MATCHES "Xcode")
3638
add_subdirectory(cocoa)
3739
endif()

examples/window/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ sfml_add_example(window GUI_APP
1010
DEPENDS sfml-window)
1111

1212
# external dependency headers
13-
target_include_directories(window SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/examples/window)
13+
target_include_directories(window SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/examples/window)

0 commit comments

Comments
 (0)