@@ -27,15 +27,17 @@ class ThorvgConan(ConanFile):
2727 options = {
2828 "shared" : [True , False ],
2929 "fPIC" : [True , False ],
30- "with_engines" : ['sw' , 'gl_beta' , 'wg_beta' , "gl" ],
30+ "with_engines" : ['sw' , 'gl_beta' , 'wg_beta' , "gl" , "wg" , "all" ],
3131 "with_loaders" : [False , 'tvg' , 'svg' , 'png' , 'jpg' , 'lottie' , 'ttf' , 'webp' , 'all' ],
3232 "with_savers" : [False , 'tvg' , 'gif' , 'all' ],
3333 "with_bindings" : [False , 'capi' , 'wasm_beta' ],
3434 "with_tools" : [False , 'svg2tvg' , 'svg2png' , 'lottie2gif' , 'all' ],
3535 "with_threads" : [True , False ],
3636 "with_simd" : [True , False ],
3737 "with_examples" : [True , False ],
38- "with_extra" : [False , 'lottie_expressions' ],
38+ "with_lottie_exp" : [False , True ],
39+ "with_openmp" : [False , True ],
40+ "with_gl_variant" : [False , True ],
3941 "with_file" : [True , False ],
4042 }
4143 default_options = {
@@ -49,7 +51,9 @@ class ThorvgConan(ConanFile):
4951 "with_threads" : True ,
5052 "with_simd" : False ,
5153 "with_examples" : False ,
52- "with_extra" : 'lottie_expressions' ,
54+ "with_lottie_exp" : True ,
55+ "with_openmp" : False ,
56+ "with_gl_variant" : False ,
5357 "with_file" : True ,
5458 }
5559 # See more here: https://github.com/thorvg/thorvg/blob/main/meson_options.txt
@@ -62,7 +66,9 @@ class ThorvgConan(ConanFile):
6266 "with_bindings" : "Enable API bindings" ,
6367 "with_tools" : "Enable building thorvg tools" ,
6468 "with_examples" : "Enable building examples" ,
65- "with_extra" : "Enable support for exceptionally advanced features" ,
69+ "with_lottie_exp" : "Enable support for Lottie Expressions" ,
70+ "with_openmp" : "Enable support for OpenMP" ,
71+ "with_gl_variant" : "Enable support for OpenGL Variant" ,
6672 }
6773 short_paths = True
6874
@@ -111,6 +117,24 @@ def validate(self):
111117 raise ConanInvalidConfiguration (f"{ self .ref } doesn't support with_engines=gl, use with_engines=gl_beta instead" )
112118 if Version (self .version ) >= "0.14.0" and self .options .with_engines in ["gl_beta" ]:
113119 raise ConanInvalidConfiguration (f"{ self .ref } doesn't support with_engines=gl_beta, use with_engines=gl instead" )
120+ if Version (self .version ) < "1.0.0" and self .options .with_engines in ["wg" ]:
121+ raise ConanInvalidConfiguration (f"{ self .ref } doesn't support with_engines=wg, use with_engines=wg_beta instead" )
122+ if Version (self .version ) >= "1.0.0" and self .options .with_engines in ["wg_beta" ]:
123+ raise ConanInvalidConfiguration (f"{ self .ref } doesn't support with_engines=wg_beta, use with_engines=wg instead" )
124+ if Version (self .version ) < "1.0.0" and self .options .with_engines in ["all" ]:
125+ raise ConanInvalidConfiguration (f"{ self .ref } doesn't support with_engines=all" )
126+ if Version (self .version ) >= "1.0.0" and self .options .with_loaders in ["tvg" ]:
127+ raise ConanInvalidConfiguration (f"{ self .ref } doesn't support with_loaders=tvg" )
128+ if Version (self .version ) >= "1.0.0" and self .options .with_savers in ["tvg" ]:
129+ raise ConanInvalidConfiguration (f"{ self .ref } doesn't support with_savers=tvg" )
130+ if Version (self .version ) >= "1.0.0" and self .options .with_bindings in ["wasm_beta" ]:
131+ raise ConanInvalidConfiguration (f"{ self .ref } doesn't support with_bindings=wasm_beta" )
132+ if Version (self .version ) >= "1.0.0" and self .options .with_tools in ["svg2tvg" ]:
133+ raise ConanInvalidConfiguration (f"{ self .ref } doesn't support with_tools=svg2tvg" )
134+ if Version (self .version ) < "1.0.0" and self .options .with_openmp is True :
135+ raise ConanInvalidConfiguration (f"{ self .ref } doesn't support with_openmp=True" )
136+ if Version (self .version ) < "1.0.0" and self .options .with_gl_variant is True :
137+ raise ConanInvalidConfiguration (f"{ self .ref } doesn't support with_gl_variant=True" )
114138
115139 def requirements (self ):
116140 loaders_opt = str (self .options .with_loaders )
@@ -142,18 +166,29 @@ def generate(self):
142166 "bindings" : str (self .options .with_bindings ) if self .options .with_bindings else '' ,
143167 "tools" : str (self .options .with_tools )if self .options .with_tools else '' ,
144168 "threads" : bool (self .options .with_threads ),
145- "examples" : bool (self .options .with_examples ),
146169 "tests" : False ,
147170 "log" : is_debug ,
148171 })
149172 # Workaround to avoid: error D8016: '/O1' and '/RTC1' command-line options are incompatible
150173 if is_msvc (self ) and is_debug :
151174 tc .project_options ["optimization" ] = "plain"
152175 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 )
176+ extras = []
177+ if self .options .with_lottie_exp :
178+ if Version (self .version ) < "1.0.0" :
179+ extras .append ("lottie_expressions" )
180+ else :
181+ extras .append ("lottie_exp" )
182+ if self .options .with_openmp :
183+ extras .append ("openmp" )
184+ if self .options .with_gl_variant :
185+ extras .append ("gl_variant" )
186+ if extras :
187+ tc .project_options ["extra" ] = "," .join (extras )
155188 if "with_file" in self .options :
156189 tc .project_options ["file" ] = self .options .with_file
190+ if Version (self .version ) < "1.0.0" :
191+ tc .project_options ["examples" ] = bool (self .options .with_examples )
157192 tc .generate ()
158193 tc = PkgConfigDeps (self )
159194 tc .generate ()
@@ -165,8 +200,8 @@ def _patch_sources(self):
165200 if is_msvc (self ) and self .options .shared :
166201 replace_in_file (self , os .path .join (self .source_folder , "meson.build" ), ", 'strip=true'" , "" )
167202
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 :
203+ if Version ( self . version ) >= "0.15.1" and Version ( self . version ) < "1.0.0" and self . options . with_threads :
204+ # As OpenMP is tagged as "required: false", let's disable it for now to avoid extra flags and requirements injections.
170205 # Notice that the use of disabler() is not working here. If it's used, there is no targets to build.
171206 replace_in_file (self , os .path .join (self .source_folder , "src" , "renderer" , "sw_engine" , "meson.build" ),
172207 "omp_dep = dependency('openmp', required: false)" ,
@@ -193,7 +228,10 @@ def package(self):
193228 rename (self , os .path .join (self .package_folder , "lib" , "libthorvg.a" ), os .path .join (self .package_folder , "lib" , "thorvg.lib" ))
194229
195230 def package_info (self ):
196- self .cpp_info .libs = ["thorvg" ]
231+ if Version (self .version ) >= "1.0.0" :
232+ self .cpp_info .libs = ["thorvg-1" ]
233+ else :
234+ self .cpp_info .libs = ["thorvg" ]
197235
198236 self .cpp_info .set_property ("pkg_config_name" , "libthorvg" )
199237 if self .settings .os in ["Linux" , "FreeBSD" ]:
0 commit comments