diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2015-01-12 00:29:20 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2015-01-12 00:29:20 +0200 |
commit | 59b7fa8ed3e8506cc44491873aa79a11b4db9c3d (patch) | |
tree | 81c18f21c9601ff79f5f25c0d3847242a87be8df /dependencies.py | |
parent | 646afcac0d82edcb5dff90395654c63a4a268c79 (diff) | |
download | meson-59b7fa8ed3e8506cc44491873aa79a11b4db9c3d.zip meson-59b7fa8ed3e8506cc44491873aa79a11b4db9c3d.tar.gz meson-59b7fa8ed3e8506cc44491873aa79a11b4db9c3d.tar.bz2 |
Added support for wxwidgets. Closes #27.
Diffstat (limited to 'dependencies.py')
-rw-r--r-- | dependencies.py | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/dependencies.py b/dependencies.py index 4740719..20f4f2f 100644 --- a/dependencies.py +++ b/dependencies.py @@ -135,6 +135,72 @@ class PkgConfigDependency(Dependency): def found(self): return self.is_found +class WxDependency(Dependency): + wx_found = None + + def __init__(self, kwargs): + Dependency.__init__(self) + if WxDependency.wx_found is None: + self.check_wxconfig() + + if not WxDependency.wx_found: + raise DependencyException('Wx-config not found.') + self.is_found = False + p = subprocess.Popen(['wx-config', '--version'], stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + out = p.communicate()[0] + if p.returncode != 0: + mlog.log('Dependency wxwidgets found:', mlog.red('NO')) + self.cargs = [] + self.libs = [] + self.is_found = False + else: + mlog.log('Dependency wxwidgets found:', mlog.green('YES')) + self.is_found = True + self.modversion = out.decode().strip() + # wx-config seems to have a cflags as well but since it requires C++, + # this should be good, at least for now. + p = subprocess.Popen(['wx-config', '--cxxflags'], stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + out = p.communicate()[0] + if p.returncode != 0: + raise RuntimeError('Could not generate cargs for wxwidgets.') + self.cargs = out.decode().split() + + p = subprocess.Popen(['wx-config', '--libs'], stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + out = p.communicate()[0] + if p.returncode != 0: + raise RuntimeError('Could not generate libs for wxwidgets.') + self.libs = out.decode().split() + + def get_modversion(self): + return self.modversion + + def get_compile_args(self): + return self.cargs + + def get_link_args(self): + return self.libs + + def check_wxconfig(self): + try: + p = subprocess.Popen(['wx-config', '--version'], stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + out = p.communicate()[0] + if p.returncode == 0: + mlog.log('Found wx-config:', mlog.bold(shutil.which('wx-config')), + '(%s)' % out.decode().strip()) + WxDependency.wx_found = True + return + except Exception: + pass + WxDependency.wxconfig_found = False + mlog.log('Found wx-config:', mlog.red('NO')) + + def found(self): + return self.is_found + class ExternalProgram(): def __init__(self, name, fullpath=None, silent=False, search_dir=None): self.name = name @@ -730,4 +796,5 @@ packages = {'boost': BoostDependency, 'Qt5': Qt5Dependency, # Qt people sure do love their upper case. 'gnustep': GnuStepDependency, 'appleframeworks': AppleFrameworks, + 'wxwidgets' : WxDependency, } |