mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 20:10:08 +01:00
Enable wxPython's build to check results of wxWidgets configuration
This commit is contained in:
@@ -36,6 +36,10 @@ Changes in this release include the following:
|
||||
|
||||
* Updated sip to version 4.19.16.
|
||||
|
||||
* Added helper functions to check results of wxWidgets configure during the
|
||||
build of wxPython. Currently used to determine if the wx webview library
|
||||
should be added to the link command. (#1138)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -576,6 +576,34 @@ class Configuration(object):
|
||||
return newLFLAGS
|
||||
|
||||
|
||||
def checkSetup(self, build_dir, flag):
|
||||
"""
|
||||
Find the setup.h generated by wxWidgets and return True if the given
|
||||
flag (eg. "wxUSE_WEBKIT") is enabled.
|
||||
"""
|
||||
def _find_setup():
|
||||
for dirpath, dirnames, filenames in os.walk(build_dir):
|
||||
for name in filenames:
|
||||
if name == 'setup.h':
|
||||
return opj(dirpath, name)
|
||||
return None
|
||||
|
||||
setup = _find_setup()
|
||||
with open(setup, 'rt') as f:
|
||||
for line in f:
|
||||
if flag in line:
|
||||
return '1' in line.split()
|
||||
return False
|
||||
|
||||
|
||||
def findWxConfigDir(self, wx_config):
|
||||
output = runcmd(wx_config + " --cflags", getOutput=True, echoCmd=False)
|
||||
# We expect that the first -I flag is the path we're looking for here
|
||||
configDir = output.split()[0]
|
||||
assert configDir.startswith('-I')
|
||||
configDir = configDir[2:]
|
||||
return configDir
|
||||
|
||||
|
||||
# We'll use a factory function so we can use the Configuration class as a singleton
|
||||
_config = None
|
||||
|
||||
9
wscript
9
wscript
@@ -183,6 +183,9 @@ def configure(conf):
|
||||
|
||||
|
||||
else:
|
||||
# TODO: Double-check that this works when using an installed wxWidgets
|
||||
wxConfigDir = cfg.findWxConfigDir(conf.options.wx_config)
|
||||
|
||||
# Configuration stuff for non-Windows ports using wx-config
|
||||
conf.env.CFLAGS_WX = list()
|
||||
conf.env.CXXFLAGS_WX = list()
|
||||
@@ -223,8 +226,12 @@ def configure(conf):
|
||||
uselib_store='WXGL', mandatory=True,
|
||||
msg='Finding libs for WXGL')
|
||||
|
||||
if cfg.checkSetup(wxConfigDir, 'wxUSE_WEBVIEW'):
|
||||
wv_libs = '--libs webview,core,net'
|
||||
else:
|
||||
wv_libs = '--libs core,net'
|
||||
conf.check_cfg(path=conf.options.wx_config, package='',
|
||||
args='--cxxflags --libs webview,core,net' + rpath,
|
||||
args='--cxxflags ' + wv_libs + rpath,
|
||||
uselib_store='WXWEBVIEW', mandatory=True,
|
||||
msg='Finding libs for WXWEBVIEW')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user