Skip to content

Commit

Permalink
feat: Add ThorVG build option
Browse files Browse the repository at this point in the history
  • Loading branch information
espressif2022 committed Aug 19, 2024
1 parent 60c1426 commit 78e342a
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 2 deletions.
40 changes: 39 additions & 1 deletion thorvg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,42 @@ 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_LOADERS_OPTION "")

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

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

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

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

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

string(REPLACE ";" "," TVG_LOADERS_OPTION "${TVG_LOADERS_OPTION}")

if(DEFINED CONFIG_THORVG_LOG_ENABLED AND CONFIG_THORVG_LOG_ENABLED)
set(TVG_LOG_ENABLE "log=true")
else()
set(TVG_LOG_ENABLE "log=false")
endif()

if(DEFINED CONFIG_THORVG_THREAD_SUPPORT AND CONFIG_THORVG_THREAD_SUPPORT)
set(TVG_THREAD_ENABLE "threads=true")
else()
set(TVG_THREAD_ENABLE "threads=false")
endif()

idf_component_register(SRCS dummy.c
INCLUDE_DIRS "${TVG_INC_DIR}")

Expand Down Expand Up @@ -96,7 +132,9 @@ ExternalProject_Add(${TVG_LIB}_target
-Dextra=
-Ddefault_library=static # build static library
-Db_staticpic=false # no -fPIC
-Dthreads=true # allow multi-threading
-D${TVG_LOG_ENABLE} # allow log output
-D${TVG_THREAD_ENABLE} # allow multi-threading
-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
49 changes: 49 additions & 0 deletions thorvg/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
menu "ThorVG Support Options"

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

config THORVG_THREAD_SUPPORT
bool "Enable ThorVG thread support"
default n
help
Enable ThorVG thread support.

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 n
help
Enable TVG loader support.

config THORVG_SVG_LOADER_SUPPORT
bool "Enable svg loader support"
default n
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.

endmenu

endmenu
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"
version: "0.13.8~1"
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

0 comments on commit 78e342a

Please sign in to comment.