]> code.ossystems Code Review - openembedded-core.git/commitdiff
libsdl2: fix build if egl.pc sets macros in cflags
authorMax Krummenacher <max.oss.09@gmail.com>
Tue, 11 Jan 2022 12:57:27 +0000 (13:57 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 12 Jan 2022 21:05:28 +0000 (21:05 +0000)
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-graphics/libsdl2/libsdl2/0001-sdlchecks.cmake-pass-cflags-to-the-appropriate-cmake.patch [new file with mode: 0644]
meta/recipes-graphics/libsdl2/libsdl2_2.0.18.bb

diff --git a/meta/recipes-graphics/libsdl2/libsdl2/0001-sdlchecks.cmake-pass-cflags-to-the-appropriate-cmake.patch b/meta/recipes-graphics/libsdl2/libsdl2/0001-sdlchecks.cmake-pass-cflags-to-the-appropriate-cmake.patch
new file mode 100644 (file)
index 0000000..e5d6cda
--- /dev/null
@@ -0,0 +1,46 @@
+From dbf0a3f6ea77a1d5f5e3c4dec7a22fcc09a49537 Mon Sep 17 00:00:00 2001
+From: Max Krummenacher <max.krummenacher@toradex.com>
+Date: Mon, 10 Jan 2022 21:52:02 +0000
+Subject: [PATCH] cmake: sdlchecks.cmake: pass cflags to the appropriate cmake
+ variable
+
+If egl.pc sets at least two macros as the i.MX Vivante driver does, e.g.:
+| Cflags: -I${includedir} -DLINUX -DWL_EGL_PLATFORM
+
+then we get the following error during configuration:
+
+| -- Performing Test HAVE_OPENGL_EGL
+| CMake Error: Parse error in command line argument: WL_EGL_PLATFORM
+|  Should be: VAR:type=value
+
+If one changes to add a value to the macro, e.g.
+| Cflags: -I${includedir} -DLINUX=1 -DWL_EGL_PLATFORM=1
+then cmake does not error out but the macro is not passed to the
+C compiler.
+
+CMAKE_REQUIRED_FLAGS is the wrong variable to pass the CFLAGS in,
+CMAKE_REQUIRED_DEFINITIONS should be used.
+
+Upstream-Status: Submitted [https://github.com/libsdl-org/SDL/pull/5209]
+Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
+---
+ cmake/sdlchecks.cmake | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
+index 32be19c..f61b8df 100644
+--- a/cmake/sdlchecks.cmake
++++ b/cmake/sdlchecks.cmake
+@@ -808,8 +808,7 @@ endmacro()
+ macro(CheckEGL)
+   if (SDL_OPENGL OR SDL_OPENGLES)
+     pkg_check_modules(EGL egl)
+-    string(REPLACE "-D_THREAD_SAFE;" "-D_THREAD_SAFE=1;" EGL_CFLAGS "${EGL_CFLAGS}")
+-    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${EGL_CFLAGS}")
++    set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${EGL_CFLAGS}")
+     check_c_source_compiles("
+         #define EGL_API_FB
+         #define MESA_EGL_NO_X11_HEADERS
+-- 
+2.20.1
+
index 1559d5e9425e69a6fe69540da501af08d16dacdb..6c949d9604a5361aad65c0e4a5f7238a6e9a197c 100644 (file)
@@ -19,6 +19,7 @@ PROVIDES = "virtual/libsdl2"
 SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz \
            file://0001-Fix-build-against-wayland-1.20.patch \
            file://optional-libunwind-generic.patch \
+           file://0001-sdlchecks.cmake-pass-cflags-to-the-appropriate-cmake.patch \
 "
 
 S = "${WORKDIR}/SDL2-${PV}"