mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
build: Remove redundant comparisons
If a Meson option is typed as `boolean`, the `get_option` returns a boolean, and comparing it with `true` is redundant. Meson also errors if you try to compare across types, so it couldn't _not_ be a boolean. Also, Meson is not C, so no need for parentheses around `if` conditions.
This commit is contained in:
parent
199dbac419
commit
ee19753f36
8 changed files with 23 additions and 23 deletions
|
@ -1,4 +1,4 @@
|
||||||
if (lib_type == 'static')
|
if lib_type == 'static'
|
||||||
compiler_flags += ['-DTVG_STATIC']
|
compiler_flags += ['-DTVG_STATIC']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ endif
|
||||||
|
|
||||||
examples_dep = [dependency('sdl2')]
|
examples_dep = [dependency('sdl2')]
|
||||||
|
|
||||||
if (get_option('engines').contains('wg_beta'))
|
if get_option('engines').contains('wg_beta')
|
||||||
examples_dep += dependency('wgpu_native')
|
examples_dep += dependency('wgpu_native')
|
||||||
if host_machine.system() == 'darwin'
|
if host_machine.system() == 'darwin'
|
||||||
add_languages('objcpp')
|
add_languages('objcpp')
|
||||||
|
@ -93,7 +93,7 @@ foreach current_file : source_file
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
|
||||||
if get_option('bindings').contains('capi') == true
|
if get_option('bindings').contains('capi')
|
||||||
capi_source_file = [
|
capi_source_file = [
|
||||||
'Capi.cpp'
|
'Capi.cpp'
|
||||||
]
|
]
|
||||||
|
|
14
meson.build
14
meson.build
|
@ -14,7 +14,7 @@ add_project_arguments('-DEXAMPLE_DIR="@0@/examples/resources"'.format(src_dir),
|
||||||
config_h.set_quoted('THORVG_VERSION_STRING', meson.project_version())
|
config_h.set_quoted('THORVG_VERSION_STRING', meson.project_version())
|
||||||
|
|
||||||
#Multi-Tasking
|
#Multi-Tasking
|
||||||
if get_option('threads') == true
|
if get_option('threads')
|
||||||
config_h.set10('THORVG_THREAD_SUPPORT', true)
|
config_h.set10('THORVG_THREAD_SUPPORT', true)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ endif
|
||||||
#Vectorization
|
#Vectorization
|
||||||
simd_type = 'none'
|
simd_type = 'none'
|
||||||
|
|
||||||
if get_option('simd') == true
|
if get_option('simd')
|
||||||
if host_machine.cpu_family().startswith('x86')
|
if host_machine.cpu_family().startswith('x86')
|
||||||
config_h.set10('THORVG_AVX_VECTOR_SUPPORT', true)
|
config_h.set10('THORVG_AVX_VECTOR_SUPPORT', true)
|
||||||
simd_type = 'avx'
|
simd_type = 'avx'
|
||||||
|
@ -114,16 +114,16 @@ if get_option('simd') == true
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#Bindings
|
#Bindings
|
||||||
if get_option('bindings').contains('capi') == true
|
if get_option('bindings').contains('capi')
|
||||||
config_h.set10('THORVG_CAPI_BINDING_SUPPORT', true)
|
config_h.set10('THORVG_CAPI_BINDING_SUPPORT', true)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('bindings').contains('wasm_beta') == true
|
if get_option('bindings').contains('wasm_beta')
|
||||||
config_h.set10('THORVG_WASM_BINDING_SUPPORT', true)
|
config_h.set10('THORVG_WASM_BINDING_SUPPORT', true)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#Log
|
#Log
|
||||||
if get_option('log') == true
|
if get_option('log')
|
||||||
config_h.set10('THORVG_LOG_ENABLED', true)
|
config_h.set10('THORVG_LOG_ENABLED', true)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -151,11 +151,11 @@ subdir('inc')
|
||||||
subdir('src')
|
subdir('src')
|
||||||
subdir('tools')
|
subdir('tools')
|
||||||
|
|
||||||
if get_option('examples') == true
|
if get_option('examples')
|
||||||
subdir('examples')
|
subdir('examples')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('tests') == true
|
if get_option('tests')
|
||||||
subdir('test')
|
subdir('test')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
if get_option('bindings').contains('capi') == true
|
if get_option('bindings').contains('capi')
|
||||||
subdir('capi')
|
subdir('capi')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('bindings').contains('wasm_beta') == true
|
if get_option('bindings').contains('wasm_beta')
|
||||||
subdir('wasm')
|
subdir('wasm')
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
if (cc.get_id() == 'emscripten')
|
if cc.get_id() == 'emscripten'
|
||||||
source_file = files('tvgWasmLottieAnimation.cpp')
|
source_file = files('tvgWasmLottieAnimation.cpp')
|
||||||
thorvg_wasm_dep = declare_dependency(include_directories
|
thorvg_wasm_dep = declare_dependency(include_directories
|
||||||
: include_directories('.'), sources
|
: include_directories('.'), sources
|
||||||
|
|
|
@ -17,7 +17,7 @@ if lottie_loader
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if png_loader
|
if png_loader
|
||||||
if get_option('static') == true
|
if get_option('static')
|
||||||
subdir('png')
|
subdir('png')
|
||||||
else
|
else
|
||||||
subdir('external_png')
|
subdir('external_png')
|
||||||
|
@ -28,7 +28,7 @@ if png_loader
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if jpg_loader
|
if jpg_loader
|
||||||
if get_option('static') == true
|
if get_option('static')
|
||||||
subdir('jpg')
|
subdir('jpg')
|
||||||
else
|
else
|
||||||
subdir('external_jpg')
|
subdir('external_jpg')
|
||||||
|
@ -39,7 +39,7 @@ if jpg_loader
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if webp_loader
|
if webp_loader
|
||||||
if get_option('static') == true
|
if get_option('static')
|
||||||
subdir('webp')
|
subdir('webp')
|
||||||
else
|
else
|
||||||
subdir('external_webp')
|
subdir('external_webp')
|
||||||
|
|
|
@ -3,14 +3,14 @@ override_options = []
|
||||||
|
|
||||||
lib_type = get_option('default_library')
|
lib_type = get_option('default_library')
|
||||||
|
|
||||||
if (lib_type == 'shared')
|
if lib_type == 'shared'
|
||||||
compiler_flags += ['-DTVG_EXPORT', '-DTVG_BUILD']
|
compiler_flags += ['-DTVG_EXPORT', '-DTVG_BUILD']
|
||||||
else
|
else
|
||||||
compiler_flags += ['-DTVG_STATIC']
|
compiler_flags += ['-DTVG_STATIC']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cc = meson.get_compiler('cpp')
|
cc = meson.get_compiler('cpp')
|
||||||
if (cc.get_id() == 'clang-cl')
|
if cc.get_id() == 'clang-cl'
|
||||||
if simd_type == 'avx'
|
if simd_type == 'avx'
|
||||||
compiler_flags += ['/clang:-mavx']
|
compiler_flags += ['/clang:-mavx']
|
||||||
endif
|
endif
|
||||||
|
@ -44,7 +44,7 @@ subdir('savers')
|
||||||
|
|
||||||
thorvg_lib_dep = [common_dep, utils_dep, loader_dep, saver_dep]
|
thorvg_lib_dep = [common_dep, utils_dep, loader_dep, saver_dep]
|
||||||
|
|
||||||
if get_option('threads') == true and host_machine.system() != 'windows' and host_machine.system() != 'android'
|
if get_option('threads') and host_machine.system() != 'windows' and host_machine.system() != 'android'
|
||||||
thread_dep = meson.get_compiler('cpp').find_library('pthread')
|
thread_dep = meson.get_compiler('cpp').find_library('pthread')
|
||||||
thorvg_lib_dep += [thread_dep]
|
thorvg_lib_dep += [thread_dep]
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
if (lib_type == 'static')
|
if lib_type == 'static'
|
||||||
compiler_flags += ['-DTVG_STATIC']
|
compiler_flags += ['-DTVG_STATIC']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -27,6 +27,6 @@ tests = executable('tvgUnitTests',
|
||||||
|
|
||||||
test('Unit Tests', tests, args : ['--success'])
|
test('Unit Tests', tests, args : ['--success'])
|
||||||
|
|
||||||
if get_option('bindings').contains('capi') == true
|
if get_option('bindings').contains('capi')
|
||||||
subdir('capi')
|
subdir('capi')
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
if (lib_type == 'static')
|
if lib_type == 'static'
|
||||||
compiler_flags += ['-DTVG_STATIC']
|
compiler_flags += ['-DTVG_STATIC']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -12,4 +12,4 @@ endif
|
||||||
|
|
||||||
if lottie2gif
|
if lottie2gif
|
||||||
subdir('lottie2gif')
|
subdir('lottie2gif')
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue