summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Engestrom <eric@engestrom.ch>2022-09-02 16:15:24 +0100
committerEric Engestrom <eric@engestrom.ch>2022-09-02 16:28:58 +0100
commit92a523d29d3dcedd8d45b31e9ec04e1c8243aa95 (patch)
tree7ec1fd84ba89c8aa5ffd8025ed444ccfd459d6c4
parent94bee60c016bfc55164715249d2bb724de095ea9 (diff)
downloadkmscube-92a523d29d3dcedd8d45b31e9ec04e1c8243aa95.tar.gz
make GLES3 optional
This means that `shadertoy` & `texturator` might not be supported in a given build. Signed-off-by: Eric Engestrom <eric@engestrom.ch>
-rw-r--r--common.h11
-rw-r--r--meson.build29
2 files changed, 30 insertions, 10 deletions
diff --git a/common.h b/common.h
index 7c41fee..c5d624a 100644
--- a/common.h
+++ b/common.h
@@ -175,7 +175,18 @@ enum mode {
const struct egl * init_cube_smooth(const struct gbm *gbm, int samples);
const struct egl * init_cube_tex(const struct gbm *gbm, enum mode mode, int samples);
+
+#ifdef HAVE_GLES3
const struct egl * init_cube_shadertoy(const struct gbm *gbm, const char *shadertoy, int samples);
+#else
+static inline const struct egl *
+init_cube_shadertoy(const struct gbm *gbm, const char *shadertoy, int samples)
+{
+ (void)gbm; (void)shadertoy; (void)samples;
+ printf("no GLES3 support!\n");
+ return NULL;
+}
+#endif
#ifdef HAVE_GST
diff --git a/meson.build b/meson.build
index 4fca2f2..518006f 100644
--- a/meson.build
+++ b/meson.build
@@ -35,7 +35,6 @@ endif
sources = files(
'common.c',
- 'cube-shadertoy.c',
'cube-smooth.c',
'cube-tex.c',
'drm-atomic.c',
@@ -55,13 +54,22 @@ dep_libdrm = dependency('libdrm', version : '>=2.4.71')
dep_gbm = dependency('gbm', version : '>=13.0')
dep_egl = dependency('egl')
dep_gles2 = dependency('glesv2')
+dep_gles3 = dependency('glesv2', version : '>= 3', required : false)
+
+if dep_gles3.found()
+ sources += files('cube-shadertoy.c')
+ add_project_arguments('-DHAVE_GLES3', language : 'c')
+ message('GLES3 supported; shadertoy & texturator are included in this build')
+else
+ message('GLES3 not supported; shadertoy & texturator are NOT included in this build')
+endif
+
dep_libpng = dependency('libpng', required : false)
if dep_libpng.found()
add_project_arguments('-DHAVE_LIBPNG', language : 'c')
endif
-
dep_common = [dep_m, dep_threads, dep_libdrm, dep_gbm, dep_egl, dep_gles2, dep_libpng]
dep_gst = []
@@ -95,11 +103,12 @@ endif
executable('kmscube', sources, dependencies : dep_common, install : true)
-
-executable('texturator', files(
- 'common.c',
- 'drm-legacy.c',
- 'drm-common.c',
- 'perfcntrs.c', # not used, but required to link
- 'texturator.c',
-), dependencies : dep_common, install : true)
+if dep_gles3.found()
+ executable('texturator', files(
+ 'common.c',
+ 'drm-legacy.c',
+ 'drm-common.c',
+ 'perfcntrs.c', # not used, but required to link
+ 'texturator.c',
+ ), dependencies : dep_common, install : true)
+endif