Skip to content

Commit

Permalink
enable env vars QT5_ROOT, QT5_BINDIR, QT5_LIBDIR, QT5_INCLUDES #31
Browse files Browse the repository at this point in the history
  • Loading branch information
pustotnik committed Jan 31, 2022
1 parent a79c8e0 commit b4b5373
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
30 changes: 26 additions & 4 deletions src/zenmake/zm/features/qt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@

import os

from waflib import Errors as waferror, Options
from waflib import Errors as waferror
from waflib.Task import Task
from waflib.TaskGen import feature, before, after
from waflib.Tools import qt5
from zm.constants import PLATFORM
from zm import error, utils, cli
from zm import error, utils
from zm.features import precmd, postcmd
from zm.pathutils import getNativePath, getNodesFromPathsConf
from zm.waf.assist import allowTGenAttrs
from zm.waf import assist
from zm.waf.taskgen import isolateExtHandler

_relpath = os.path.relpath
_commonpath = os.path.commonpath

# Allow the 'moc' param for Waf taskgen instances
allowTGenAttrs(['moc'])
assist.allowTGenAttrs(['moc'])

# Isolate existing extension handlers to avoid conflicts with other tools
# and to avoid use of tools in tasks where these tools are inappropriate.
Expand All @@ -50,6 +50,28 @@

QRC_LINE_TEMPL = """ <file alias="%s">%s</file>"""

QT5_SYSENV_VARS = ('QT5_ROOT', 'QT5_BINDIR', 'QT5_LIBDIR', 'QT5_INCLUDES')

def _wrapMonEnvVarGetter(origFunc):
def execute():
return origFunc() + QT5_SYSENV_VARS
execute.__doc__ = origFunc.__doc__
return execute

assist.getMonitoredEnvVarNames = _wrapMonEnvVarGetter(assist.getMonitoredEnvVarNames)

@postcmd('init')
def postInit(_):
""" Extra init after wscript.init """

# Prevent impact on Waf code: ZenMake uses QT5_BINDIR instead of QT5_BIN
os.environ.pop('QT5_BIN', None)

# adjust QT5_BINDIR to Waf code
qtbindir = os.environ.get('QT5_BINDIR')
if qtbindir:
os.environ['QT5_BIN'] = qtbindir

def _configureQt5(conf):
"""
Alternative version of 'configure' from waflib.Tools.qt5
Expand Down
1 change: 1 addition & 0 deletions src/zenmake/zm/features/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def execute(*args, **kwargs):
testsConfigured = zmMetaConf.attrs.get('tests-configured', False)
return not testsConfigured

execute.__doc__ = _needToConfigure.__doc__
return execute

assist.needToConfigure = _wrapNeedToConfigure(assist.needToConfigure)
Expand Down

0 comments on commit b4b5373

Please sign in to comment.