freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] rsvg-cond 989321e: [meson] Add option to disable librs


From: Werner Lemberg
Subject: [freetype2-demos] rsvg-cond 989321e: [meson] Add option to disable librsvg dependency.
Date: Thu, 7 Jul 2022 03:26:06 -0400 (EDT)

branch: rsvg-cond
commit 989321e206ab2d2b4780d1fafcf7cbcbfe7b4060
Author: Charlie Jiang <w@chariri.moe>
Commit: Charlie Jiang <w@chariri.moe>

    [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 `enable_librsvg` option, defaulting to `true`.
    
    * meson.build: Honor the option above.
---
 meson.build       | 12 +++++++++---
 meson_options.txt | 18 ++++++++++++++++++
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index da25dbc..60b6cd3 100644
--- a/meson.build
+++ b/meson.build
@@ -18,7 +18,7 @@
 # hard-code the string.
 project('freetype-demos', 'c', 'cpp',
   version: '2.12.1')
-
+  
 
 # Access to the FreeType 2 source tree is required, since some of the demo
 # programs rely on internal headers (e.g., `ttdebug`).  See `README.meson`
@@ -32,7 +32,7 @@ libpng_dep = dependency('libpng',
 
 librsvg_dep = dependency('librsvg-2.0',
   version: '>= 2.46.0',
-  required: true)
+  required: get_option('enable_librsvg'))
 
 
 cc = meson.get_compiler('c')
@@ -70,6 +70,12 @@ output_lib = static_library('output',
   dependencies: libfreetype2_dep
 )
 
+ftcommon_lib_c_args = []
+
+if get_option('enable_librsvg')
+  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..30df040
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,18 @@
+#
+# 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('enable_librsvg', type : 'boolean', value : true,
+  description : 'Enabling librsvg to render OT-SVG glyphs')



reply via email to

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