Possibly inaccurate port of master; build system cleanups.
[dcpomatic.git] / src / tools / wscript
1 #
2 #    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
3 #
4 #    This program is free software; you can redistribute it and/or modify
5 #    it under the terms of the GNU General Public License as published by
6 #    the Free Software Foundation; either version 2 of the License, or
7 #    (at your option) any later version.
8 #
9 #    This program is distributed in the hope that it will be useful,
10 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 #    GNU General Public License for more details.
13 #
14 #    You should have received a copy of the GNU General Public License
15 #    along with this program; if not, write to the Free Software
16 #    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 #
18
19 import os
20 import glob
21 from waflib import Logs
22 import i18n
23
24 def configure(conf):
25     if conf.env.TARGET_WINDOWS:
26         conf.env.append_value('CXXFLAGS', ['-mconsole'])
27         conf.env.append_value('LINKFLAGS', ['-mconsole'])
28
29 def build(bld):
30     uselib =  'BOOST_THREAD BOOST_DATETIME OPENJPEG DCP XMLSEC CXML XMLPP AVFORMAT AVFILTER AVCODEC '
31     uselib += 'AVUTIL SWSCALE POSTPROC CURL BOOST_FILESYSTEM SSH WXWIDGETS'
32
33     if bld.env.TARGET_WINDOWS:
34         uselib += 'WINSOCK2'
35
36     for t in ['dcpomatic_cli', 'dcpomatic_server_cli', 'server_test', 'dcpomatic_kdm', 'dcpomatic_create']:
37         obj = bld(features = 'cxx cxxprogram')
38         obj.uselib = uselib
39         obj.includes = ['..']
40         obj.use    = ['libdcpomatic2']
41         obj.source = '%s.cc' % t
42         obj.target = t.replace('dcpomatic', 'dcpomatic2')
43         if t == 'server_test':
44             obj.install_path = None
45
46     if not bld.env.DISABLE_GUI:
47         for t in ['dcpomatic', 'dcpomatic_batch', 'dcpomatic_server']:
48             obj = bld(features = 'cxx cxxprogram')
49             obj.uselib = uselib
50             if bld.env.BUILD_STATIC or bld.env.TARGET_LINUX:
51                 obj.uselib += ' GTK'
52             obj.includes = ['..']
53             obj.use    = ['libdcpomatic2', 'libdcpomatic2-wx']
54             obj.source = '%s.cc' % t
55             if bld.env.TARGET_WINDOWS:
56                 obj.source += ' ../../platform/windows/dcpomatic.rc'
57             obj.target = t.replace('dcpomatic', 'dcpomatic2')
58
59         i18n.po_to_mo(os.path.join('src', 'tools'), 'dcpomatic2', bld)
60
61 def pot(bld):
62     i18n.pot(os.path.join('src', 'tools'), 'dcpomatic.cc dcpomatic_batch.cc', 'dcpomatic')
63
64 def pot_merge(bld):
65     i18n.pot_merge(os.path.join('src', 'tools'), 'dcpomatic')