From b8cfe8c1eebe7c139133abe53eff740667990e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Thu, 26 Dec 2024 03:17:42 +0100 Subject: [PATCH] Linux: support EGL - skia library is now shared (CI/scripts needs fixes) - skia can now be built against EGL (USE_EGL=ON) Last changes for initial wayland support. Ref: #396 --- src/cmake/friction-common.cmake | 23 ++--------------------- src/core/appsupport.cpp | 3 ++- src/engine/CMakeLists.txt | 8 ++++++++ 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/cmake/friction-common.cmake b/src/cmake/friction-common.cmake index 70c4494d4..12c63d1c5 100644 --- a/src/cmake/friction-common.cmake +++ b/src/cmake/friction-common.cmake @@ -69,20 +69,6 @@ if(MSVC) add_definitions("/MP") endif() -if(UNIX AND NOT APPLE) - option(STATIC_FFMPEG "Link against static ffmpeg" OFF) - if(${STATIC_FFMPEG}) - set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic") - endif() -endif() - -if(NOT WIN32) - if ((NOT ${CMAKE_VERSION} VERSION_LESS 3.11) AND (NOT OpenGL_GL_PREFERENCE)) - set(OpenGL_GL_PREFERENCE "GLVND") - endif() - find_package(OpenGL REQUIRED) -endif() - find_package(PkgConfig QUIET) find_package(QT NAMES Qt5 COMPONENTS Core REQUIRED) find_package( @@ -117,13 +103,8 @@ if(WIN32) add_definitions(-DSKIA_DLL) set(SKIA_LIBRARIES_DIRS ${CMAKE_SOURCE_DIR}/sdk/bin) else() - if(APPLE) - set(SKIA_LIBRARIES skia) - else() - set(SKIA_LIBRARIES - skia - fontconfig - ${OPENGL_LIBRARY}) + set(SKIA_LIBRARIES skia) + if(UNIX AND NOT APPLE) pkg_check_modules(UNWIND REQUIRED libunwind) set(GPERF_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/../gperftools ${UNWIND_INCLUDE_DIRS}) set(GPERF_LIBRARIES tcmalloc_static ${UNWIND_LIBRARIES}) diff --git a/src/core/appsupport.cpp b/src/core/appsupport.cpp index a0c6c4ddb..f65498a93 100644 --- a/src/core/appsupport.cpp +++ b/src/core/appsupport.cpp @@ -991,8 +991,9 @@ void AppSupport::initEnv(const bool &isRenderer) if (isRenderer) { // Force Mesa if Renderer qputenv("LIBGL_ALWAYS_SOFTWARE", "1"); } - // Force XCB on Linux until we support Wayland +#ifdef PROJECT_OFFICIAL qputenv("QT_QPA_PLATFORM", isRenderer ? "offscreen" : "xcb"); +#endif #else Q_UNUSED(isRenderer) #endif diff --git a/src/engine/CMakeLists.txt b/src/engine/CMakeLists.txt index b4afb013a..ac774ad07 100644 --- a/src/engine/CMakeLists.txt +++ b/src/engine/CMakeLists.txt @@ -29,6 +29,10 @@ option(LINUX_DEPLOY "Linux Deploy" OFF) option(MAC_DEPLOY "Mac Deploy" OFF) option(SYNC_SKIA_DEPS "Sync third-party depends" ON) +if(UNIX AND NOT APPLE) + option(USE_EGL "Use EGL in skia" OFF) +endif() + set(SKIA_SRC "${CMAKE_CURRENT_SOURCE_DIR}/skia") set(SKIA_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/skia") @@ -72,6 +76,10 @@ else() endif() set(SKIA_ARGS "ar=\"${CMAKE_AR}\" cc=\"${CMAKE_C_COMPILER}\" cxx=\"${CMAKE_CXX_COMPILER}\"") if(UNIX AND NOT APPLE) + if(${USE_EGL}) + set(SKIA_ARGS "${SKIA_ARGS} skia_use_egl=true") + endif() + set(SKIA_ARGS "${SKIA_ARGS} is_component_build=true") if (${LINUX_DEPLOY}) set(SKIA_ARGS "${SKIA_ARGS} extra_cflags=[\"-Wno-error\"]") else()