Commits:
-
e4f687f7
by Charlie Jiang
at 2022-07-07T17:33:38+08:00
[meson] Add option to disable librsvg dependency.
As discussed in #14.
Current librsvg is used to render OT-SVG glyphs. However, librsvg is far from
simple to build as it requires tons of transitive dependencies, especially
on Windows.
Therefore, we could introduce a configure switch in the meson script to switch
librsvg on or off. This is trivial because the source code itself already
honors a `HAVE_LIBRSVG` definition.
* meson_options.txt: Add `librsvg` option (feature), defaulting to `enabled`.
* meson.build: Honor the option above.
2 changed files:
Changes:
meson.build
... |
... |
@@ -32,7 +32,7 @@ libpng_dep = dependency('libpng', |
32
|
32
|
|
33
|
33
|
librsvg_dep = dependency('librsvg-2.0',
|
34
|
34
|
version: '>= 2.46.0',
|
35
|
|
- required: true)
|
|
35
|
+ required: get_option('librsvg'))
|
36
|
36
|
|
37
|
37
|
|
38
|
38
|
cc = meson.get_compiler('c')
|
... |
... |
@@ -70,6 +70,12 @@ output_lib = static_library('output', |
70
|
70
|
dependencies: libfreetype2_dep
|
71
|
71
|
)
|
72
|
72
|
|
|
73
|
+ftcommon_lib_c_args = []
|
|
74
|
+
|
|
75
|
+if librsvg_dep.found()
|
|
76
|
+ ftcommon_lib_c_args += '-DHAVE_LIBRSVG'
|
|
77
|
+endif
|
|
78
|
+
|
73
|
79
|
ftcommon_lib = static_library('ftcommon',
|
74
|
80
|
[
|
75
|
81
|
'src/ftcommon.c',
|
... |
... |
@@ -78,7 +84,7 @@ ftcommon_lib = static_library('ftcommon', |
78
|
84
|
'src/rsvg-port.c',
|
79
|
85
|
'src/rsvg-port.h',
|
80
|
86
|
],
|
81
|
|
- c_args: '-DHAVE_LIBRSVG',
|
|
87
|
+ c_args: ftcommon_lib_c_args,
|
82
|
88
|
dependencies: [libpng_dep, librsvg_dep, libfreetype2_dep],
|
83
|
89
|
include_directories: graph_include_dir,
|
84
|
90
|
link_with: [common_lib, graph_lib],
|
meson_options.txt
|
1
|
+#
|
|
2
|
+# Meson options file for FreeType 2 test programs
|
|
3
|
+#
|
|
4
|
+
|
|
5
|
+# Copyright (C) 2022 by
|
|
6
|
+# David Turner, Robert Wilhelm, Werner Lemberg, and Charlie Jiang.
|
|
7
|
+#
|
|
8
|
+# This file is part of the FreeType project, and may only be used, modified,
|
|
9
|
+# and distributed under the terms of the FreeType project license,
|
|
10
|
+# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
|
11
|
+# indicate that you have read the license and understand and accept it
|
|
12
|
+# fully.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+# Building librsvg is tough on some platforms, so we add
|
|
16
|
+# a switch here.
|
|
17
|
+option('librsvg', type : 'feature', value : 'enabled',
|
|
18
|
+ description : 'Enabling librsvg to render OT-SVG glyphs') |
|