-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')
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')
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.'
+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,
//#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
}
}
-#ifdef DEBUG_PRINT_TREE
+#if LOTTIE_DUMP_TREE_SUPPORT
class LOTDataInspector {
public:
model->mRoot = d->composition();
model->mRoot->processRepeaterObjects();
-#ifdef DEBUG_PRINT_TREE
+#if LOTTIE_DUMP_TREE_SUPPORT
LOTDataInspector inspector;
inspector.visit(model->mRoot.get(), "");
#endif
rlottie_lib = shared_library('rlottie',
include_directories : inc,
- version : rlottie_lib_version,
+ version : meson.project_version(),
dependencies : library_deps,
install : true
)
+++ /dev/null
-#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
vector_dep = [freetype_dep]
vector_dep += pixman_dep
+vector_dep += stb_dep
+
source_file = files('vdasher.cpp')
source_file += files('vbrush.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
)
-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
- )
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()