883304effb68e8e3556bbb57eed1ce2e382d6799
[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_mapping_view.cc
10           audio_panel.cc
11           audio_plot.cc
12           config_dialog.cc
13           content_menu.cc
14           dci_metadata_dialog.cc
15           dir_picker_ctrl.cc
16           film_editor.cc
17           film_editor_panel.cc
18           film_viewer.cc
19           filter_dialog.cc
20           filter_view.cc
21           gain_calculator_dialog.cc
22           job_manager_view.cc
23           job_wrapper.cc
24           new_film_dialog.cc
25           properties_dialog.cc
26           repeat_dialog.cc
27           server_dialog.cc
28           subtitle_panel.cc
29           timecode.cc
30           timeline.cc
31           timeline_dialog.cc
32           timing_panel.cc
33           video_panel.cc
34           wx_util.cc
35           wx_ui_signaller.cc
36           """
37
38 def configure(conf):
39     args = '--cppflags --cxxflags'
40     if not conf.env.STATIC:
41         args += ' --libs'
42
43     conf.check_cfg(msg='Checking for wxWidgets', package='', path=conf.options.wx_config, args=args,
44                    uselib_store='WXWIDGETS', mandatory=True)
45
46     if conf.env.STATIC:
47         # wx-config returns its static libraries as full paths, without -l prefixes, which confuses
48         # check_cfg(), so just hard-code it all.
49         conf.env.STLIB_WXWIDGETS = ['wx_gtk2u_xrc-2.9', 'wx_gtk2u_qa-2.9', 'wx_baseu_net-2.9', 'wx_gtk2u_html-2.9',
50                                     'wx_gtk2u_adv-2.9', 'wx_gtk2u_core-2.9', 'wx_baseu_xml-2.9', 'wx_baseu-2.9']
51         conf.env.LIB_WXWIDGETS = ['tiff', 'SM', 'dl', 'jpeg', 'png', 'X11']
52  
53     conf.in_msg = 1
54     wx_version = conf.check_cfg(package='', path=conf.options.wx_config, args='--version').strip()
55     conf.im_msg = 0
56     if wx_version != '2.9.4' and wx_version != '2.9.5':
57         conf.fatal('wxwidgets version 2.9.4 or 2.9.5 is required; %s found' % wx_version)
58
59 def build(bld):
60     if bld.env.STATIC:
61         obj = bld(features = 'cxx cxxstlib')
62     else:
63         obj = bld(features = 'cxx cxxshlib')
64
65     obj.name   = 'libdcpomatic-wx'
66 #    obj.includes = [ '..' ]
67     obj.export_includes = ['..']
68     obj.uselib = 'WXWIDGETS'
69     if bld.env.TARGET_LINUX:
70         obj.uselib += ' GTK'
71     obj.use = 'libdcpomatic'
72     obj.source = sources
73     obj.target = 'dcpomatic-wx'
74
75     i18n.po_to_mo(os.path.join('src', 'wx'), 'libdcpomatic-wx', bld)
76
77 def pot(bld):
78     i18n.pot(os.path.join('src', 'wx'), sources, 'libdcpomatic-wx')
79
80 def pot_merge(bld):
81     i18n.pot_merge(os.path.join('src', 'wx'), 'libdcpomatic-wx')