Skip to content

Commit

Permalink
(#25037) lunasvg: add version 2.4.1
Browse files Browse the repository at this point in the history
* lunasvg: add version 2.4.1

* support msvc shared build

* remove unused methods

---------

Co-authored-by: Ernesto de Gracia Herranz <[email protected]>
Co-authored-by: Ernesto de Gracia Herranz <[email protected]>
  • Loading branch information
3 people authored Sep 24, 2024
1 parent 3bf569d commit a631e80
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
7 changes: 7 additions & 0 deletions recipes/lunasvg/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"2.4.1":
url: "https://github.com/sammycage/lunasvg/archive/v2.4.1.tar.gz"
sha256: "db9d2134c8c2545694e71e62fb0772a7d089fe53e1ace1e08c2279a89e450534"
"2.4.0":
url: "https://github.com/sammycage/lunasvg/archive/v2.4.0.tar.gz"
sha256: "0682c60501c91d75f4261d9c1a5cd44c2c9da8dba76f8402eab628448c9a4591"
Expand All @@ -21,6 +24,10 @@ sources:
url: "https://github.com/sammycage/lunasvg/archive/refs/tags/v2.3.1.tar.gz"
sha256: "6492bf0f51982f5382f83f1a42f247bb1bbcbaef4a15963bbd53073cd4944a25"
patches:
"2.4.1":
- patch_file: "patches/2.4.1-0001-fix-cmake.patch"
patch_description: "use external plutovg and fix installation path for conan"
patch_type: "conan"
"2.4.0":
- patch_file: "patches/2.3.9-0001-fix-cmake.patch"
patch_description: "use external plutovg and fix installation path for conan"
Expand Down
6 changes: 4 additions & 2 deletions recipes/lunasvg/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.microsoft import check_min_vs, is_msvc
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy
from conan.tools.build import check_min_cppstd
from conan.tools.scm import Version
Expand Down Expand Up @@ -90,7 +89,8 @@ def source(self):
def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared
tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True
if Version(self.version) < "2.4.1":
tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True
tc.generate()

tc = CMakeDeps(self)
Expand All @@ -111,3 +111,5 @@ def package_info(self):
self.cpp_info.libs = ["lunasvg"]
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs = ["m"]
if Version(self.version) >= "2.4.1" and not self.options.shared:
self.cpp_info.defines = ["LUNASVG_BUILD_STATIC"]
38 changes: 38 additions & 0 deletions recipes/lunasvg/all/patches/2.4.1-0001-fix-cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3565911..e33555e 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,8 +12,8 @@ add_library(lunasvg)

add_subdirectory(include)
add_subdirectory(source)
-add_subdirectory(3rdparty/plutovg)
-
+find_package(plutovg CONFIG REQUIRED)
+target_link_libraries(lunasvg plutovg::plutovg)
target_compile_definitions(lunasvg PRIVATE LUNASVG_BUILD)
if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(lunasvg PRIVATE LUNASVG_BUILD_STATIC)
@@ -25,16 +25,16 @@ if(LUNASVG_BUILD_EXAMPLES)
target_include_directories(svg2png PRIVATE 3rdparty/stb)
endif()

-set(LUNASVG_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
-set(LUNASVG_INCDIR ${CMAKE_INSTALL_PREFIX}/include)
+# set(LUNASVG_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
+# set(LUNASVG_INCDIR ${CMAKE_INSTALL_PREFIX}/include)

install(FILES
include/lunasvg.h
- DESTINATION ${LUNASVG_INCDIR}
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

install(TARGETS lunasvg
- LIBRARY DESTINATION ${LUNASVG_LIBDIR}
- ARCHIVE DESTINATION ${LUNASVG_LIBDIR}
- INCLUDES DESTINATION ${LUNASVG_INCDIR}
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
2 changes: 2 additions & 0 deletions recipes/lunasvg/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"2.4.1":
folder: all
"2.4.0":
folder: all
"2.3.9":
Expand Down

0 comments on commit a631e80

Please sign in to comment.