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



commit 1ea9790a59c8094df56c74bd40ca4baaa321a585
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]