From 9e725226da1561556435e34e81e488fa699297bf Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Fri, 2 Apr 2021 12:49:18 +0900 Subject: [PATCH] meson: revise png loader meson script. We hate spagettie code, not even build script. this revise it to keep the build script consistency. --- meson.build | 8 ++++---- meson_options.txt | 9 ++------- src/loaders/meson.build | 3 ++- src/loaders/png/meson.build | 3 +++ src/meson.build | 6 ------ 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/meson.build b/meson.build index b2cd9571..98d5a0d1 100644 --- a/meson.build +++ b/meson.build @@ -20,6 +20,10 @@ if get_option('loaders').contains('svg') == true config_h.set10('THORVG_SVG_LOADER_SUPPORT', true) endif +if get_option('loaders').contains('png') == true + config_h.set10('THORVG_PNG_LOADER_SUPPORT', true) +endif + if get_option('vectors').contains('avx') == true config_h.set10('THORVG_AVX_VECTOR_SUPPORT', true) endif @@ -33,10 +37,6 @@ if get_option('log') == true message('Enable Log') endif -if get_option('png') == true - config_h.set10('THORVG_PNG_LOADER_SUPPORT', true) -endif - configure_file( output: 'config.h', configuration: config_h diff --git a/meson_options.txt b/meson_options.txt index ca0bd3ed..f7fcc72e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -6,9 +6,9 @@ option('engines', option('loaders', type: 'array', - choices: ['', 'svg'], + choices: ['', 'svg', 'png'], value: ['svg'], - description: 'Enable Vector File Loader in thorvg') + description: 'Enable File Loaders in thorvg') option('vectors', type: 'array', @@ -33,11 +33,6 @@ option('examples', value: false, description: 'Enable building examples') -option('png', - type: 'boolean', - value: false, - description: 'Enable libpng based png loading') - option('test', type: 'boolean', value: false, diff --git a/src/loaders/meson.build b/src/loaders/meson.build index e858968d..daa65f1c 100644 --- a/src/loaders/meson.build +++ b/src/loaders/meson.build @@ -5,8 +5,9 @@ if get_option('loaders').contains('svg') == true message('Enable SVG Loader') endif -if get_option('png') == true +if get_option('loaders').contains('png') == true subdir('png') + message('Enable PNG Loader') endif subdir('raw') diff --git a/src/loaders/png/meson.build b/src/loaders/png/meson.build index 1de51742..4472b717 100755 --- a/src/loaders/png/meson.build +++ b/src/loaders/png/meson.build @@ -3,7 +3,10 @@ source_file = [ 'tvgPngLoader.cpp', ] +png_dep = meson.get_compiler('cpp').find_library('libpng') + subloader_dep += [declare_dependency( include_directories : include_directories('.'), + dependencies : png_dep, sources : source_file )] diff --git a/src/meson.build b/src/meson.build index 188c9da0..7e19d039 100644 --- a/src/meson.build +++ b/src/meson.build @@ -19,12 +19,6 @@ subdir('bindings') thread_dep = meson.get_compiler('cpp').find_library('pthread') thorvg_lib_dep = [common_dep, loader_dep, binding_dep, thread_dep] -if get_option('png') == true - message('Enable libpng based png loading') - png_dep = meson.get_compiler('cpp').find_library('libpng') - thorvg_lib_dep += png_dep -endif - thorvg_lib = library( 'thorvg', include_directories : headers,