5fe7fc802eb79e4e8b54dbd90485de10736d61e3
[libdcp.git] / src / wscript
1 #
2 #    Copyright (C) 2012-2016 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 #    In addition, as a special exception, the copyright holders give
19 #    permission to link the code of portions of this program with the
20 #    OpenSSL library under certain conditions as described in each
21 #    individual source file, and distribute linked combinations
22 #    including the two.
23 #
24 #    You must obey the GNU General Public License in all respects
25 #    for all of the code used other than OpenSSL.  If you modify
26 #    file(s) with this exception, you may extend this exception to your
27 #    version of the file(s), but you are not obligated to do so.  If you
28 #    do not wish to do so, delete this exception statement from your
29 #    version.  If you delete this exception statement from all source
30 #    files in the program, then also delete it here.
31 #
32
33 from waflib import TaskGen
34
35 def build(bld):
36     source = """
37              asset.cc
38              asset_factory.cc
39              asset_writer.cc
40              atmos_asset.cc
41              atmos_asset_writer.cc
42              certificate_chain.cc
43              certificate.cc
44              chromaticity.cc
45              colour_conversion.cc
46              cpl.cc
47              data.cc
48              dcp.cc
49              dcp_time.cc
50              decrypted_kdm.cc
51              decrypted_kdm_key.cc
52              encrypted_kdm.cc
53              exceptions.cc
54              file.cc
55              font_asset.cc
56              gamma_transfer_function.cc
57              identity_transfer_function.cc
58              interop_load_font_node.cc
59              interop_subtitle_asset.cc
60              j2k.cc
61              key.cc
62              local_time.cc
63              locale_convert.cc
64              metadata.cc
65              modified_gamma_transfer_function.cc
66              mono_picture_asset.cc
67              mono_picture_asset_writer.cc
68              mono_picture_frame.cc
69              mxf.cc
70              name_format.cc
71              object.cc
72              openjpeg_image.cc
73              picture_asset.cc
74              picture_asset_writer.cc
75              pkl.cc
76              raw_convert.cc
77              reel.cc
78              reel_asset.cc
79              reel_atmos_asset.cc
80              reel_closed_caption_asset.cc
81              reel_mono_picture_asset.cc
82              reel_mxf.cc
83              reel_picture_asset.cc
84              reel_sound_asset.cc
85              reel_stereo_picture_asset.cc
86              reel_subtitle_asset.cc
87              ref.cc
88              rgb_xyz.cc
89              s_gamut3_transfer_function.cc
90              smpte_load_font_node.cc
91              smpte_subtitle_asset.cc
92              sound_asset.cc
93              sound_asset_writer.cc
94              sound_frame.cc
95              stereo_picture_asset.cc
96              stereo_picture_asset_writer.cc
97              stereo_picture_frame.cc
98              subtitle.cc
99              subtitle_asset.cc
100              subtitle_asset_internal.cc
101              subtitle_image.cc
102              subtitle_string.cc
103              transfer_function.cc
104              types.cc
105              util.cc
106              verify.cc
107              version.cc
108              """
109
110     headers = """
111               asset.h
112               asset_reader.h
113               asset_writer.h
114               atmos_asset.h
115               atmos_asset_reader.h
116               atmos_asset_writer.h
117               atmos_frame.h
118               certificate_chain.h
119               certificate.h
120               chromaticity.h
121               colour_conversion.h
122               cpl.h
123               crypto_context.h
124               dcp.h
125               dcp_assert.h
126               dcp_time.h
127               data.h
128               decrypted_kdm.h
129               decrypted_kdm_key.h
130               encrypted_kdm.h
131               exceptions.h
132               font_asset.h
133               frame.h
134               gamma_transfer_function.h
135               identity_transfer_function.h
136               interop_load_font_node.h
137               interop_subtitle_asset.h
138               j2k.h
139               key.h
140               load_font_node.h
141               local_time.h
142               locale_convert.h
143               metadata.h
144               mono_picture_asset.h
145               mono_picture_asset_reader.h
146               mono_picture_frame.h
147               modified_gamma_transfer_function.h
148               mxf.h
149               name_format.h
150               object.h
151               openjpeg_image.h
152               picture_asset.h
153               picture_asset_writer.h
154               pkl.h
155               raw_convert.h
156               rgb_xyz.h
157               reel.h
158               reel_asset.h
159               reel_atmos_asset.h
160               reel_closed_caption_asset.h
161               reel_mono_picture_asset.h
162               reel_mxf.h
163               reel_picture_asset.h
164               reel_sound_asset.h
165               reel_stereo_picture_asset.h
166               reel_subtitle_asset.h
167               ref.h
168               s_gamut3_transfer_function.h
169               smpte_load_font_node.h
170               smpte_subtitle_asset.h
171               sound_frame.h
172               sound_asset.h
173               sound_asset_reader.h
174               sound_asset_writer.h
175               stereo_picture_asset.h
176               stereo_picture_asset_reader.h
177               stereo_picture_asset_writer.h
178               stereo_picture_frame.h
179               subtitle.h
180               subtitle_asset.h
181               subtitle_image.h
182               subtitle_string.h
183               transfer_function.h
184               types.h
185               util.h
186               verify.h
187               version.h
188               """
189
190     # Main library
191     if bld.env.STATIC:
192         obj = bld(features='cxx cxxstlib')
193     else:
194         obj = bld(features='cxx cxxshlib')
195     obj.name = 'libdcp%s' % bld.env.API_VERSION
196     obj.target = 'dcp%s' % bld.env.API_VERSION
197     obj.export_includes = ['.']
198     obj.uselib = 'BOOST_FILESYSTEM BOOST_SIGNALS2 BOOST_DATETIME OPENSSL SIGC++ LIBXML++ OPENJPEG CXML XMLSEC1 ASDCPLIB_CTH'
199     obj.source = source
200
201     # Library for gcov
202     if bld.is_defined('HAVE_GCOV'):
203         obj = bld(features='cxx cxxstlib')
204         obj.name = 'libdcp%s_gcov' % bld.env.API_VERSION
205         obj.target = 'dcp%s_gcov' % bld.env.API_VERSION
206         obj.export_includes = ['.']
207         obj.uselib = 'BOOST_FILESYSTEM BOOST_SIGNALS2 BOOST_DATETIME OPENSSL SIGC++ LIBXML++ OPENJPEG CXML XMLSEC1 ASDCPLIB_CTH'
208         obj.use = 'libkumu-libdcp%s libasdcp-libdcp%s' % (bld.env.API_VERSION, bld.env.API_VERSION)
209         obj.source = source
210         obj.cppflags = ['-fprofile-arcs', '-ftest-coverage', '-fno-inline', '-fno-default-inline', '-fno-elide-constructors', '-g', '-O0']
211
212     bld.install_files('${PREFIX}/include/libdcp%s/dcp' % bld.env.API_VERSION, headers)
213     if bld.env.STATIC:
214         bld.install_files('${PREFIX}/lib', 'libdcp%s.a' % bld.env.API_VERSION)