meson: Fix build issue when thread support is disabled.
authorSubhransu Mohanty <sub.mohanty@samsung.com>
Mon, 20 Jul 2020 01:57:19 +0000 (10:57 +0900)
committerJongmin Lee <jm105.lee@samsung.com>
Mon, 20 Jul 2020 22:34:58 +0000 (07:34 +0900)
updated travis to check this setup.

.travis.yml
meson.build
src/lottie/lottieitem.cpp
src/meson.build
src/vector/vglobal.h
src/vector/vrle.cpp

index c64886c42bc6f8888560924ab3af38b50c3031f5..b38074276f88cbea5607b177a46eaadff411b7cd 100644 (file)
@@ -17,5 +17,6 @@ script:
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile; fi
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit .; fi
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && TRAVIS=true meson -Dtest=true builddir && ninja -C builddir test && ninja -C builddir install"; fi
-  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && TRAVIS=true meson -Dtest=true -Dcache=false  -Dmodule=false -Ddumptree=true builddir && ninja -C builddir test && ninja -C builddir install"; fi
+  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && TRAVIS=true meson -Dcache=false  -Dmodule=false -Ddumptree=true builddir && ninja -C builddir install"; fi
+  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && TRAVIS=true meson -Dthread=false builddir && ninja -C builddir install"; fi
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && TRAVIS=true cmake -DLOTTIE_TEST=ON -Bbuilddir -H. && make -C builddir -j$(nproc) all test && make -C builddir install"; fi
index f8fc419cbb883fff1b9f9f451889cd557e32f14f..7579e6a2af73597a7cad43781a243d1518b7f63f 100644 (file)
@@ -16,8 +16,6 @@ config_h = configuration_data()
 
 if get_option('thread') == true
     config_h.set10('LOTTIE_THREAD_SUPPORT', true)
-else
-    config_h.set('thread_local', true)
 endif
 
 if get_option('module') == true
index 276fd71b2878cd74e8b6bbbbaa31977bd4f78b31..db59fbd861febce741ad89c0d4dcf665bb87aa73 100644 (file)
@@ -1251,7 +1251,7 @@ renderer::Stroke::Stroke(model::Stroke *data)
     }
 }
 
-static thread_local std::vector<float> Dash_Vector;
+static vthread_local std::vector<float> Dash_Vector;
 
 bool renderer::Stroke::updateContent(int frameNo, const VMatrix &matrix,
                                      float alpha)
index da62e2dc35a6f7a0854faf58ecba9b1185cd3228..8243f3d555be4ad150e1b26c292517ad7924d796 100644 (file)
@@ -16,7 +16,11 @@ subdir('vector')
 subdir('lottie')
 subdir('binding')
 
-rlottie_lib_dep  = [ vector_dep, lottie_dep, binding_dep, dependency('threads')]
+rlottie_lib_dep  = [ vector_dep, lottie_dep, binding_dep]
+
+if get_option('thread') == true
+    rlottie_lib_dep  += dependency('threads')
+endif
 
 rlottie_lib = library('rlottie',
                       include_directories   : inc,
index 428dbf93b47e9fc97ce24817cfb918e63d20fe7b..6b41fe75463ce62408739c2a5f3f951b3bf2cfbf 100644 (file)
@@ -1,16 +1,16 @@
-/* 
+/*
  * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
- * 
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
- * 
+ *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
@@ -70,6 +70,12 @@ using uchar  = uint8_t;
 #define VECTOR_FALLTHROUGH
 #endif
 
+#ifdef LOTTIE_THREAD_SUPPORT
+#define vthread_local thread_local
+#else
+#define vthread_local
+#endif
+
 template <typename T>
 V_CONSTEXPR inline const T &vMin(const T &a, const T &b)
 {
index 62eda5689d3ae41e80ef21c795a3afe21336193b..0302c8599f61ed124f60f832e9ccdd9bfcabe8cf 100644 (file)
@@ -730,7 +730,7 @@ VRle VRle::toRle(const VRect &rect)
  * this function is thread safe as it uses thread_local variable
  * which is unique per thread.
  */
-static thread_local VRle::VRleData Scratch_Object;
+static vthread_local VRle::VRleData Scratch_Object;
 
 void VRle::operator&=(const VRle &o)
 {