From 54dc5bcedebf019c2bc2fbcb22982bc058afbdff Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 20 May 2025 17:51:50 +0200 Subject: Configure wxWidgets in main wscript. So we can use it in both src/wx and test/wx. --- src/wx/wscript | 73 --------------------------------------------------------- wscript | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 73 deletions(-) diff --git a/src/wx/wscript b/src/wx/wscript index 6bb10511b..17ddfedef 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -200,79 +200,6 @@ sources = """ """ def configure(conf): - - 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) - try: conf.check_cfg(msg='Checking for RtAudio using pkg-config', package='rtaudio', diff --git a/wscript b/wscript index 97bd54a3e..c35a2e890 100644 --- a/wscript +++ b/wscript @@ -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 -- cgit v1.2.3