mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
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:
parent
457b019ab4
commit
0b77659136
6 changed files with 25 additions and 34 deletions
|
@ -4,7 +4,7 @@ if lib_type == 'static'
|
||||||
examples_compiler_flags += ['-DTVG_STATIC']
|
examples_compiler_flags += ['-DTVG_STATIC']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if target_opengles
|
if gl_variant == 'OpenGL ES'
|
||||||
examples_compiler_flags += '-DTHORVG_GL_TARGET_GLES=1'
|
examples_compiler_flags += '-DTHORVG_GL_TARGET_GLES=1'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
19
meson.build
19
meson.build
|
@ -132,6 +132,18 @@ if lottie_expressions
|
||||||
config_h.set10('THORVG_LOTTIE_EXPRESSIONS_SUPPORT', true)
|
config_h.set10('THORVG_LOTTIE_EXPRESSIONS_SUPPORT', true)
|
||||||
endif
|
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
|
#Miscellaneous
|
||||||
config_h.set10('WIN32_LEAN_AND_MEAN', true)
|
config_h.set10('WIN32_LEAN_AND_MEAN', true)
|
||||||
|
|
||||||
|
@ -142,9 +154,6 @@ configure_file(
|
||||||
|
|
||||||
headers = [include_directories('inc'), include_directories('.')]
|
headers = [include_directories('inc'), include_directories('.')]
|
||||||
|
|
||||||
#OpenGL profile: OpenGLES(true) or OpenGL(false), confirmed by gl_engine
|
|
||||||
target_opengles = false
|
|
||||||
|
|
||||||
subdir('inc')
|
subdir('inc')
|
||||||
subdir('src')
|
subdir('src')
|
||||||
subdir('tools')
|
subdir('tools')
|
||||||
|
@ -183,6 +192,7 @@ Summary:
|
||||||
Tool (Svg2Png): @20@
|
Tool (Svg2Png): @20@
|
||||||
Tool (Lottie2Gif): @21@
|
Tool (Lottie2Gif): @21@
|
||||||
Extra (Lottie Expressions): @22@
|
Extra (Lottie Expressions): @22@
|
||||||
|
Extra (OpenGL Variant): @23@
|
||||||
|
|
||||||
'''.format(
|
'''.format(
|
||||||
meson.project_version(),
|
meson.project_version(),
|
||||||
|
@ -207,7 +217,8 @@ Summary:
|
||||||
get_option('examples'),
|
get_option('examples'),
|
||||||
svg2png,
|
svg2png,
|
||||||
lottie2gif,
|
lottie2gif,
|
||||||
lottie_expressions
|
lottie_expressions,
|
||||||
|
gl_variant
|
||||||
)
|
)
|
||||||
|
|
||||||
message(summary)
|
message(summary)
|
||||||
|
|
|
@ -65,6 +65,6 @@ option('file',
|
||||||
|
|
||||||
option('extra',
|
option('extra',
|
||||||
type: 'array',
|
type: 'array',
|
||||||
choices: ['', 'lottie_expressions'],
|
choices: ['', 'opengl_es', 'lottie_expressions'],
|
||||||
value: ['lottie_expressions'],
|
value: ['lottie_expressions'],
|
||||||
description: '"Enable support for exceptionally advanced features')
|
description: '"Enable support for extra options')
|
||||||
|
|
|
@ -24,39 +24,19 @@ source_file = [
|
||||||
'tvgGlTessellator.h',
|
'tvgGlTessellator.h',
|
||||||
]
|
]
|
||||||
|
|
||||||
if host_machine.system() == 'darwin'
|
#force to use gles
|
||||||
gl_dep = declare_dependency(link_args: ['-framework', 'OpenGL'])
|
if cc.get_id() == 'emscripten'
|
||||||
compiler_flags += ['-Wno-deprecated'] #for deprecated opengl
|
gl_variant = 'OpenGL ES'
|
||||||
elif cc.get_id() == 'emscripten'
|
|
||||||
target_opengles = true
|
|
||||||
gl_dep = dependency('GLESv3', required: false)
|
|
||||||
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
|
endif
|
||||||
|
|
||||||
if target_opengles
|
if gl_variant == 'OpenGL ES'
|
||||||
gl_target_profile = '-DTHORVG_GL_TARGET_GLES=1'
|
gl_variant_profile = '-DTHORVG_GL_TARGET_GLES=1'
|
||||||
else
|
else
|
||||||
gl_target_profile = '-DTHORVG_GL_TARGET_GL=1'
|
gl_variant_profile = '-DTHORVG_GL_TARGET_GL=1'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
engine_dep += [declare_dependency(
|
engine_dep += [declare_dependency(
|
||||||
compile_args : gl_target_profile,
|
compile_args : gl_variant_profile,
|
||||||
include_directories : include_directories('.'),
|
include_directories : include_directories('.'),
|
||||||
sources : source_file,
|
sources : source_file,
|
||||||
)]
|
)]
|
||||||
|
|
0
src/renderer/gl_engine/tvgGl.cpp
Executable file → Normal file
0
src/renderer/gl_engine/tvgGl.cpp
Executable file → Normal file
0
src/renderer/gl_engine/tvgGl.h
Executable file → Normal file
0
src/renderer/gl_engine/tvgGl.h
Executable file → Normal file
Loading…
Add table
Reference in a new issue