infra: added opengl_es extra option for explicit selection

usages:
meson setup build -Dengines="gl"  //opengl
meson setup build -Dengines="gl" -Dextra="opengl_es"  //opengl es
This commit is contained in:
Hermet Park 2025-05-08 16:46:40 +09:00 committed by Sergii Liebodkin
parent 457b019ab4
commit 0b77659136
6 changed files with 25 additions and 34 deletions

View file

@ -4,7 +4,7 @@ if lib_type == 'static'
examples_compiler_flags += ['-DTVG_STATIC']
endif
if target_opengles
if gl_variant == 'OpenGL ES'
examples_compiler_flags += '-DTHORVG_GL_TARGET_GLES=1'
endif

View file

@ -132,6 +132,18 @@ if lottie_expressions
config_h.set10('THORVG_LOTTIE_EXPRESSIONS_SUPPORT', true)
endif
gl_variant = ''
if gl_engine
if get_option('extra').contains('opengl_es')
gl_variant = 'OpenGL ES'
else
gl_variant = 'OpenGL'
endif
else
gl_variant = 'None'
endif
#Miscellaneous
config_h.set10('WIN32_LEAN_AND_MEAN', true)
@ -142,9 +154,6 @@ configure_file(
headers = [include_directories('inc'), include_directories('.')]
#OpenGL profile: OpenGLES(true) or OpenGL(false), confirmed by gl_engine
target_opengles = false
subdir('inc')
subdir('src')
subdir('tools')
@ -183,6 +192,7 @@ Summary:
Tool (Svg2Png): @20@
Tool (Lottie2Gif): @21@
Extra (Lottie Expressions): @22@
Extra (OpenGL Variant): @23@
'''.format(
meson.project_version(),
@ -207,7 +217,8 @@ Summary:
get_option('examples'),
svg2png,
lottie2gif,
lottie_expressions
lottie_expressions,
gl_variant
)
message(summary)

View file

@ -65,6 +65,6 @@ option('file',
option('extra',
type: 'array',
choices: ['', 'lottie_expressions'],
choices: ['', 'opengl_es', 'lottie_expressions'],
value: ['lottie_expressions'],
description: '"Enable support for exceptionally advanced features')
description: '"Enable support for extra options')

View file

@ -24,39 +24,19 @@ source_file = [
'tvgGlTessellator.h',
]
if host_machine.system() == 'darwin'
gl_dep = declare_dependency(link_args: ['-framework', 'OpenGL'])
compiler_flags += ['-Wno-deprecated'] #for deprecated opengl
elif cc.get_id() == 'emscripten'
target_opengles = true
gl_dep = dependency('GLESv3', required: false)
#force to use gles
if cc.get_id() == 'emscripten'
gl_variant = 'OpenGL ES'
endif
if gl_variant == 'OpenGL ES'
gl_variant_profile = '-DTHORVG_GL_TARGET_GLES=1'
else
#find a opengl library with fallbacks
gl_dep = dependency('GL', required: false)
if not gl_dep.found()
gl_dep = meson.get_compiler('cpp').find_library('GL', required: false)
endif
if not gl_dep.found()
gl_dep = dependency('GLESv3', required: false)
target_opengles = true
endif
if not gl_dep.found()
gl_dep = meson.get_compiler('cpp').find_library('GLESv3')
target_opengles = true
endif
endif
if target_opengles
gl_target_profile = '-DTHORVG_GL_TARGET_GLES=1'
else
gl_target_profile = '-DTHORVG_GL_TARGET_GL=1'
gl_variant_profile = '-DTHORVG_GL_TARGET_GL=1'
endif
engine_dep += [declare_dependency(
compile_args : gl_target_profile,
compile_args : gl_variant_profile,
include_directories : include_directories('.'),
sources : source_file,
)]

0
src/renderer/gl_engine/tvgGl.cpp Executable file → Normal file
View file

0
src/renderer/gl_engine/tvgGl.h Executable file → Normal file
View file