thorvg/src/meson.build
Hermet Park 69063d2405 infra: specify TVG_API for both static/dynamic linking.
The previous meson script was incomplete,
therefore this change requires it to be revised.

To enable static linking use the next meson option.
"-Ddefault_library=static"

Issue: https://github.com/thorvg/thorvg/issues/1234
2023-04-22 18:32:22 +09:00

84 lines
2.3 KiB
Meson

compiler_flags = ['-DTVG_BUILD']
override_options = []
lib_type = get_option('default_library')
if (lib_type == 'shared')
compiler_flags += ['-DTVG_EXPORT']
endif
cc = meson.get_compiler('cpp')
if (cc.get_id() == 'clang-cl')
if simd_type == 'avx'
compiler_flags += ['/clang:-mavx']
endif
if simd_type == 'neon'
compiler_flags += ['/clang:-mfpu=neon']
endif
if get_option('b_sanitize') == 'none'
override_options += ['cpp_eh=none','cpp_rtti=false']
compiler_flags += ['/clang:-fno-math-errno',
'/clang:-Woverloaded-virtual', '/clang:-Wno-unused-value', '-Wno-deprecated-declarations']
endif
elif (cc.get_id() != 'msvc')
if simd_type == 'avx'
compiler_flags += ['-mavx']
endif
if simd_type == 'neon'
compiler_flags += ['-mfpu=neon']
endif
if get_option('b_sanitize') == 'none'
compiler_flags += ['-s', '-fno-exceptions', '-fno-rtti', '-fno-stack-protector', '-fno-math-errno',
'-fno-unwind-tables' , '-fno-asynchronous-unwind-tables',
'-Woverloaded-virtual', '-Wno-unused-parameter']
endif
endif
subdir('lib')
subdir('loaders')
subdir('savers')
subdir('bindings')
thorvg_lib_dep = [common_dep, loader_dep, saver_dep, binding_dep]
if host_machine.system() != 'windows'
thread_dep = meson.get_compiler('cpp').find_library('pthread')
thorvg_lib_dep += [thread_dep]
endif
thorvg_lib = library(
'thorvg',
include_directories : headers,
version : meson.project_version(),
dependencies : thorvg_lib_dep,
install : true,
cpp_args : compiler_flags,
gnu_symbol_visibility : 'hidden',
override_options : override_options
)
if (cc.get_id() == 'emscripten')
subdir('wasm')
executable('thorvg-wasm',
[],
include_directories : headers,
dependencies : [thorvg_lib_dep, thorvg_wasm_dep],
)
endif
pkg_mod = import('pkgconfig')
pkg_mod.generate(
libraries : thorvg_lib,
version : meson.project_version(),
name : 'libthorvg',
filebase : 'thorvg',
description : 'A Thor library for rendering vector graphics'
)
subdir('bin')
if get_option('examples') == true
subdir('examples')
endif