freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2-demos] master f50f4ad: [meson] Add option to disable librsvg


From: Werner Lemberg
Subject: [freetype2-demos] master f50f4ad: [meson] Add option to disable librsvg dependency.
Date: Mon, 11 Jul 2022 05:51:24 -0400 (EDT)

branch: master
commit f50f4ada5830e94bed8cca8ebf9ea38455ad3844
Author: Charlie Jiang <w@chariri.moe>
Commit: Werner Lemberg <wl@gnu.org>

    [meson] Add option to disable librsvg dependency.
    
    As discussed in #14.
    
    Currently, '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 introducee a configuration option to switch 'librsvg' on or
    off.  This is trivial because the source code itself already honors a
    `HAVE_LIBRSVG` macro.
    
    * meson_options.txt: Add `librsvg` option (feature), defaulting to
    `enabled`.
    
    * meson.build: Honor the option above.
---
 meson.build       | 10 ++++++++--
 meson_options.txt | 22 ++++++++++++++++++++++
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index da25dbc..7287fc2 100644
--- a/meson.build
+++ b/meson.build
@@ -32,7 +32,7 @@ libpng_dep = dependency('libpng',
 
 librsvg_dep = dependency('librsvg-2.0',
   version: '>= 2.46.0',
-  required: true)
+  required: get_option('librsvg'))
 
 
 cc = meson.get_compiler('c')
@@ -70,6 +70,12 @@ output_lib = static_library('output',
   dependencies: libfreetype2_dep
 )
 
+ftcommon_lib_c_args = []
+
+if librsvg_dep.found()
+  ftcommon_lib_c_args += '-DHAVE_LIBRSVG'
+endif
+
 ftcommon_lib = static_library('ftcommon',
   [
     'src/ftcommon.c',
@@ -78,7 +84,7 @@ ftcommon_lib = static_library('ftcommon',
     'src/rsvg-port.c',
     'src/rsvg-port.h',
   ],
-  c_args: '-DHAVE_LIBRSVG',
+  c_args: ftcommon_lib_c_args,
   dependencies: [libpng_dep, librsvg_dep, libfreetype2_dep],
   include_directories: graph_include_dir,
   link_with: [common_lib, graph_lib],
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..57d2948
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,22 @@
+#
+# Meson options file for FreeType 2 test programs
+#
+
+# Copyright (C) 2022 by
+# David Turner, Robert Wilhelm, Werner Lemberg, and Charlie Jiang.
+#
+# This file is part of the FreeType project, and may only be used, modified,
+# and distributed under the terms of the FreeType project license,
+# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
+# indicate that you have read the license and understand and accept it
+# fully.
+
+
+# Building librsvg is tough on some platforms, so we add
+# a switch here.
+option('librsvg',
+  type: 'feature',
+  value: 'enabled',
+  description: 'Enabling librsvg to render OT-SVG glyphs')
+
+# EOF



reply via email to

[Prev in Thread] Current Thread [Next in Thread]