From 46990f2d85d1e8cbe081723dbc1e79523d1dba80 Mon Sep 17 00:00:00 2001 From: rogerman Date: Thu, 1 Aug 2024 17:51:12 -0700 Subject: [PATCH] Fix some issues with Meson build scripts. (Regression from commit ca566eb.) --- desmume/src/frontend/interface/meson.build | 40 ++++++++++++++----- .../src/frontend/interface/meson_options.txt | 10 +++++ desmume/src/frontend/posix/gtk/meson.build | 6 --- desmume/src/frontend/posix/gtk2/meson.build | 6 --- 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/desmume/src/frontend/interface/meson.build b/desmume/src/frontend/interface/meson.build index 6a62fbb2e..4de8d1d17 100644 --- a/desmume/src/frontend/interface/meson.build +++ b/desmume/src/frontend/interface/meson.build @@ -15,11 +15,18 @@ dep_sdl = dependency('sdl2') dep_pcap = dependency('pcap') dep_zlib = dependency('zlib') dep_threads = dependency('threads') -dep_gl = dependency('gl', required: false) dep_openal = dependency('openal', required: get_option('openal')) dep_alsa = dependency('alsa', required: false) dep_soundtouch = dependency('soundtouch', required: false) +if host_machine.system() == 'darwin' + dep_gl = dependency('appleframeworks', modules: 'OpenGL') + dep_gles = dependency('appleframeworks', modules: 'OpenGLES') +else + dep_gl = dependency('gl', required: false) + dep_gles = dependency('glesv2', required: false) +endif + if get_option('wifi') add_global_arguments('-DEXPERIMENTAL_WIFI_COMM', language: ['c', 'cpp']) endif @@ -173,14 +180,29 @@ if have_jit ] endif -if host_machine.system() == 'darwin' - dependencies += dependency('appleframeworks', modules: 'OpenGL') -elif dep_gl.found() - dependencies += dep_gl - libdesmume_src += [ - '../../OGLRender.cpp', - '../../OGLRender_3_2.cpp', - ] +if get_option('opengles') + if dep_gles.found() + add_global_arguments('-DENABLE_OPENGL_ES', language: ['c', 'cpp']) + dependencies += dep_gles + libdesmume_src += [ + '../../OGLRender.cpp', + '../../OGLRender_3_2.cpp', + '../../OGLRender_ES3.cpp', + ] + else + message('Cannot build with OpenGL ES -- library not found.') + endif +elif get_option('opengl') + if dep_gl.found() + add_global_arguments('-DENABLE_OPENGL_STANDARD', language: ['c', 'cpp']) + dependencies += dep_gl + libdesmume_src += [ + '../../OGLRender.cpp', + '../../OGLRender_3_2.cpp', + ] + else + message('Cannot build with OpenGL -- library not found.') + endif endif if dep_openal.found() diff --git a/desmume/src/frontend/interface/meson_options.txt b/desmume/src/frontend/interface/meson_options.txt index 1deece7f0..459cac8ff 100644 --- a/desmume/src/frontend/interface/meson_options.txt +++ b/desmume/src/frontend/interface/meson_options.txt @@ -1,3 +1,13 @@ +option('opengl', + type: 'boolean', + value: false, + description: 'Build for OpenGL', +) +option('opengles', + type: 'boolean', + value: false, + description: 'Build for OpenGL ES', +) option('openal', type: 'boolean', value: false, diff --git a/desmume/src/frontend/posix/gtk/meson.build b/desmume/src/frontend/posix/gtk/meson.build index 2bdc70356..42c3c797b 100644 --- a/desmume/src/frontend/posix/gtk/meson.build +++ b/desmume/src/frontend/posix/gtk/meson.build @@ -25,20 +25,14 @@ desmume_src = [ ] if get_option('glx') and dep_glx.found() - add_global_arguments('-DENABLE_GLX', language: ['c', 'cpp']) - dependencies += dep_glx desmume_src += [ '../shared/glx_3Demu.cpp', ] elif get_option('osmesa') and dep_osmesa.found() - add_global_arguments('-DENABLE_OSMESA', language: ['c', 'cpp']) - dependencies += dep_osmesa desmume_src += [ '../shared/osmesa_3Demu.cpp', ] elif get_option('egl') and dep_egl.found() - add_global_arguments('-DENABLE_EGL', language: ['c', 'cpp']) - dependencies += dep_egl desmume_src += [ '../shared/egl_3Demu.cpp', ] diff --git a/desmume/src/frontend/posix/gtk2/meson.build b/desmume/src/frontend/posix/gtk2/meson.build index 8420302d2..e0d4fb01c 100644 --- a/desmume/src/frontend/posix/gtk2/meson.build +++ b/desmume/src/frontend/posix/gtk2/meson.build @@ -18,20 +18,14 @@ desmume_src = [ ] if get_option('glx') and dep_glx.found() - add_global_arguments('-DENABLE_GLX', language: ['c', 'cpp']) - dependencies += dep_glx desmume_src += [ '../shared/glx_3Demu.cpp', ] elif get_option('osmesa') and dep_osmesa.found() - add_global_arguments('-DENABLE_OSMESA', language: ['c', 'cpp']) - dependencies += dep_osmesa desmume_src += [ '../shared/osmesa_3Demu.cpp', ] elif get_option('egl') and dep_egl.found() - add_global_arguments('-DENABLE_EGL', language: ['c', 'cpp']) - dependencies += dep_egl desmume_src += [ '../shared/egl_3Demu.cpp', ]