aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/Dependencies.md10
-rw-r--r--mesonbuild/dependencies/__init__.py3
-rw-r--r--mesonbuild/dependencies/base.py2
-rw-r--r--mesonbuild/dependencies/misc.py38
-rw-r--r--test cases/frameworks/21 libwmf/libwmf_prog.c8
-rw-r--r--test cases/frameworks/21 libwmf/meson.build9
6 files changed, 69 insertions, 1 deletions
diff --git a/docs/markdown/Dependencies.md b/docs/markdown/Dependencies.md
index c3f007f..3aa82b4 100644
--- a/docs/markdown/Dependencies.md
+++ b/docs/markdown/Dependencies.md
@@ -153,6 +153,16 @@ automatically:
cups_dep = dependency('cups', version : '>=1.4')
```
+## LibWMF
+
+The libwmf library does not ship with pkg-config at the time or writing
+but instead it has its own `libwmf-config` util. Meson will use it
+automatically:
+
+```meson
+libwmf_dep = dependency('libwmf', version : '>=0.2.8')
+```
+
## Declaring your own
You can declare your own dependency objects that can be used
diff --git a/mesonbuild/dependencies/__init__.py b/mesonbuild/dependencies/__init__.py
index aa29190..4dc2b27 100644
--- a/mesonbuild/dependencies/__init__.py
+++ b/mesonbuild/dependencies/__init__.py
@@ -17,7 +17,7 @@ from .base import ( # noqa: F401
ExternalDependency, ExternalLibrary, ExtraFrameworkDependency, InternalDependency,
PkgConfigDependency, find_external_dependency, get_dep_identifier, packages, _packages_accept_language)
from .dev import GMockDependency, GTestDependency, LLVMDependency, ValgrindDependency
-from .misc import (BoostDependency, MPIDependency, Python3Dependency, ThreadDependency, PcapDependency, CupsDependency)
+from .misc import (BoostDependency, MPIDependency, Python3Dependency, ThreadDependency, PcapDependency, CupsDependency, LibWmfDependency)
from .platform import AppleFrameworks
from .ui import GLDependency, GnuStepDependency, Qt4Dependency, Qt5Dependency, SDL2Dependency, WxDependency, VulkanDependency
@@ -36,6 +36,7 @@ packages.update({
'threads': ThreadDependency,
'pcap': PcapDependency,
'cups': CupsDependency,
+ 'libwmf': LibWmfDependency,
# From platform:
'appleframeworks': AppleFrameworks,
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 9913a0b..05170ff 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -48,6 +48,8 @@ class DependencyMethods(Enum):
PCAPCONFIG = 'pcap-config'
# Detect using cups-config
CUPSCONFIG = 'cups-config'
+ # Detect using libwmf-config
+ LIBWMFCONFIG = 'libwmf-config'
# This is only supported on OSX - search the frameworks directory by name.
EXTRAFRAMEWORK = 'extraframework'
# Detect using the sysconfig module.
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index a24c873..e65675b 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -761,6 +761,44 @@ class CupsDependency(ExternalDependency):
else:
return [DependencyMethods.PKGCONFIG, DependencyMethods.CUPSCONFIG]
+
+class LibWmfDependency(ExternalDependency):
+ def __init__(self, environment, kwargs):
+ super().__init__('libwmf', environment, None, kwargs)
+ if DependencyMethods.PKGCONFIG in self.methods:
+ try:
+ kwargs['required'] = False
+ pcdep = PkgConfigDependency('libwmf', environment, kwargs)
+ if pcdep.found():
+ self.type_name = 'pkgconfig'
+ self.is_found = True
+ self.compile_args = pcdep.get_compile_args()
+ self.link_args = pcdep.get_link_args()
+ self.version = pcdep.get_version()
+ return
+ except Exception as e:
+ mlog.debug('LibWmf not found via pkgconfig. Trying next, error was:', str(e))
+ if DependencyMethods.LIBWMFCONFIG in self.methods:
+ libwmfconf = shutil.which('libwmf-config')
+ if libwmfconf:
+ stdo = Popen_safe(['libwmf-config', '--cflags'])[1]
+ self.compile_args = stdo.strip().split()
+ stdo = Popen_safe(['libwmf-config', '--libs'])[1]
+ self.link_args = stdo.strip().split()
+ stdo = Popen_safe(['libwmf-config', '--version'])[1]
+ self.version = stdo.strip()
+ self.is_found = True
+ mlog.log('Dependency', mlog.bold('libwmf'), 'found:',
+ mlog.green('YES'), '(%s)' % libwmfconf)
+ return
+ mlog.debug('Could not find libwmf-config binary, trying next.')
+
+ def get_methods(self):
+ if mesonlib.is_osx():
+ return [DependencyMethods.PKGCONFIG, DependencyMethods.LIBWMFCONFIG, DependencyMethods.EXTRAFRAMEWORK]
+ else:
+ return [DependencyMethods.PKGCONFIG, DependencyMethods.LIBWMFCONFIG]
+
# Generated with boost_names.py
BOOST_LIBS = [
'boost_atomic',
diff --git a/test cases/frameworks/21 libwmf/libwmf_prog.c b/test cases/frameworks/21 libwmf/libwmf_prog.c
new file mode 100644
index 0000000..4e6294c
--- /dev/null
+++ b/test cases/frameworks/21 libwmf/libwmf_prog.c
@@ -0,0 +1,8 @@
+#include <libwmf/api.h>
+
+int
+main()
+{
+ wmf_help();
+ return 0;
+}
diff --git a/test cases/frameworks/21 libwmf/meson.build b/test cases/frameworks/21 libwmf/meson.build
new file mode 100644
index 0000000..a7d9263
--- /dev/null
+++ b/test cases/frameworks/21 libwmf/meson.build
@@ -0,0 +1,9 @@
+project('libwmf test', 'c')
+
+libwmf_dep = dependency('libwmf', version : '>=3.0')
+libwmf_ver = libwmf_dep.version()
+assert(libwmf_ver.split('.').length() > 1, 'libwmf version is "@0@"'.format(libwmf_ver))
+message('libwmf version is "@0@"'.format(libwmf_ver))
+e = executable('libwmf_prog', 'libwmf_prog.c', dependencies : libwmf_dep)
+
+test('libwmftest', e)