Skip to content

Commit cf7d7d8

Browse files
committed
[thorvg] update to 1.0.1
1 parent 9ffe686 commit cf7d7d8

File tree

5 files changed

+43
-44
lines changed

5 files changed

+43
-44
lines changed

recipes/thorvg/all/conandata.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
sources:
2-
"0.15.16":
3-
url: "https://github.com/thorvg/thorvg/archive/refs/tags/v0.15.16.tar.gz"
4-
sha256: "a7fc0aaf9e1aa5c1bc8f4f2035571ce87136a3c65fd9b3019eb25f9c58fba83c"
2+
"1.0.1":
3+
url: "https://github.com/thorvg/thorvg/archive/refs/tags/v1.0.1.tar.gz"
4+
sha256: "061343ed560f08ef2f7b48a7f6b684ae6bfd50b7904599d8581e466b2531844f"

recipes/thorvg/all/conanfile.py

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ class ThorvgConan(ConanFile):
2727
options = {
2828
"shared": [True, False],
2929
"fPIC": [True, False],
30-
"with_engines": ['sw', 'gl_beta', 'wg_beta', "gl"],
31-
"with_loaders": [False, 'tvg', 'svg', 'png', 'jpg', 'lottie', 'ttf', 'webp', 'all'],
32-
"with_savers": [False, 'tvg', 'gif', 'all'],
33-
"with_bindings": [False, 'capi', 'wasm_beta'],
34-
"with_tools": [False, 'svg2tvg', 'svg2png', 'lottie2gif', 'all'],
30+
"with_engines": ['sw', "gl", "wg", "all"],
31+
"with_loaders": [False, 'svg', 'png', 'jpg', 'lottie', 'ttf', 'webp', 'all'],
32+
"with_savers": [False, 'gif', 'all'],
33+
"with_bindings": [False, 'capi'],
34+
"with_tools": [False, 'svg2png', 'lottie2gif', 'all'],
3535
"with_threads": [True, False],
3636
"with_simd": [True, False],
37-
"with_examples": [True, False],
38-
"with_extra": [False, 'lottie_expressions'],
37+
"with_lottie_exp": [False, True],
38+
"with_openmp": [False, True],
39+
"with_gl_variant": [False, True],
3940
"with_file": [True, False],
4041
}
4142
default_options = {
@@ -48,8 +49,9 @@ class ThorvgConan(ConanFile):
4849
"with_tools": False,
4950
"with_threads": True,
5051
"with_simd": False,
51-
"with_examples": False,
52-
"with_extra": 'lottie_expressions',
52+
"with_lottie_exp": True,
53+
"with_openmp": True,
54+
"with_gl_variant": False,
5355
"with_file": True,
5456
}
5557
# See more here: https://github.com/thorvg/thorvg/blob/main/meson_options.txt
@@ -61,8 +63,9 @@ class ThorvgConan(ConanFile):
6163
"with_simd": "Enable CPU Vectorization(SIMD) in thorvg",
6264
"with_bindings": "Enable API bindings",
6365
"with_tools": "Enable building thorvg tools",
64-
"with_examples": "Enable building examples",
65-
"with_extra": "Enable support for exceptionally advanced features",
66+
"with_lottie_exp": "Enable support for Lottie Expressions",
67+
"with_openmp": "Enable support for OpenMP",
68+
"with_gl_variant": "Enable support for OpenGL Variant",
6669
}
6770
short_paths = True
6871

@@ -83,8 +86,6 @@ def _compilers_minimum_version(self):
8386
def config_options(self):
8487
if self.settings.os == "Windows":
8588
del self.options.fPIC
86-
if Version(self.version) < "0.15.6":
87-
del self.options.with_file
8889

8990
def configure(self):
9091
if self.options.shared:
@@ -107,11 +108,6 @@ def validate(self):
107108
f"{self.ref} doesn't support debug build on MSVC."
108109
)
109110

110-
if Version(self.version) < "0.14.0" and self.options.with_engines in ["gl"]:
111-
raise ConanInvalidConfiguration(f"{self.ref} doesn't support with_engines=gl, use with_engines=gl_beta instead")
112-
if Version(self.version) >= "0.14.0" and self.options.with_engines in ["gl_beta"]:
113-
raise ConanInvalidConfiguration(f"{self.ref} doesn't support with_engines=gl_beta, use with_engines=gl instead")
114-
115111
def requirements(self):
116112
loaders_opt = str(self.options.with_loaders)
117113
if loaders_opt in ("all", "jpg"):
@@ -121,7 +117,7 @@ def requirements(self):
121117
if loaders_opt in ("all", "webp"):
122118
self.requires("libwebp/[>=1.4.0 <2]")
123119
if self.settings.os == "Linux":
124-
if self.options.with_engines in ["gl", "gl_beta"]:
120+
if self.options.with_engines == "gl":
125121
self.requires("opengl/system")
126122

127123
def build_requirements(self):
@@ -142,16 +138,22 @@ def generate(self):
142138
"bindings": str(self.options.with_bindings) if self.options.with_bindings else '',
143139
"tools": str(self.options.with_tools )if self.options.with_tools else '',
144140
"threads": bool(self.options.with_threads),
145-
"examples": bool(self.options.with_examples),
146141
"tests": False,
147142
"log": is_debug,
148143
})
149144
# Workaround to avoid: error D8016: '/O1' and '/RTC1' command-line options are incompatible
150145
if is_msvc(self) and is_debug:
151146
tc.project_options["optimization"] = "plain"
152147
tc.project_options["simd"] = bool(self.options.with_simd)
153-
if self.options.with_extra:
154-
tc.project_options["extra"] = str(self.options.with_extra)
148+
extras = []
149+
if self.options.with_lottie_exp:
150+
extras.append("lottie_exp")
151+
if self.options.with_openmp:
152+
extras.append("openmp")
153+
if self.options.with_gl_variant:
154+
extras.append("gl_variant")
155+
if extras:
156+
tc.project_options["extra"] = ",".join(extras)
155157
if "with_file" in self.options:
156158
tc.project_options["file"] = self.options.with_file
157159
tc.generate()
@@ -165,16 +167,6 @@ def _patch_sources(self):
165167
if is_msvc(self) and self.options.shared:
166168
replace_in_file(self, os.path.join(self.source_folder, "meson.build"), ", 'strip=true'", "")
167169

168-
# TODO: As OpenMP is tagged as "required: false", let's disable it for now to avoid extra flags and requirements injections.
169-
if Version(self.version) >= "0.15.1" and self.options.with_threads:
170-
# Notice that the use of disabler() is not working here. If it's used, there is no targets to build.
171-
replace_in_file(self, os.path.join(self.source_folder, "src", "renderer", "sw_engine", "meson.build"),
172-
"omp_dep = dependency('openmp', required: false)",
173-
"omp_dep = []")
174-
replace_in_file(self, os.path.join(self.source_folder, "src", "renderer", "sw_engine", "meson.build"),
175-
"omp_dep.found()",
176-
"false")
177-
178170
def build(self):
179171
self._patch_sources()
180172
meson = Meson(self)
@@ -193,7 +185,7 @@ def package(self):
193185
rename(self, os.path.join(self.package_folder, "lib", "libthorvg.a"), os.path.join(self.package_folder, "lib", "thorvg.lib"))
194186

195187
def package_info(self):
196-
self.cpp_info.libs = ["thorvg"]
188+
self.cpp_info.libs = ["thorvg-1"]
197189

198190
self.cpp_info.set_property("pkg_config_name", "libthorvg")
199191
if self.settings.os in ["Linux", "FreeBSD"]:

recipes/thorvg/all/test_package/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ project(test_package LANGUAGES CXX)
33

44
find_package(thorvg REQUIRED CONFIG)
55

6+
find_package(OpenMP)
7+
if(OpenMP_CXX_FOUND)
8+
set(OPENMP_DEP OpenMP::OpenMP_CXX)
9+
else()
10+
set(OPENMP_DEP "")
11+
endif()
12+
613
add_executable(${PROJECT_NAME} test_package.cpp)
7-
target_link_libraries(${PROJECT_NAME} PRIVATE thorvg::thorvg)
14+
target_link_libraries(${PROJECT_NAME} PRIVATE thorvg::thorvg ${OPENMP_DEP})
815
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
#include "thorvg.h"
1+
#include "thorvg-1/thorvg.h"
22

33
int main() {
44
const int WIDTH = 800;
55
const int HEIGHT = 600;
66

7-
tvg::Initializer::init(tvg::CanvasEngine::Sw, 0);
7+
tvg::Initializer::init(0);
88

99
static uint32_t buffer[WIDTH * HEIGHT]; // canvas target buffer
1010

1111
auto canvas = tvg::SwCanvas::gen(); // generate a canvas
12-
canvas->target(buffer, WIDTH, WIDTH, HEIGHT, tvg::SwCanvas::ARGB8888); // buffer, stride, w, h, Colorspace
12+
canvas->target(buffer, WIDTH, WIDTH, HEIGHT, tvg::ColorSpace::ARGB8888); // buffer, stride, w, h, Colorspace
1313

1414
auto rect = tvg::Shape::gen(); // generate a shape
1515
rect->appendRect(50, 50, 200, 200, 20, 20); // define it as a rounded rectangle (x, y, w, h, rx, ry)
1616
rect->fill(100, 100, 100, 255); // set its color (r, g, b, a)
17-
canvas->push(std::move(rect)); // push the rectangle into the canvas
17+
canvas->add(std::move(rect)); // push the rectangle into the canvas
1818

1919
auto circle = tvg::Shape::gen(); // generate a shape
2020
circle->appendCircle(400, 400, 100, 100); // define it as a circle (cx, cy, rx, ry)
2121

2222
auto fill = tvg::RadialGradient::gen(); // generate a radial gradient
23-
fill->radial(400, 400, 150); // set the radial gradient geometry info (cx, cy, radius)
23+
fill->radial(400, 400, 150, 400, 400, 150); // set the radial gradient geometry info (cx, cy, r, fx, fy, fr)
2424

2525
tvg::Fill::ColorStop colorStops[2]; // gradient colors
2626
colorStops[0] = {0.0, 255, 255, 255, 255}; // 1st color values (offset, r, g, b, a)
2727
colorStops[1] = {1.0, 0, 0, 0, 255}; // 2nd color values (offset, r, g, b, a)
2828
fill->colorStops(colorStops, 2); // set the gradient colors info
2929

3030
circle->fill(std::move(fill)); // set the circle fill
31-
canvas->push(std::move(circle)); // push the circle into the canvas
31+
canvas->add(std::move(circle)); // push the circle into the canvas
3232
}

recipes/thorvg/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
versions:
2-
"0.15.16":
2+
"1.0.1":
33
folder: all

0 commit comments

Comments
 (0)