| 1 |
From 18083a559734d297838e4cf34a856a4770062319 Mon Sep 17 00:00:00 2001 |
| 2 |
From: tvanfossen <[email protected]> |
| 3 |
Date: Tue, 23 Aug 2022 10:06:53 -0400 |
| 4 |
Subject: [PATCH] changes to compile with esp-idf |
| 5 |
|
| 6 |
--- |
| 7 |
CMakeLists.txt | 11 ++++++----- |
| 8 |
src/vector/vimageloader.cpp | 23 +++++++++++++---------- |
| 9 |
2 files changed, 19 insertions(+), 15 deletions(-) |
| 10 |
|
| 11 |
diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 12 |
index 38a9862..ee6d2cd 100644 |
| 13 |
--- a/CMakeLists.txt |
| 14 |
+++ b/CMakeLists.txt |
| 15 |
@@ -95,10 +95,11 @@ if (NOT APPLE AND NOT WIN32) |
| 16 |
) |
| 17 |
endif() |
| 18 |
|
| 19 |
-if (LOTTIE_MODULE) |
| 20 |
- # for dlopen, dlsym and dlclose dependency |
| 21 |
- target_link_libraries(rlottie PRIVATE ${CMAKE_DL_LIBS}) |
| 22 |
-endif() |
| 23 |
+# No Sym links in ESP-IDF |
| 24 |
+# if (LOTTIE_MODULE) |
| 25 |
+# # for dlopen, dlsym and dlclose dependency |
| 26 |
+# target_link_libraries(rlottie PRIVATE ${CMAKE_DL_LIBS}) |
| 27 |
+# endif() |
| 28 |
|
| 29 |
if (NOT LOTTIE_ASAN) |
| 30 |
if(APPLE) |
| 31 |
@@ -137,7 +138,7 @@ endif (NOT LIB_INSTALL_DIR) |
| 32 |
#declare source and include files |
| 33 |
add_subdirectory(inc) |
| 34 |
add_subdirectory(src) |
| 35 |
-add_subdirectory(example) |
| 36 |
+# add_subdirectory(example) // We dont need example dir in ESP-IDF |
| 37 |
|
| 38 |
if (LOTTIE_TEST) |
| 39 |
enable_testing() |
| 40 |
diff --git a/src/vector/vimageloader.cpp b/src/vector/vimageloader.cpp |
| 41 |
index c2446be..3df4c6a 100644 |
| 42 |
--- a/src/vector/vimageloader.cpp |
| 43 |
+++ b/src/vector/vimageloader.cpp |
| 44 |
@@ -6,7 +6,7 @@ |
| 45 |
#ifdef _WIN32 |
| 46 |
# include <windows.h> |
| 47 |
#else |
| 48 |
-# include <dlfcn.h> |
| 49 |
+// # include <dlfcn.h> //Does not work on ESP-IDF |
| 50 |
#endif // _WIN32 |
| 51 |
|
| 52 |
using lottie_image_load_f = unsigned char *(*)(const char *filename, int *x, |
| 53 |
@@ -61,22 +61,25 @@ struct VImageLoader::Impl { |
| 54 |
void *dl_handle{nullptr}; |
| 55 |
void init() |
| 56 |
{ |
| 57 |
- imageLoad = reinterpret_cast<lottie_image_load_f>( |
| 58 |
- dlsym(dl_handle, "lottie_image_load")); |
| 59 |
- imageFree = reinterpret_cast<lottie_image_free_f>( |
| 60 |
- dlsym(dl_handle, "lottie_image_free")); |
| 61 |
- imageFromData = reinterpret_cast<lottie_image_load_data_f>( |
| 62 |
- dlsym(dl_handle, "lottie_image_load_from_data")); |
| 63 |
+ // No sym links in ESP-iDF |
| 64 |
+ // imageLoad = reinterpret_cast<lottie_image_load_f>( |
| 65 |
+ // dlsym(dl_handle, "lottie_image_load")); |
| 66 |
+ // imageFree = reinterpret_cast<lottie_image_free_f>( |
| 67 |
+ // dlsym(dl_handle, "lottie_image_free")); |
| 68 |
+ // imageFromData = reinterpret_cast<lottie_image_load_data_f>( |
| 69 |
+ // dlsym(dl_handle, "lottie_image_load_from_data")); |
| 70 |
} |
| 71 |
|
| 72 |
void moduleFree() |
| 73 |
{ |
| 74 |
- if (dl_handle) dlclose(dl_handle); |
| 75 |
+ // if (dl_handle) dlclose(dl_handle); // No sym links in ESP-iDF |
| 76 |
} |
| 77 |
bool moduleLoad() |
| 78 |
{ |
| 79 |
- dl_handle = dlopen(LOTTIE_IMAGE_MODULE_PLUGIN, RTLD_LAZY); |
| 80 |
- return (dl_handle == nullptr); |
| 81 |
+ // No sym links in ESP idf |
| 82 |
+ // dl_handle = dlopen(LOTTIE_IMAGE_MODULE_PLUGIN, RTLD_LAZY); |
| 83 |
+ // return (dl_handle == nullptr); |
| 84 |
+ return true |
| 85 |
} |
| 86 |
# endif // _WIN32 |
| 87 |
#else // LOTTIE_IMAGE_MODULE_SUPPORT |
| 88 |
-- |
| 89 |
2.34.1 |
| 90 |
|