build: enforcing saver/loader usage for given tool

Selecting a tool without choosing the required tools
resulted in a usage error. Now, the activation
of the appropriate saver/loader for a given tool
is enforced.
This commit is contained in:
Mira Grudzinska 2024-04-16 15:12:14 +02:00 committed by Hermet Park
parent c778f451b1
commit 568846491d
4 changed files with 48 additions and 47 deletions

View file

@ -61,7 +61,7 @@ source_file = [
] ]
if get_option('loaders').contains('all') == true or get_option('loaders').contains('lottie') == true if lottie_loader
source_file += 'LottieExtension.cpp' source_file += 'LottieExtension.cpp'
endif endif

View file

@ -32,53 +32,61 @@ if get_option('engines').contains('wg_beta') == true
endif endif
#Loaders #Loaders
all_loaders = false all_loaders = get_option('loaders').contains('all')
svg_loader = all_loaders or get_option('loaders').contains('svg')
tvg_loader = all_loaders or get_option('loaders').contains('tvg')
png_loader = all_loaders or get_option('loaders').contains('png')
jpg_loader = all_loaders or get_option('loaders').contains('jpg')
lottie_loader = all_loaders or get_option('loaders').contains('lottie')
ttf_loader = all_loaders or get_option('loaders').contains('ttf')
webp_loader = all_loaders or get_option('loaders').contains('webp')
if get_option('loaders').contains('all') == true #Savers
all_loaders = true all_savers = get_option('savers').contains('all')
endif tvg_saver = all_savers or get_option('savers').contains('tvg')
gif_saver = all_savers or get_option('savers').contains('gif')
if all_loaders or get_option('loaders').contains('svg') == true #Tools
all_tools = get_option('tools').contains('all')
svg_loader = svg_loader or all_tools or get_option('tools').contains('svg')
lottie_loader = lottie_loader or all_tools or get_option('tools').contains('lottie')
tvg_saver = tvg_saver or all_tools or get_option('tools').contains('tvg')
gif_saver = gif_saver or all_tools or get_option('tools').contains('gif')
#Loaders/savers/tools config
if svg_loader
config_h.set10('THORVG_SVG_LOADER_SUPPORT', true) config_h.set10('THORVG_SVG_LOADER_SUPPORT', true)
endif endif
if all_loaders or get_option('loaders').contains('tvg') == true if tvg_loader
config_h.set10('THORVG_TVG_LOADER_SUPPORT', true) config_h.set10('THORVG_TVG_LOADER_SUPPORT', true)
endif endif
if all_loaders or get_option('loaders').contains('png') == true if png_loader
config_h.set10('THORVG_PNG_LOADER_SUPPORT', true) config_h.set10('THORVG_PNG_LOADER_SUPPORT', true)
endif endif
if all_loaders or get_option('loaders').contains('jpg') == true if jpg_loader
config_h.set10('THORVG_JPG_LOADER_SUPPORT', true) config_h.set10('THORVG_JPG_LOADER_SUPPORT', true)
endif endif
if all_loaders or get_option('loaders').contains('lottie') == true if lottie_loader
config_h.set10('THORVG_LOTTIE_LOADER_SUPPORT', true) config_h.set10('THORVG_LOTTIE_LOADER_SUPPORT', true)
endif endif
if all_loaders or get_option('loaders').contains('ttf') == true if ttf_loader
config_h.set10('THORVG_TTF_LOADER_SUPPORT', true) config_h.set10('THORVG_TTF_LOADER_SUPPORT', true)
endif endif
if all_loaders or get_option('loaders').contains('webp') == true if webp_loader
config_h.set10('THORVG_WEBP_LOADER_SUPPORT', true) config_h.set10('THORVG_WEBP_LOADER_SUPPORT', true)
endif endif
if tvg_saver
#Savers
all_savers = false
if get_option('savers').contains('all') == true
all_savers = true
endif
if all_savers or get_option('savers').contains('tvg') == true
config_h.set10('THORVG_TVG_SAVER_SUPPORT', true) config_h.set10('THORVG_TVG_SAVER_SUPPORT', true)
endif endif
if all_savers or get_option('savers').contains('gif') == true if gif_saver
config_h.set10('THORVG_GIF_SAVER_SUPPORT', true) config_h.set10('THORVG_GIF_SAVER_SUPPORT', true)
endif endif
@ -112,13 +120,6 @@ if get_option('log') == true
config_h.set10('THORVG_LOG_ENABLED', true) config_h.set10('THORVG_LOG_ENABLED', true)
endif endif
#Tools
all_tools = false
if get_option('tools').contains('all') == true
all_tools = true
endif
configure_file( configure_file(
output: 'config.h', output: 'config.h',
@ -176,15 +177,15 @@ Summary:
get_option('engines').contains('sw'), get_option('engines').contains('sw'),
get_option('engines').contains('gl_beta'), get_option('engines').contains('gl_beta'),
get_option('engines').contains('wg_beta'), get_option('engines').contains('wg_beta'),
all_loaders or get_option('loaders').contains('tvg'), tvg_loader,
all_loaders or get_option('loaders').contains('svg'), svg_loader,
all_loaders or get_option('loaders').contains('ttf'), ttf_loader,
all_loaders or get_option('loaders').contains('lottie'), lottie_loader,
all_loaders or get_option('loaders').contains('png'), png_loader,
all_loaders or get_option('loaders').contains('jpg'), jpg_loader,
all_loaders or get_option('loaders').contains('webp'), webp_loader,
all_savers or get_option('savers').contains('tvg'), tvg_saver,
all_savers or get_option('savers').contains('gif'), gif_saver,
get_option('bindings').contains('capi'), get_option('bindings').contains('capi'),
get_option('bindings').contains('wasm_beta'), get_option('bindings').contains('wasm_beta'),
get_option('log'), get_option('log'),

View file

@ -1,22 +1,22 @@
subloader_dep = [] subloader_dep = []
if all_loaders or get_option('loaders').contains('tvg') == true if tvg_loader
subdir('tvg') subdir('tvg')
endif endif
if all_loaders or get_option('loaders').contains('svg') == true if svg_loader
subdir('svg') subdir('svg')
endif endif
if all_loaders or get_option('loaders').contains('ttf') == true if ttf_loader
subdir('ttf') subdir('ttf')
endif endif
if all_loaders or get_option('loaders').contains('lottie') == true if lottie_loader
subdir('lottie') subdir('lottie')
endif endif
if all_loaders or get_option('loaders').contains('png') == true if png_loader
if get_option('static') == true if get_option('static') == true
subdir('png') subdir('png')
else else
@ -27,7 +27,7 @@ if all_loaders or get_option('loaders').contains('png') == true
endif endif
endif endif
if all_loaders or get_option('loaders').contains('jpg') == true if jpg_loader
if get_option('static') == true if get_option('static') == true
subdir('jpg') subdir('jpg')
else else
@ -38,7 +38,7 @@ if all_loaders or get_option('loaders').contains('jpg') == true
endif endif
endif endif
if all_loaders or get_option('loaders').contains('webp') == true if webp_loader
if get_option('static') == true if get_option('static') == true
subdir('webp') subdir('webp')
else else

View file

@ -1,10 +1,10 @@
subsaver_dep = [] subsaver_dep = []
if all_savers or get_option('savers').contains('tvg') == true if tvg_saver
subdir('tvg') subdir('tvg')
endif endif
if all_savers or get_option('savers').contains('gif') == true if gif_saver
subdir('gif') subdir('gif')
endif endif