rlottie: refactor meson build file

This commit is contained in:
sub.mohanty@samsung.com
2019-06-29 18:13:16 +09:00
committed by Subhransu
parent 5b79983f0a
commit e99767bb90
8 changed files with 97 additions and 39 deletions

View File

@@ -1,14 +1,21 @@
project('rlottie library',
project('rlottie',
'cpp',
version : '0.0.1',
license : 'Apache')
rlottie_lib_version = '0.0.1'
add_global_arguments('-DDEMO_DIR="@0@/example/resource/"'.format(meson.current_source_dir()), language : 'cpp')
compiler_flags = ['-std=c++14', '-Os', '-Wall', '-Werror', '-Wextra', '-fno-exceptions', '-fno-rtti',
'-fno-unwind-tables' , '-fno-asynchronous-unwind-tables',
'-Wnon-virtual-dtor', '-Woverloaded-virtual', '-Wno-unused-parameter', '-fvisibility=hidden']
compiler_flags = []
compiler_flags_try = ['-std=c++14', '-Os', '-Wall', '-Werror', '-Wextra', '-fno-exceptions', '-fno-rtti',
'-fno-unwind-tables' , '-fno-asynchronous-unwind-tables',
'-Wnon-virtual-dtor', '-Woverloaded-virtual', '-Wno-unused-parameter', '-fvisibility=hidden']
cc = meson.get_compiler('cpp')
foreach cf: compiler_flags_try
if cc.has_argument(cf) == true
compiler_flags += cf
endif
endforeach
if (build_machine.system() == 'linux')
@@ -18,7 +25,39 @@ endif
add_global_arguments(compiler_flags, language: 'cpp')
inc = include_directories('inc')
inc = [include_directories('inc')]
config_dir = include_directories('.')
inc += config_dir
config_h = configuration_data()
if get_option('thread') == true
config_h.set10('LOTTIE_THREAD_SUPPORT', true)
endif
if get_option('module') == true
config_h.set10('LOTTIE_IMAGE_MODULE_SUPPORT', true)
endif
if get_option('cache') == true
config_h.set10('LOTTIE_CACHE_SUPPORT', true)
endif
if get_option('log') == true
config_h.set10('LOTTIE_LOGGING_SUPPORT', true)
endif
if get_option('dumptree') == true
config_h.set10('LOTTIE_LOGGING_SUPPORT', true)
config_h.set10('LOTTIE_DUMP_TREE_SUPPORT', true)
endif
configure_file(
output: 'config.h',
configuration: config_h
)
subdir('inc')
subdir('src')
@@ -34,7 +73,7 @@ endif
pkg_mod = import('pkgconfig')
pkg_mod.generate( libraries : rlottie_lib,
version : rlottie_lib_version,
version : meson.project_version(),
name : 'librlottie',
filebase : 'rlottie',
description : 'A Library for rendering lottie files.'

View File

@@ -1,3 +1,28 @@
option('thread',
type: 'boolean',
value: true,
description: 'Enable threading in rlottie')
option('cache',
type: 'boolean',
value: true,
description: 'Enable cache support in rlottie')
option('module',
type: 'boolean',
value: true,
description: 'Enable module support in rlottie')
option('log',
type: 'boolean',
value: false,
description: 'Enable logging in rlottie')
option('dumptree',
type: 'boolean',
value: false,
description: 'Enable logging the rlottie tree in rlottie')
option('test',
type: 'boolean',
value: false,

View File

@@ -20,8 +20,6 @@
//#define DEBUG_PARSER
//#define DEBUG_PRINT_TREE
// This parser implements JSON token-by-token parsing with an API that is
// more direct; we don't have to create handler object and
// callbacks. Instead, we retrieve values from the JSON stream by calling
@@ -2032,7 +2030,7 @@ void LottieParserImpl::parseProperty(LOTAnimatable<T> &obj)
}
}
#ifdef DEBUG_PRINT_TREE
#if LOTTIE_DUMP_TREE_SUPPORT
class LOTDataInspector {
public:
@@ -2233,7 +2231,7 @@ std::shared_ptr<LOTModel> LottieParser::model()
model->mRoot = d->composition();
model->mRoot->processRepeaterObjects();
#ifdef DEBUG_PRINT_TREE
#if LOTTIE_DUMP_TREE_SUPPORT
LOTDataInspector inspector;
inspector.visit(model->mRoot.get(), "");
#endif

View File

@@ -8,7 +8,7 @@ library_deps += binding_dep
rlottie_lib = shared_library('rlottie',
include_directories : inc,
version : rlottie_lib_version,
version : meson.project_version(),
dependencies : library_deps,
install : true
)

View File

@@ -1,16 +0,0 @@
#ifndef CONFIG_H
#define CONFIG_H
// enable threading
#define LOTTIE_THREAD_SUPPORT
//enable logging
//#define LOTTIE_LOGGING_SUPPORT
//enable static building of image loader
//#define LOTTIE_STATIC_IMAGE_LOADER
//enable lottie model caching
#define LOTTIE_CACHE_SUPPORT
#endif // CONFIG_H

View File

@@ -5,6 +5,8 @@ subdir('stb')
vector_dep = [freetype_dep]
vector_dep += pixman_dep
vector_dep += stb_dep
source_file = files('vdasher.cpp')
source_file += files('vbrush.cpp')
@@ -28,11 +30,10 @@ source_file += files('vbezier.cpp')
source_file += files('vraster.cpp')
source_file += files('vimageloader.cpp')
# dl dependancy for dlopen, dlsym, dlclose symbol
cc = meson.get_compiler('cpp')
vector_dep += cc.find_library('dl', required : false)
inc_dir = [include_directories('.')]
inc_dir += config_dir
vector_dep += declare_dependency( include_directories : include_directories('.'),
vector_dep += declare_dependency( include_directories : inc_dir,
sources : source_file
)

View File

@@ -1,8 +1,19 @@
rlottie_image_loader_sources = ['stb_image.cpp']
source_file = ['stb_image.cpp']
if get_option('module') == true
rlottie_image_loader_lib = shared_library('rlottie-image-loader',
source_file,
install : true
)
# dl dependancy for dlopen, dlsym, dlclose symbol
cc = meson.get_compiler('cpp')
stb_dep = cc.find_library('dl', required : false)
else
stb_dep = declare_dependency(
include_directories : include_directories('.'),
sources : source_file
)
endif
rlottie_image_loader_lib = shared_library('rlottie-image-loader',
rlottie_image_loader_sources,
install : true
)

View File

@@ -35,7 +35,7 @@ struct VImageLoader::Impl {
lottie_image_free_f imageFree{nullptr};
lottie_image_load_data_f imageFromData{nullptr};
#ifndef LOTTIE_STATIC_IMAGE_LOADER
#if LOTTIE_IMAGE_MODULE_SUPPORT
#ifdef WIN32
HMODULE dl_handle{nullptr};
bool moduleLoad()