Skip to content

Commit

Permalink
Add support for buildtime selection of the JSON parser
Browse files Browse the repository at this point in the history
  • Loading branch information
X-Ryl669 committed Jan 21, 2022
1 parent 56b1a20 commit 62d91e9
Show file tree
Hide file tree
Showing 7 changed files with 2,912 additions and 495 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ option(LOTTIE_CACHE "Enable LOTTIE CACHE SUPPORT" ON)
option(LOTTIE_TEST "Build LOTTIE AUTOTESTS" OFF)
option(LOTTIE_CCACHE "Enable LOTTIE ccache SUPPORT" OFF)
option(LOTTIE_ASAN "Compile with asan" OFF)
option(LOTTIE_JSON "Use readonly JSON parser" OFF)

set(LOTTIE_MODULE_PATH "${CMAKE_SHARED_LIBRARY_PREFIX}rlottie-image-loader${CMAKE_SHARED_LIBRARY_SUFFIX}"
CACHE STRING "Absolute or relative path to dynamic loader plugin.")
Expand Down
6 changes: 6 additions & 0 deletions cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@
#ifdef LOTTIE_CACHE
#define LOTTIE_CACHE_SUPPORT
#endif

#cmakedefine LOTTIE_JSON

#ifdef LOTTIE_JSON
#define LOTTIE_JSON_SUPPORT
#endif
4 changes: 4 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ if get_option('dumptree') == true
config_h.set10('LOTTIE_DUMP_TREE_SUPPORT', true)
endif

if get_option('json') == true
config_h.set10('LOTTIE_JSON_SUPPORT', true)
endif


configure_file(
output: 'config.h',
Expand Down
14 changes: 13 additions & 1 deletion src/lottie/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,23 @@ target_sources(rlottie
"${CMAKE_CURRENT_LIST_DIR}/lottieloader.cpp"
"${CMAKE_CURRENT_LIST_DIR}/lottiemodel.cpp"
"${CMAKE_CURRENT_LIST_DIR}/lottieproxymodel.cpp"
"${CMAKE_CURRENT_LIST_DIR}/lottieparser.cpp"
"${CMAKE_CURRENT_LIST_DIR}/lottieanimation.cpp"
"${CMAKE_CURRENT_LIST_DIR}/lottiekeypath.cpp"
)

if (LOTTIE_JSON)
target_sources(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/lottieroparser.cpp"
)
else ()
target_sources(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/lottieparser.cpp"
)
endif()


target_include_directories(rlottie
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}"
Expand Down
2 changes: 1 addition & 1 deletion src/lottie/JSON
Submodule JSON updated 2 files
+2 −3 JSON.hpp
+0 −486 ROString.hpp
Loading

0 comments on commit 62d91e9

Please sign in to comment.