Merge branch 'master' of ssh://git.carlh.net/home/carl/git/libdcp
[libdcp.git] / test / wscript
1 #
2 #    Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
3 #
4 #    This file is part of libdcp.
5 #
6 #    libdcp 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 #    libdcp 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 libdcp.  If not, see <http://www.gnu.org/licenses/>.
18 #
19 #    In addition, as a special exception, the copyright holders give
20 #    permission to link the code of portions of this program with the
21 #    OpenSSL library under certain conditions as described in each
22 #    individual source file, and distribute linked combinations
23 #    including the two.
24 #
25 #    You must obey the GNU General Public License in all respects
26 #    for all of the code used other than OpenSSL.  If you modify
27 #    file(s) with this exception, you may extend this exception to your
28 #    version of the file(s), but you are not obligated to do so.  If you
29 #    do not wish to do so, delete this exception statement from your
30 #    version.  If you delete this exception statement from all source
31 #    files in the program, then also delete it here.
32 #
33
34 def configure(conf):
35     if conf.options.target_windows:
36         boost_lib_suffix = '-mt'
37     else:
38         boost_lib_suffix = ''
39
40     conf.check_cxx(fragment="""
41                             #define BOOST_TEST_MODULE Config test\n
42                             #include <boost/test/unit_test.hpp>\n
43                             int main() {}
44                             """,
45                    msg='Checking for boost unit testing library',
46                    lib='boost_unit_test_framework%s' % boost_lib_suffix,
47                    uselib_store='BOOST_TEST')
48
49     conf.env.prepend_value('LINKFLAGS', '-Lsrc')
50
51 def build(bld):
52     obj = bld(features='cxx cxxprogram')
53     obj.name   = 'tests'
54     obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM BOOST_DATETIME OPENJPEG CXML XMLSEC1 SNDFILE OPENMP ASDCPLIB_CTH LIBXML++ OPENSSL'
55     obj.cppflags = ['-fno-inline', '-fno-default-inline', '-fno-elide-constructors', '-g', '-O0']
56     if bld.is_defined('HAVE_GCOV'):
57         obj.use = 'libdcp%s_gcov' % bld.env.API_VERSION
58         obj.lib = ['gcov']
59         obj.cppflags.append('-ftest-coverage')
60         obj.cppflags.append('-fprofile-arcs')
61     else:
62         obj.use = 'libdcp%s' % bld.env.API_VERSION
63     obj.source = """
64                  asset_test.cc
65                  atmos_test.cc
66                  certificates_test.cc
67                  colour_test.cc
68                  colour_conversion_test.cc
69                  cpl_sar_test.cc
70                  dcp_font_test.cc
71                  dcp_test.cc
72                  dcp_time_test.cc
73                  decryption_test.cc
74                  effect_test.cc
75                  encryption_test.cc
76                  exception_test.cc
77                  fraction_test.cc
78                  frame_info_hash_test.cc
79                  gamma_transfer_function_test.cc
80                  interop_load_font_test.cc
81                  local_time_test.cc
82                  make_digest_test.cc
83                  markers_test.cc
84                  kdm_test.cc
85                  raw_convert_test.cc
86                  read_dcp_test.cc
87                  read_interop_subtitle_test.cc
88                  read_smpte_subtitle_test.cc
89                  reel_asset_test.cc
90                  recovery_test.cc
91                  rgb_xyz_test.cc
92                  round_trip_test.cc
93                  smpte_load_font_test.cc
94                  smpte_subtitle_test.cc
95                  sound_frame_test.cc
96                  test.cc
97                  util_test.cc
98                  utf8_test.cc
99                  write_subtitle_test.cc
100                  verify_test.cc
101                  """
102     obj.target = 'tests'
103     obj.install_path = ''
104
105     obj = bld(features='cxx cxxprogram')
106     obj.name   = 'subs_in_out'
107     obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM OPENJPEG CXML OPENMP ASDCPLIB_CTH XMLSEC1 OPENSSL'
108     obj.cppflags = ['-fno-inline', '-fno-default-inline', '-fno-elide-constructors', '-g', '-O0']
109     if bld.is_defined('HAVE_GCOV'):
110         obj.use = 'libdcp%s_gcov' % bld.env.API_VERSION
111         obj.lib = ['gcov']
112         obj.cppflags.append('-ftest-coverage')
113         obj.cppflags.append('-fprofile-arcs')
114     else:
115         obj.use = 'libdcp%s' % bld.env.API_VERSION
116     obj.source = 'subs_in_out.cc'
117     obj.target = 'subs_in_out'
118     obj.install_path = ''
119
120     obj = bld(features='cxx cxxprogram')
121     obj.name   = 'rewrite_subs'
122     obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM OPENJPEG CXML OPENMP ASDCPLIB_CTH XMLSEC1 OPENSSL'
123     obj.cppflags = ['-fno-inline', '-fno-default-inline', '-fno-elide-constructors', '-g', '-O0']
124     if bld.is_defined('HAVE_GCOV'):
125         obj.use = 'libdcp%s_gcov' % bld.env.API_VERSION
126         obj.lib = ['gcov']
127         obj.cppflags.append('-ftest-coverage')
128         obj.cppflags.append('-fprofile-arcs')
129     else:
130         obj.use = 'libdcp%s' % bld.env.API_VERSION
131     obj.source = 'rewrite_subs.cc'
132     obj.target = 'rewrite_subs'
133     obj.install_path = ''
134
135     obj = bld(features='cxx cxxprogram')
136     obj.name   = 'bench'
137     obj.uselib = 'BOOST_FILESYSTEM OPENJPEG CXML OPENMP ASDCPLIB_CTH XMLSEC1 OPENSSL LIBXML++'
138     obj.use = 'libdcp%s' % bld.env.API_VERSION
139     obj.source = 'bench.cc'
140     obj.target = 'bench'
141     obj.install_path = ''