Another try at the static wx deps.
[dcpomatic.git] / src / wx / wscript
1 import os
2 import glob
3 from waflib import Logs
4 import i18n
5
6 sources = """
7           about_dialog.cc
8           audio_dialog.cc
9           audio_plot.cc
10           config_dialog.cc
11           dci_metadata_dialog.cc
12           dir_picker_ctrl.cc
13           film_editor.cc
14           film_viewer.cc
15           filter_dialog.cc
16           filter_view.cc
17           gain_calculator_dialog.cc
18           job_manager_view.cc
19           job_wrapper.cc
20           new_film_dialog.cc
21           properties_dialog.cc
22           server_dialog.cc
23           wx_util.cc
24           wx_ui_signaller.cc
25           """
26
27 def configure(conf):
28     wx_args = '--cppflags --cxxflags --libs'
29     if conf.env.STATIC:
30         wx_args += ' --static'
31
32     conf.check_cfg(msg='Checking for wxWidgets', package='', path=conf.options.wx_config, args=wx_args,
33                    uselib_store='WXWIDGETS', mandatory=True)
34  
35     if conf.env.STATIC:
36         # wx-config returns its static libraries as full paths, without -l prefixes, which I think confuses
37         # check_cfg(), so it ends up putting these libraries before even the .cc file when linking.
38         # This hack works around that.
39         extras = ['wx_gtk2u_xrc-2.9', 'wx_gtk2u_qa-2.9', 'wx_baseu_net-2.9', 'wx_gtk2u_html-2.9',
40                   'wx_gtk2u_adv-2.9', 'wx_gtk2u_core-2.9', 'wx_baseu_xml-2.9', 'wx_baseu-2.9']
41
42         for e in extras:
43             conf.env.STLIB_WXWIDGETS.append(e)
44
45     conf.in_msg = 1
46     wx_version = conf.check_cfg(package='', path=conf.options.wx_config, args='--version').strip()
47     conf.im_msg = 0
48     if wx_version != '2.9.4':
49         conf.fatal('wxwidgets version 2.9.4 is required; %s found' % wx_version)
50
51 def build(bld):
52     if bld.env.STATIC:
53         obj = bld(features = 'cxx cxxstlib')
54     else:
55         obj = bld(features = 'cxx cxxshlib')
56
57     obj.name   = 'libdvdomatic-wx'
58     obj.includes = [ '..' ]
59     obj.export_includes = ['.']
60     obj.uselib = 'WXWIDGETS'
61     if bld.env.TARGET_LINUX:
62         obj.uselib += ' GTK'
63     obj.use = 'libdvdomatic'
64     obj.source = sources
65     obj.target = 'dvdomatic-wx'
66
67     i18n.po_to_mo(os.path.join('src', 'wx'), 'libdvdomatic-wx', bld)
68
69 def pot(bld):
70     i18n.pot(os.path.join('src', 'wx'), sources, 'libdvdomatic-wx')
71
72 def pot_merge(bld):
73     i18n.pot_merge(os.path.join('src', 'wx'), 'libdvdomatic-wx')