Merge branch '1.0' of git.carlh.net:git/libdcp into 1.0
[libdcp.git] / test / 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
19 def configure(conf):
20     if conf.options.target_windows:
21         boost_lib_suffix = '-mt'
22     else:
23         boost_lib_suffix = ''
24
25     conf.check_cxx(fragment="""
26                             #define BOOST_TEST_MODULE Config test\n
27                             #include <boost/test/unit_test.hpp>\n
28                             int main() {}
29                             """,
30                    msg='Checking for boost unit testing library',
31                    lib='boost_unit_test_framework%s' % boost_lib_suffix,
32                    uselib_store='BOOST_TEST')
33
34     conf.env.prepend_value('LINKFLAGS', '-Lsrc')
35
36 def build(bld):
37     obj = bld(features='cxx cxxprogram')
38     obj.name   = 'tests'
39     obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM BOOST_DATETIME OPENJPEG CXML XMLSEC1 SNDFILE OPENMP ASDCPLIB_CTH LIBXML++ OPENSSL'
40     obj.cppflags = ['-fno-inline', '-fno-default-inline', '-fno-elide-constructors', '-g', '-O0']
41     if bld.is_defined('HAVE_GCOV'):
42         obj.use = 'libdcp%s_gcov' % bld.env.API_VERSION
43         obj.lib = ['gcov']
44         obj.cppflags.append('-ftest-coverage')
45         obj.cppflags.append('-fprofile-arcs')
46     else:
47         obj.use = 'libdcp%s' % bld.env.API_VERSION
48     obj.source = """
49                  asset_test.cc
50                  atmos_test.cc
51                  certificates_test.cc
52                  colour_test.cc
53                  colour_conversion_test.cc
54                  cpl_sar_test.cc
55                  dcp_font_test.cc
56                  dcp_test.cc
57                  dcp_time_test.cc
58                  decryption_test.cc
59                  effect_test.cc
60                  encryption_test.cc
61                  exception_test.cc
62                  fraction_test.cc
63                  gamma_transfer_function_test.cc
64                  interop_load_font_test.cc
65                  local_time_test.cc
66                  make_digest_test.cc
67                  kdm_test.cc
68                  read_dcp_test.cc
69                  read_interop_subtitle_test.cc
70                  read_smpte_subtitle_test.cc
71                  reel_asset_test.cc
72                  recovery_test.cc
73                  rgb_xyz_test.cc
74                  round_trip_test.cc
75                  smpte_load_font_test.cc
76                  sound_frame_test.cc
77                  test.cc
78                  text_test.cc
79                  util_test.cc
80                  write_subtitle_test.cc
81                  """
82     obj.target = 'tests'
83     obj.install_path = ''
84
85     obj = bld(features='cxx cxxprogram')
86     obj.name   = 'subs_in_out'
87     obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM OPENJPEG CXML OPENMP ASDCPLIB_CTH XMLSEC1 OPENSSL'
88     obj.cppflags = ['-fno-inline', '-fno-default-inline', '-fno-elide-constructors', '-g', '-O0']
89     if bld.is_defined('HAVE_GCOV'):
90         obj.use = 'libdcp%s_gcov' % bld.env.API_VERSION
91         obj.lib = ['gcov']
92         obj.cppflags.append('-ftest-coverage')
93         obj.cppflags.append('-fprofile-arcs')
94     else:
95         obj.use = 'libdcp%s' % bld.env.API_VERSION
96     obj.source = 'subs_in_out.cc'
97     obj.target = 'subs_in_out'
98     obj.install_path = ''
99
100     obj = bld(features='cxx cxxprogram')
101     obj.name   = 'rewrite_subs'
102     obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM OPENJPEG CXML OPENMP ASDCPLIB_CTH XMLSEC1 OPENSSL'
103     obj.cppflags = ['-fno-inline', '-fno-default-inline', '-fno-elide-constructors', '-g', '-O0']
104     if bld.is_defined('HAVE_GCOV'):
105         obj.use = 'libdcp%s_gcov' % bld.env.API_VERSION
106         obj.lib = ['gcov']
107         obj.cppflags.append('-ftest-coverage')
108         obj.cppflags.append('-fprofile-arcs')
109     else:
110         obj.use = 'libdcp%s' % bld.env.API_VERSION
111     obj.source = 'rewrite_subs.cc'
112     obj.target = 'rewrite_subs'
113     obj.install_path = ''
114
115     obj = bld(features='cxx cxxprogram')
116     obj.name   = 'bench'
117     obj.uselib = 'BOOST_FILESYSTEM OPENJPEG CXML OPENMP ASDCPLIB_CTH XMLSEC1 OPENSSL LIBXML++'
118     obj.use = 'libdcp%s' % bld.env.API_VERSION
119     obj.source = 'bench.cc'
120     obj.target = 'bench'
121     obj.install_path = ''