Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ThorVG build option (IEC-155) #364

Merged
merged 7 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion thorvg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,46 @@ set(TVG_INC_DIR thorvg/src/bindings/capi)
set(TVG_SUBDIR "${CMAKE_CURRENT_SOURCE_DIR}/thorvg")
set(TVG_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/thorvg_build")
set(TVG_CROSS_CFG "${CMAKE_CURRENT_BINARY_DIR}/thorvg_build/cross_file.txt")
set(TVG_THREADS "true")

set(TVG_LOADERS_OPTION "")

if(CONFIG_THORVG_LOTTIE_LOADER_SUPPORT)
list(APPEND TVG_LOADERS_OPTION "lottie")
endif()

if(CONFIG_THORVG_SVG_LOADER_SUPPORT)
list(APPEND TVG_LOADERS_OPTION "svg")
endif()

if(CONFIG_THORVG_TVG_LOADER_SUPPORT)
list(APPEND TVG_LOADERS_OPTION "tvg")
endif()

if(CONFIG_THORVG_PNG_LOADER_SUPPORT)
list(APPEND TVG_LOADERS_OPTION "png")
endif()

if(CONFIG_THORVG_JPEG_LOADER_SUPPORT)
list(APPEND TVG_LOADERS_OPTION "jpg")
endif()

if(CONFIG_THORVG_WEBP_LOADER_SUPPORT)
list(APPEND TVG_LOADERS_OPTION "webp")
endif()

string(REPLACE ";" "," TVG_LOADERS_OPTION "${TVG_LOADERS_OPTION}")
espressif2022 marked this conversation as resolved.
Show resolved Hide resolved

if(CONFIG_THORVG_LOG_ENABLED)
set(TVG_LOG "true")
else()
set(TVG_LOG "false")
endif()

if(CONFIG_THORVG_THREAD_ENABLED)
set(TVG_THREADS "true")
else()
set(TVG_THREADS "false")
endif()

idf_component_register(
SRCS dummy.c
Expand Down Expand Up @@ -61,6 +100,8 @@ ExternalProject_Add(${TVG_LIB}_target
-Ddefault_library=static # build static library
-Db_staticpic=false # no -fPIC
-Dthreads=${TVG_THREADS}
-Dlog=${TVG_LOG} # allow log output
-Dloaders=${TVG_LOADERS_OPTION} # Pass the loaders option to Meson
BUILD_COMMAND ninja -C ${TVG_BUILD_DIR}
INSTALL_COMMAND ""
BUILD_BYPRODUCTS ${TVG_BUILD_DIR}/src/${TVG_LIB}.a
Expand Down
55 changes: 55 additions & 0 deletions thorvg/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
menu "ThorVG Support Options"

config THORVG_LOG_ENABLED
bool "Enable ThorVG log"
default n
help
Enable ThorVG log.

config THORVG_THREAD_ENABLED
bool "Enable ThorVG thread"
espressif2022 marked this conversation as resolved.
Show resolved Hide resolved
default n
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previously, we've enabled this feature by default

Copy link
Contributor Author

@espressif2022 espressif2022 Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah,lottie, svg, tvg is enabled by default. I'll enable it.
And if we enable the thread flag, some lottie file will crash, I can't find the reason now, so I set it disable by default.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If enabling thread flag doesn't work (i.e. it results in a crash), why do we want to keep this as an option? Wouldn't it be better to disable this option, and re-enable it when the bug is fixed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@espressif2022 Now that you don't get a crash when using threads, can we change this to default y?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@espressif2022 Now that you don't get a crash when using threads, can we change this to default y?

Done.

help
Enable ThorVG thread.
espressif2022 marked this conversation as resolved.
Show resolved Hide resolved

menu "Loaders Support"

config THORVG_LOTTIE_LOADER_SUPPORT
bool "Enable Lottie loader support"
default y
help
Enable Lottie loader support.

config THORVG_TVG_LOADER_SUPPORT
bool "Enable tvg loader support"
default y
help
Enable TVG loader support.

config THORVG_SVG_LOADER_SUPPORT
bool "Enable svg loader support"
default y
help
Enable SVG loader support.

config THORVG_PNG_LOADER_SUPPORT
bool "Enable png loader support"
default n
help
Enable PNG loader support.

config THORVG_JPEG_LOADER_SUPPORT
bool "Enable jpeg loader support"
default n
help
Enable JPEG loader support.

config THORVG_WEBP_LOADER_SUPPORT
bool "Enable webp loader support"
default n
help
Enable WEBP loader support.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally if you don't have more to say in the help text than in the option name, you don't need to add help text... Repeating the same thing twice doesn't really explain anything better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion, thanks.


endmenu

endmenu
2 changes: 1 addition & 1 deletion thorvg/cross_file.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ld = '${CMAKE_LINKER}'
strip = '${CMAKE_STRIP}'

[built-in options]
cpp_args = ['-D_GNU_SOURCE','-D__linux__',${MESON_CXX_FLAGS}]
cpp_args = ['-D_GNU_SOURCE','-D__linux__','-Wno-format',${MESON_CXX_FLAGS}]
cpp_link_args = [${MESON_LINKER_FLAGS}]

[host_machine]
Expand Down
2 changes: 1 addition & 1 deletion thorvg/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "0.13.8~1"
version: "0.14.9"
description: "ThorVG is an open-source graphics library designed for creating vector-based scenes and animations"
url: https://github.com/espressif/idf-extra-components/tree/master/thorvg
repository: "https://github.com/espressif/idf-extra-components.git"
Expand Down
4 changes: 2 additions & 2 deletions thorvg/sbom_thorvg.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: thorvg
version: 0.13.8
version: 0.14.9
cpe: cpe:2.3:a:thorvg:thorvg:{}:*:*:*:*:*:*:*
supplier: 'Organization: thorvg <https://github.com/thorvg/thorvg>'
description: ThorVG is an open-source graphics library designed for creating vector-based scenes and animations.
url: https://github.com/thorvg/thorvg
hash: 30aa742b26e35e170f927c8e5ebdaa68dea6f48f
hash: 81a0fbfd590873b21e53c3af77969c71d3d9b586
2 changes: 1 addition & 1 deletion thorvg/thorvg
Submodule thorvg updated 399 files
Loading