Skip to content

Commit

Permalink
meson: Fix build issue when thread support is disabled.
Browse files Browse the repository at this point in the history
updated travis to check this setup.
  • Loading branch information
smohantty committed Jul 20, 2020
1 parent 9896891 commit ba2ba5e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/lottie/lottieitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 10 additions & 4 deletions src/vector/vglobal.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/vector/vrle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit ba2ba5e

Please sign in to comment.