rlottie/meson: refactor meson buildsystem
authorsubhransu mohanty <sub.mohanty@samsung.com>
Wed, 3 Jul 2019 05:28:06 +0000 (14:28 +0900)
committerHermet Park <hermetpark@gmail.com>
Wed, 10 Jul 2019 01:58:26 +0000 (10:58 +0900)
Change-Id: I0627e3d51cc55f5b177351b67fa4f30e5e235e98

example/meson.build
meson.build
src/lottie/meson.build
src/meson.build
src/vector/freetype/meson.build
src/vector/meson.build
src/vector/pixman/meson.build
src/vector/stb/meson.build
test/meson.build
test/test_lottieanimation_capi.cpp

index fb1d3c1..5526a18 100644 (file)
@@ -1,4 +1,6 @@
 
+override_default = ['warning_level=2', 'werror=false']
+
 common_source  = files('evasapp.cpp')
 common_source += files('lottieview.cpp')
 
@@ -8,12 +10,13 @@ demo_sources += common_source
 executable('lottie2gif',
            'lottie2gif.cpp',
            include_directories : inc,
+           override_options : override_default,
            link_with : rlottie_lib)
 
 executable('vectorTest',
            'vectortest.cpp',
            include_directories : inc,
-           dependencies : [library_deps])
+           dependencies : [rlottie_dep])
 
 demo_dep = dependency('elementary', required : false)
 
@@ -21,6 +24,7 @@ if (demo_dep.found())
     executable('demo',
                demo_sources,
                include_directories : inc,
+               override_options : override_default,
                link_with : rlottie_lib,
                dependencies : demo_dep)
 
@@ -30,6 +34,7 @@ if (demo_dep.found())
     executable('lottieviewTest',
                lottieview_test_src,
                include_directories : inc,
+               override_options : override_default,
                link_with : rlottie_lib,
                dependencies : demo_dep)
 
@@ -39,6 +44,7 @@ if (demo_dep.found())
     executable('uxsampleTest',
                uxsample_test_src,
                include_directories : inc,
+               override_options : override_default,
                link_with : rlottie_lib,
                dependencies : demo_dep)
 
@@ -48,6 +54,7 @@ if (demo_dep.found())
     executable('lottieviewer',
                lottieviewer_sources,
                include_directories : inc,
+               override_options : override_default,
                link_with : rlottie_lib,
                dependencies : demo_dep)
 
@@ -56,6 +63,7 @@ if (meson.get_compiler('cpp').has_header('elementary-1/efl_ui_animation_view.h')
                'efl_animview.cpp',
                include_directories : inc,
                link_with : rlottie_lib,
+               override_options : override_default,
                dependencies : demo_dep)
 endif
 
index 8850000..223b7c5 100644 (file)
@@ -1,30 +1,11 @@
 project('rlottie',
         'cpp',
-        default_options : ['warning_level=2', 'werror=true', 'cpp_std=c++14', 'optimization=s'],
+        default_options : ['warning_level=3', 'werror=true', 'cpp_std=c++14', 'optimization=s'],
         version : '0.0.1',
         license : 'Apache')
 
 add_project_arguments('-DDEMO_DIR="@0@/example/resource/"'.format(meson.current_source_dir()), language : 'cpp')
-
-compiler_flags = ['-DLOT_BUILD']
-compiler_flags_try = ['-fno-exceptions', '-fno-rtti',
-                      '-fno-unwind-tables' , '-fno-asynchronous-unwind-tables',
-                      '-Woverloaded-virtual', '-Wno-unused-parameter']
-
-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' and get_option('thread') == true)
-    compiler_flags += ['-pthread']
-    add_project_link_arguments('-pthread', language: 'cpp')
-endif
-
-add_project_arguments(compiler_flags, language: 'cpp')
+add_project_arguments('-DLOT_BUILD', language: 'cpp')
 
 inc = [include_directories('inc')]
 config_dir = include_directories('.')
@@ -71,11 +52,3 @@ if get_option('test') == true
    subdir('test')
 endif
 
-pkg_mod = import('pkgconfig')
-
-pkg_mod.generate( libraries   : rlottie_lib,
-                  version     : meson.project_version(),
-                  name        : 'librlottie',
-                  filebase    : 'rlottie',
-                  description : 'A Library for rendering lottie files.'
-                )
index a6d1856..7a4df79 100644 (file)
@@ -1,12 +1,13 @@
 
-source_file  = files('lottieparser.cpp')
-source_file += files('lottieloader.cpp')
-source_file += files('lottiemodel.cpp')
-source_file += files('lottieproxymodel.cpp')
-source_file += files('lottieanimation.cpp')
-source_file += files('lottieitem.cpp')
-source_file += files('lottiekeypath.cpp')
-
+source_file = [
+    'lottieparser.cpp',
+    'lottieloader.cpp',
+    'lottiemodel.cpp',
+    'lottieproxymodel.cpp',
+    'lottieanimation.cpp',
+    'lottieitem.cpp',
+    'lottiekeypath.cpp'
+]
 
 lottie_dep = declare_dependency(
                                   include_directories : include_directories('.'),
index f347b85..4097d73 100644 (file)
@@ -1,15 +1,31 @@
+cc = meson.get_compiler('cpp')
+
+if (cc.get_id() != 'msvc')
+    compiler_flags = ['-fno-exceptions', '-fno-rtti',
+                      '-fno-unwind-tables' , '-fno-asynchronous-unwind-tables',
+                      '-Woverloaded-virtual', '-Wno-unused-parameter']
+endif
+
 subdir('vector')
 subdir('lottie')
 subdir('binding')
 
-library_deps  = vector_dep
-library_deps += lottie_dep
-library_deps += binding_dep
+rlottie_dep  = [ vector_dep, lottie_dep, binding_dep, dependency('threads')]
 
 rlottie_lib = shared_library('rlottie',
                              include_directories : inc,
                              version             : meson.project_version(),
-                             dependencies        : library_deps,
+                             dependencies        : rlottie_dep,
                              install             : true,
+                             cpp_args            : compiler_flags,
                              gnu_symbol_visibility : 'hidden',
                             )
+
+pkg_mod = import('pkgconfig')
+
+pkg_mod.generate( libraries   : rlottie_lib,
+                  version     : meson.project_version(),
+                  name        : 'librlottie',
+                  filebase    : 'rlottie',
+                  description : 'A Library for rendering lottie files.'
+                )
index 8bbff5c..7c1217f 100644 (file)
@@ -1,10 +1,11 @@
 
-source_file  = files('v_ft_math.cpp')
-source_file += files('v_ft_raster.cpp')
-source_file += files('v_ft_stroker.cpp')
-
+source_file = [
+    'v_ft_math.cpp',
+    'v_ft_raster.cpp',
+    'v_ft_stroker.cpp',
+    ]
 
 freetype_dep = declare_dependency(
                                     include_directories : include_directories('.'),
                                     sources : source_file
-                                 )
\ No newline at end of file
+                                 )
index 00ca321..c0f0c25 100644 (file)
@@ -3,37 +3,32 @@ subdir('freetype')
 subdir('pixman')
 subdir('stb')
 
-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('vbitmap.cpp')
-source_file  += files('vpainter.cpp')
-source_file  += files('vcompositionfunctions.cpp')
-source_file  += files('vdrawhelper.cpp')
-source_file  += files('vdrawhelper_sse2.cpp')
-source_file  += files('vdrawable.cpp')
-
-source_file  += files('vrect.cpp')
-source_file  += files('vrle.cpp')
-source_file  += files('vpath.cpp')
-source_file  += files('vpathmesure.cpp')
-source_file  += files('vmatrix.cpp')
-source_file  += files('velapsedtimer.cpp')
-source_file  += files('vdebug.cpp')
-source_file  += files('vinterpolator.cpp')
-source_file  += files('vbezier.cpp')
-source_file  += files('vraster.cpp')
-source_file  += files('vimageloader.cpp')
-
-inc_dir = [include_directories('.')]
-inc_dir += config_dir
-
-vector_dep += declare_dependency( include_directories : inc_dir,
-                                  sources             : source_file
+source_file = [
+    'vdasher.cpp',
+    'vbrush.cpp',
+    'vbitmap.cpp',
+    'vpainter.cpp',
+    'vcompositionfunctions.cpp',
+    'vdrawhelper.cpp',
+    'vdrawhelper_sse2.cpp',
+    'vdrawhelper_neon.cpp',
+    'vdrawable.cpp',
+    'vrect.cpp',
+    'vrle.cpp',
+    'vpath.cpp',
+    'vpathmesure.cpp',
+    'vmatrix.cpp',
+    'velapsedtimer.cpp',
+    'vdebug.cpp',
+    'vinterpolator.cpp',
+    'vbezier.cpp',
+    'vraster.cpp',
+    'vimageloader.cpp',
+]
+
+vector_dep = declare_dependency( include_directories : include_directories('.'),
+                                  sources             : source_file,
+                                  dependencies        : [freetype_dep, pixman_dep, stb_dep],
                                 )
 
 
index 5d3b4e3..39ffefd 100644 (file)
@@ -1,8 +1,8 @@
 
-source_file  = files('vregion.cpp')
+source_file = ['vregion.cpp']
 
 if host_machine.cpu_family() == 'arm' or host_machine.cpu_family() == 'aarch64'
-  source_file +=  files('pixman-arm-neon-asm.S')
+  source_file += 'pixman-arm-neon-asm.S'
 endif
 
 pixman_dep = declare_dependency(
index 8306782..5e8f670 100644 (file)
@@ -1,22 +1,17 @@
 
 source_file = ['stb_image.cpp']
 
-inc_dir = [include_directories('.')]
-inc_dir += config_dir
-
 if get_option('module') == true
     rlottie_image_loader_lib = shared_library('rlottie-image-loader',
                                               source_file,
-                                              include_directories : inc_dir,
+                                              include_directories : [include_directories('.'), config_dir],
                                               install : true,
                                               gnu_symbol_visibility : 'hidden',
                                              )
-    # 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 : inc_dir,
+    stb_dep = declare_dependency( include_directories : include_directories('.'),
                                   sources : source_file
                                  )
 endif
index 312e53e..69fff15 100644 (file)
@@ -1,25 +1,35 @@
 
-vector_test_sources  = files('testsuite.cpp')
-vector_test_sources += files('test_vpath.cpp')
+override_default = ['warning_level=2', 'werror=false']
 
 gtest_dep  = dependency('gtest')
 
+vector_test_sources = [
+    'testsuite.cpp',
+    'test_vpath.cpp',
+    ]
+
 vector_testsuite = executable('vectorTestSuite',
                               vector_test_sources,
                               include_directories : inc,
-                              dependencies : [gtest_dep, library_deps])
+                              override_options : override_default,
+                              dependencies : [gtest_dep, rlottie_dep],
+                              )
 
 test('Vector Testsuite', vector_testsuite)
 
 
-animation_test_sources  = files('testsuite.cpp')
-animation_test_sources += files('test_lottieanimation.cpp')
-animation_test_sources += files('test_lottieanimation_capi.cpp')
+animation_test_sources = [
+    'testsuite.cpp',
+    'test_lottieanimation.cpp',
+    'test_lottieanimation_capi.cpp'
+    ]
 
 animation_testsuite = executable('animationTestSuite',
                               animation_test_sources,
                               include_directories : inc,
+                              override_options : override_default,
                               link_with : rlottie_lib,
-                              dependencies : gtest_dep)
+                              dependencies : gtest_dep,
+                              )
 
 test('Animation Testsuite', animation_testsuite)
index ac058e0..a0d24ef 100644 (file)
@@ -1,5 +1,5 @@
 #include <gtest/gtest.h>
-#include "lottieanimation_capi.h"
+#include "rlottie_capi.h"
 
 class AnimationCApiTest : public ::testing::Test {
 public: