Blob Blame History Raw
From f7d3671a0fcad0f5371ce60916394e0269c5cee3 Mon Sep 17 00:00:00 2001
From: Emmanuele Bassi <ebassi@gnome.org>
Date: Thu, 9 Mar 2017 21:28:52 +0000
Subject: [PATCH 6/6] Prefer using pkg-config files to find GLES

Just like we do for GL and EGL, we can use pkg-config to find the GLES
v2 and v1 dependencies.

Fixes: #110
---
 meson.build | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index afe576b..a513f5f 100644
--- a/meson.build
+++ b/meson.build
@@ -166,8 +166,19 @@ egl_dep = dependency('egl', required: false)
 
 # Optional dependencies for tests
 x11_dep = dependency('x11', required: false)
-gles1_dep = cc.find_library('libGLESv1_CM', required: false)
-gles2_dep = cc.find_library('libGLESv2', required: false)
+
+# GLES v2 and v1 may have pkg-config files, courtesy of downstream
+# packagers; let's check those first, and fall back to find_library()
+# if we fail
+gles2_dep = dependency('glesv2', required: false)
+if not gles2_dep.found()
+  gles2_dep = cc.find_library('libGLESv2', required: false)
+endif
+
+gles1_dep = dependency('glesv1_cm', required: false)
+if not gles1_dep.found()
+  gles1_dep = cc.find_library('libGLESv1_CM', required: false)
+endif
 
 # On windows, the DLL has to have all of its functions
 # resolved at link time, so we have to link directly aginst
-- 
2.12.0