Try to fix static linking of DCP-o-matic libs with the GL stuff.
[dcpomatic.git] / src / tools / wscript
1 #
2 #    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
3 #
4 #    This file is part of DCP-o-matic.
5 #
6 #    DCP-o-matic is free software; you can redistribute it and/or modify
7 #    it under the terms of the GNU General Public License as published by
8 #    the Free Software Foundation; either version 2 of the License, or
9 #    (at your option) any later version.
10 #
11 #    DCP-o-matic is distributed in the hope that it will be useful,
12 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 #    GNU General Public License for more details.
15 #
16 #    You should have received a copy of the GNU General Public License
17 #    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18 #
19
20 import os
21 import glob
22 from waflib import Logs
23 import i18n
24
25 def configure(conf):
26     if conf.env.TARGET_WINDOWS:
27         conf.env.append_value('CXXFLAGS', ['-mconsole'])
28         conf.env.append_value('LINKFLAGS', ['-mconsole'])
29
30 def build(bld):
31     uselib =  'BOOST_THREAD BOOST_DATETIME DCP XMLSEC CXML XMLPP AVFORMAT AVFILTER AVCODEC '
32     uselib += 'AVUTIL SWSCALE SWRESAMPLE POSTPROC CURL BOOST_FILESYSTEM SSH ZIP CAIROMM FONTCONFIG PANGOMM SUB '
33     uselib += 'SNDFILE SAMPLERATE BOOST_REGEX ICU NETTLE RTAUDIO PNG '
34
35     if bld.env.TARGET_WINDOWS:
36         uselib += 'WINSOCK2 DBGHELP SHLWAPI MSWSOCK BOOST_LOCALE WINSOCK2 OLE32 DSOUND WINMM KSUSER '
37
38     cli_tools = []
39     if bld.env.VARIANT != "swaroop":
40         cli_tools = ['dcpomatic_cli', 'dcpomatic_server_cli', 'server_test', 'dcpomatic_kdm_cli', 'dcpomatic_create']
41     else:
42         cli_tools = ['dcpomatic_ecinema', 'dcpomatic_uuid']
43
44     for t in cli_tools:
45         obj = bld(features='cxx cxxprogram')
46         obj.uselib = uselib
47         obj.includes = ['..']
48         obj.use    = ['libdcpomatic2']
49         obj.source = '%s.cc' % t
50         obj.target = t.replace('dcpomatic', 'dcpomatic2')
51         if t == 'server_test':
52             obj.install_path = None
53
54     gui_tools = []
55     if not bld.env.DISABLE_GUI:
56         if bld.env.VARIANT == 'swaroop':
57             gui_tools = ['dcpomatic_player', 'dcpomatic_playlist']
58         else:
59             gui_tools = ['dcpomatic', 'dcpomatic_batch', 'dcpomatic_server', 'dcpomatic_kdm', 'dcpomatic_player', 'dcpomatic_playlist']
60
61     for t in gui_tools:
62         obj = bld(features='cxx cxxprogram')
63         obj.uselib = uselib
64         if bld.env.BUILD_STATIC or bld.env.TARGET_LINUX:
65             obj.uselib += ' GTK'
66         obj.uselib += ' WXWIDGETS GL GLU'
67         obj.includes = ['..']
68         obj.use    = ['libdcpomatic2', 'libdcpomatic2-wx']
69         obj.source = '%s.cc' % t
70         if bld.env.TARGET_WINDOWS:
71             obj.source += ' ../../platform/windows/%s.rc' % t
72         obj.target = t.replace('dcpomatic', 'dcpomatic2')
73
74     i18n.po_to_mo(os.path.join('src', 'tools'), 'dcpomatic2', bld)
75
76 def pot(bld):
77     i18n.pot(os.path.join('src', 'tools'), 'dcpomatic.cc dcpomatic_batch.cc dcpomatic_kdm.cc dcpomatic_server.cc dcpomatic_player.cc dcpomatic_playlist.cc', 'dcpomatic')
78
79 def pot_merge(bld):
80     i18n.pot_merge(os.path.join('src', 'tools'), 'dcpomatic')