[libsoup/wip/meson: 64/75] meson: Add fallback discovery for libxml2 and sqlite3 on MSVC



commit bd8a21a65fdb2d86741bab529663722819865c9d
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Nov 28 17:28:20 2017 +0800

    meson: Add fallback discovery for libxml2 and sqlite3 on MSVC
    
    The build system for Visual Studio for libxml2, as well as the typical
    amalgamation sources for sqlite3 that is used for Visual Studio builds
    do not generate pkg-config files.  So, on Visual Studio builds, we need
    to manually look for these dependencies when their pkg-config files
    cannot be found.
    
    This is done because hand-crafting pkg-config files is a tedious process
    that can be error-prone.

 meson.build |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/meson.build b/meson.build
index e667efa..238876e 100644
--- a/meson.build
+++ b/meson.build
@@ -28,9 +28,27 @@ glib_dep = [dependency('glib-2.0', version : '>=2.38'),
             dependency('gobject-2.0', version : '>=2.38'),
             dependency('gio-2.0', version : '>=2.38')]
 
-sqlite_dep = [dependency('sqlite3')]
+sqlite_dep = dependency('sqlite3', required: cc.get_id() != 'msvc')
+
+# Fallback check for sqlite on Visual Studio, which normally does not
+# generate a pkg-config file upon a successful build
+if not sqlite_dep.found()
+  cc.has_header('sqlite3.h')
+  cc.has_header('sqlite3ext.h')
+  sqlite_dep = cc.find_library('sqlite3')
+endif
+
+libxml_dep = dependency('libxml-2.0', required: cc.get_id() != 'msvc')
 
-libxml_dep = [dependency('libxml-2.0')]
+
+# Fallback check for libxml2 on Visual Studio, which normally does not
+# generate a pkg-config file upon a successful build
+if not libxml_dep.found()
+  # Note: The XML include dir needs to be within the INCLUDE envvar,
+  # such as <INCLUDEDIR>\libxml2
+  cc.has_header('libxml/tree.h')
+  libxml2_dep = cc.find_library('libxml2')
+endif
 
 cdata = configuration_data()
 


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