rlottie: Fix cmake build

This commit is contained in:
sub.mohanty@samsung.com 2019-06-29 23:07:22 +09:00 committed by Subhransu
parent 11a11763dc
commit 46f43a28ae
5 changed files with 43 additions and 8 deletions

View File

@ -19,6 +19,17 @@ set_target_properties(rlottie PROPERTIES
#declare alias so that library can be used inside the build tree, e.g. when testing
add_library(rlottie::rlottie ALIAS rlottie)
option(LOTTIE_MODULE "Enable LOTTIE MODULE SUPPORT" ON)
option(LOTTIE_THREAD "Enable LOTTIE THREAD SUPPORT" ON)
option(LOTTIE_CACHE "Enable LOTTIE CACHE SUPPORT" ON)
CONFIGURE_FILE(${CMAKE_CURRENT_LIST_DIR}/cmake/config.h.in config.h)
target_include_directories(rlottie
PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}"
)
#declare target compilation options
target_compile_options(rlottie
PUBLIC

17
cmake/config.h.in Normal file
View File

@ -0,0 +1,17 @@
#cmakedefine LOTTIE_MODULE
#ifdef LOTTIE_MODULE
#define LOTTIE_IMAGE_MODULE_SUPPORT
#endif
#cmakedefine LOTTIE_THREAD
#ifdef LOTTIE_THREAD
#define LOTTIE_THREAD_SUPPORT
#endif
#cmakedefine LOTTIE_CACHE
#ifdef LOTTIE_CACHE
#define LOTTIE_CACHE_SUPPORT
#endif

View File

@ -1,7 +1,14 @@
add_library(rlottie-image-loader SHARED
stb_image.cpp
if(LOTTIE_MODULE)
add_library(rlottie-image-loader SHARED
stb_image.cpp
)
install(TARGETS rlottie-image-loader
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
)
install(TARGETS rlottie-image-loader
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
)
else()
target_sources(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/stb_image.cpp"
)
endif()

View File

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

View File

@ -55,7 +55,7 @@ inline float VLine::angle() const
const float dx = mX2 - mX1;
const float dy = mY2 - mY1;
const float theta = std::atan2f(dy, dx) * 180.0f / K_PI;
const float theta = std::atan2(dy, dx) * 180.0f / K_PI;
return theta;
}