Skip to content

Commit

Permalink
(conan-io#25613) lunasvg: add version 3.0.0
Browse files Browse the repository at this point in the history
* lunasvg: add version 3.0.0

* rm cmake files

* disable "LUNASVG_BUILD_EXAMPLES"

* lunasvg: add version 3.0.0

---------

Co-authored-by: Ernesto de Gracia Herranz <ernestodegraciah@gmail.com>
  • Loading branch information
toge and ErniGH authored Oct 16, 2024
1 parent 0c86693 commit ef4eb03
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 3 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:
"3.0.0":
url: "https://github.com/sammycage/lunasvg/archive/v3.0.0.tar.gz"
sha256: "075f0a049ff205ce059feb1fe3ac0e826a1ac62d2360cb72463395f68c4c8764"
"2.4.1":
url: "https://github.com/sammycage/lunasvg/archive/v2.4.1.tar.gz"
sha256: "db9d2134c8c2545694e71e62fb0772a7d089fe53e1ace1e08c2279a89e450534"
Expand All @@ -24,6 +27,10 @@ sources:
url: "https://github.com/sammycage/lunasvg/archive/refs/tags/v2.3.1.tar.gz"
sha256: "6492bf0f51982f5382f83f1a42f247bb1bbcbaef4a15963bbd53073cd4944a25"
patches:
"3.0.0":
- patch_file: "patches/3.0.0-0001-use-cci-package.patch"
patch_description: "use cci plutovg"
patch_type: "conan"
"2.4.1":
- patch_file: "patches/2.4.1-0001-fix-cmake.patch"
patch_description: "use external plutovg and fix installation path for conan"
Expand Down
11 changes: 9 additions & 2 deletions recipes/lunasvg/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir
from conan.tools.build import check_min_cppstd
from conan.tools.scm import Version
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
Expand Down Expand Up @@ -33,6 +33,8 @@ def _min_cppstd(self):
return "14"
if Version(self.version) <= "2.3.8":
return "17"
if Version(self.version) >= "3.0.0":
return "17"
return "11"

@property
Expand Down Expand Up @@ -71,8 +73,10 @@ def layout(self):
def requirements(self):
if Version(self.version) < "2.3.5":
self.requires("plutovg/cci.20220103")
else:
elif Version(self.version) < "3.0.0":
self.requires("plutovg/cci.20221030")
else:
self.requires("plutovg/0.0.7")

def validate(self):
if self.info.settings.compiler.cppstd:
Expand All @@ -92,6 +96,7 @@ def generate(self):
if Version(self.version) < "2.4.1":
tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True
tc.generate()
tc.variables["LUNASVG_BUILD_EXAMPLES"] = False

tc = CMakeDeps(self)
tc.generate()
Expand All @@ -107,6 +112,8 @@ def package(self):
cmake = CMake(self)
cmake.install()

rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))

def package_info(self):
self.cpp_info.libs = ["lunasvg"]
if self.settings.os in ["Linux", "FreeBSD"]:
Expand Down
44 changes: 44 additions & 0 deletions recipes/lunasvg/all/patches/3.0.0-0001-use-cci-package.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0e7ed4b..9c4f8c7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,16 +6,16 @@ set(LUNASVG_VERSION_MICRO 0)

project(lunasvg LANGUAGES CXX VERSION ${LUNASVG_VERSION_MAJOR}.${LUNASVG_VERSION_MINOR}.${LUNASVG_VERSION_MICRO})

-include(FetchContent)
-FetchContent_Declare(plutovg
- GIT_REPOSITORY https://github.com/sammycage/plutovg.git
- GIT_TAG main
- GIT_SHALLOW ON
- FIND_PACKAGE_ARGS 0.0.4
-)
-
-FetchContent_MakeAvailable(plutovg)
-
+# include(FetchContent)
+# FetchContent_Declare(plutovg
+# GIT_REPOSITORY https://github.com/sammycage/plutovg.git
+# GIT_TAG main
+# GIT_SHALLOW ON
+# FIND_PACKAGE_ARGS 0.0.4
+# )
+
+# FetchContent_MakeAvailable(plutovg)
+find_package(plutovg CONFIG REQUIRED)
set(lunasvg_sources
source/lunasvg.cpp
source/graphics.cpp
diff --git a/source/graphics.h b/source/graphics.h
index 775f53c..5676f01 100644
--- a/source/graphics.h
+++ b/source/graphics.h
@@ -1,7 +1,7 @@
#ifndef LUNASVG_GRAPHICS_H
#define LUNASVG_GRAPHICS_H

-#include <plutovg.h>
+#include <plutovg/plutovg.h>

#include <cstdint>
#include <algorithm>
6 changes: 6 additions & 0 deletions recipes/lunasvg/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ if (lunasvg_VERSION VERSION_LESS_EQUAL "2.3.2")
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
elseif (lunasvg_VERSION VERSION_LESS_EQUAL "2.3.8")
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
elseif (lunasvg_VERSION VERSION_GREATER_EQUAL "3.0.0")
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
else()
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
endif()

if (lunasvg_VERSION VERSION_LESS "3.0.0")
target_compile_definitions(${PROJECT_NAME} PRIVATE LUNASVG_BEFORE_3_0_0)
endif()
4 changes: 4 additions & 0 deletions recipes/lunasvg/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#ifdef LUNASVG_BEFORE_3_0_0
#include "lunasvg.h"
#else
#include "lunasvg/lunasvg.h"
#endif
#include <iostream>

int main() {
Expand Down
12 changes: 11 additions & 1 deletion recipes/lunasvg/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,14 @@ find_package(lunasvg REQUIRED CONFIG)

add_executable(${PROJECT_NAME} ../test_package/test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE lunasvg::lunasvg)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
if (lunasvg_VERSION VERSION_LESS_EQUAL "2.3.2")
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
elseif (lunasvg_VERSION VERSION_LESS_EQUAL "2.3.8")
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
else()
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
endif()

if (lunasvg_VERSION VERSION_LESS "3.0.0")
target_compile_definitions(${PROJECT_NAME} PRIVATE LUNASVG_BEFORE_3_0_0)
endif()
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:
"3.0.0":
folder: all
"2.4.1":
folder: all
"2.4.0":
Expand Down

0 comments on commit ef4eb03

Please sign in to comment.