diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-05-20 17:51:50 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-05-24 00:43:55 +0200 |
| commit | 54dc5bcedebf019c2bc2fbcb22982bc058afbdff (patch) | |
| tree | 6c579fa92b3e60b794de8aa103ae4ed279353bd0 /wscript | |
| parent | a57401251cd49841f892139144cc6b3c48f53fb9 (diff) | |
Configure wxWidgets in main wscript.
So we can use it in both src/wx and test/wx.
Diffstat (limited to 'wscript')
| -rw-r--r-- | wscript | 74 |
1 files changed, 74 insertions, 0 deletions
@@ -670,6 +670,80 @@ def configure(conf): define_name="DCPOMATIC_HAVE_SQLITE3_PREPARE_V3", mandatory=False) + # wxWidgets + + if not conf.env.DISABLE_GUI: + wx_libs = 'core,richtext,adv,html,xml,propgrid' + + if conf.options.wx_config is not None: + wx_config = conf.options.wx_config + conf.check_cfg(msg='Checking for wxWidgets using %s' % wx_config, + package='', + path=wx_config, + args='--cppflags --cxxflags --libs %s --gl-libs' % wx_libs, + uselib_store='WXWIDGETS', + mandatory=True) + else: + try: + wx_config = '/usr/lib64/wx/config/gtk2-unicode-3.0' + conf.check_cfg(msg='Checking for wxWidgets using gtk2-unicode-3.0', + package='', + path=wx_config, + args='--cppflags --cxxflags --libs %s --gl-libs' % wx_libs, + uselib_store='WXWIDGETS', + mandatory=True) + except: + try: + wx_config = 'wx-config-3.0-gtk2' + conf.check_cfg(msg='Checking for wxWidgets using wx-config-3.0-gtk2', + package='', + path=wx_config, + args='--cppflags --cxxflags --libs %s --gl-libs' % wx_libs, + uselib_store='WXWIDGETS', + mandatory=True) + except: + wx_config = 'wx-config' + conf.check_cfg(msg='Checking for wxWidgets using wx-config', + package='', + path=wx_config, + args='--cppflags --cxxflags --libs %s --gl-libs' % wx_libs, + uselib_store='WXWIDGETS', + mandatory=True) + + if conf.env.TARGET_LINUX: + conf.env.append_value('CXXFLAGS', ['-DGL_GLEXT_PROTOTYPES', '-DGLX_GLXEXT_PROTOTYPES']) + if conf.env.TARGET_WINDOWS_64 or conf.env.TARGET_WINDOWS_32: + conf.env.append_value('CXXFLAGS', ['-DWGL_WGLEXT_PROTOTYPES']) + conf.env.append_value('CXXFLAGS', ['-DwxNO_UNSAFE_WXSTRING_CONV', '-DwxNO_IMPLICIT_WXSTRING_ENCODING']) + + if conf.options.static_wxwidgets: + # wx-config returns its static libraries as full paths, without -l prefixes, which confuses + # check_cfg(). It puts the static libraries into LINKFLAGS_WXWIDGETS, so fish them out. + stlibs = [] + new_linkflags = [] + stlib_paths = [] + for f in conf.env.LINKFLAGS_WXWIDGETS: + if f.startswith('/'): + d = os.path.dirname(f) + if not d in stlib_paths: + stlib_paths.append(d) + stlibs.append(os.path.basename(f)[3:-2]) + else: + new_linkflags.append(f) + + conf.env.STLIB_WXWIDGETS = stlibs + conf.env.LINKFLAGS_WXWIDGETS = new_linkflags + conf.env.STLIBPATH_WXWIDGETS = stlib_paths + + conf.in_msg = 1 + wx_version = conf.check_cfg(package='wxwidgets', path=wx_config, args='--version').strip() + conf.in_msg = 0 + if not wx_version.startswith('3.'): + conf.fatal('wxwidgets version 3.x.y is required; %s found' % wx_version) + + config = conf.check_cfg(package='wxwidgets', path=wx_config, args='--selected-config').strip() + if config.find('gtk2') != -1: + conf.check_cfg(package='gtk+-2.0', args='--cflags --libs', uselib_store='GTK', mandatory=True) # Other stuff |
