summaryrefslogtreecommitdiff
path: root/test/wscript
blob: 8806388f7722be6e9e64bd7691d709f53261be98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#
#    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

def configure(conf):
    if conf.options.target_windows:
        boost_lib_suffix = '-mt'
    else:
        boost_lib_suffix = ''

    conf.check_cxx(fragment="""
                            #define BOOST_TEST_MODULE Config test\n
    			    #include <boost/test/unit_test.hpp>\n
                            int main() {}
                            """,
                   msg='Checking for boost unit testing library',
                   lib='boost_unit_test_framework%s' % boost_lib_suffix,
                   uselib_store='BOOST_TEST')

    conf.env.prepend_value('LINKFLAGS', '-Lsrc')

def build(bld):
    obj = bld(features='cxx cxxprogram')
    obj.name   = 'tests'
    obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM BOOST_DATETIME OPENJPEG CXML XMLSEC1 SNDFILE OPENMP ASDCPLIB_CTH LIBXML++ OPENSSL'
    obj.cppflags = ['-fno-inline', '-fno-default-inline', '-fno-elide-constructors', '-g', '-O0']
    if bld.is_defined('HAVE_GCOV'):
        obj.use = 'libdcp%s_gcov' % bld.env.API_VERSION
        obj.lib = ['gcov']
        obj.cppflags.append('-ftest-coverage')
        obj.cppflags.append('-fprofile-arcs')
    else:
        obj.use = 'libdcp%s' % bld.env.API_VERSION
    obj.source = """
                 asset_test.cc
                 certificates_test.cc
                 colour_test.cc
                 colour_conversion_test.cc
                 cpl_sar_test.cc
                 dcp_font_test.cc
                 dcp_test.cc
                 dcp_time_test.cc
                 decryption_test.cc
                 effect_test.cc
                 encryption_test.cc
                 exception_test.cc
                 fraction_test.cc
                 gamma_transfer_function_test.cc
                 interop_load_font_test.cc
                 local_time_test.cc
                 kdm_test.cc
                 read_dcp_test.cc
                 read_interop_subtitle_test.cc
                 read_smpte_subtitle_test.cc
                 reel_asset_test.cc
                 recovery_test.cc
                 rgb_xyz_test.cc
                 round_trip_test.cc
                 smpte_load_font_test.cc
                 sound_frame_test.cc
                 test.cc
                 text_test.cc
                 util_test.cc
                 write_subtitle_test.cc
                 """
    obj.target = 'tests'
    obj.install_path = ''

    obj = bld(features='cxx cxxprogram')
    obj.name   = 'subs_in_out'
    obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM OPENJPEG CXML OPENMP ASDCPLIB_CTH XMLSEC1 OPENSSL'
    obj.cppflags = ['-fno-inline', '-fno-default-inline', '-fno-elide-constructors', '-g', '-O0']
    if bld.is_defined('HAVE_GCOV'):
        obj.use = 'libdcp%s_gcov' % bld.env.API_VERSION
        obj.lib = ['gcov']
        obj.cppflags.append('-ftest-coverage')
        obj.cppflags.append('-fprofile-arcs')
    else:
        obj.use = 'libdcp%s' % bld.env.API_VERSION
    obj.source = 'subs_in_out.cc'
    obj.target = 'subs_in_out'
    obj.install_path = ''

    obj = bld(features='cxx cxxprogram')
    obj.name   = 'rewrite_subs'
    obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM OPENJPEG CXML OPENMP ASDCPLIB_CTH XMLSEC1 OPENSSL'
    obj.cppflags = ['-fno-inline', '-fno-default-inline', '-fno-elide-constructors', '-g', '-O0']
    if bld.is_defined('HAVE_GCOV'):
        obj.use = 'libdcp%s_gcov' % bld.env.API_VERSION
        obj.lib = ['gcov']
        obj.cppflags.append('-ftest-coverage')
        obj.cppflags.append('-fprofile-arcs')
    else:
        obj.use = 'libdcp%s' % bld.env.API_VERSION
    obj.source = 'rewrite_subs.cc'
    obj.target = 'rewrite_subs'
    obj.install_path = ''

    obj = bld(features='cxx cxxprogram')
    obj.name   = 'bench'
    obj.uselib = 'BOOST_FILESYSTEM OPENJPEG CXML OPENMP ASDCPLIB_CTH XMLSEC1 OPENSSL LIBXML++'
    obj.use = 'libdcp%s' % bld.env.API_VERSION
    obj.source = 'bench.cc'
    obj.target = 'bench'
    obj.install_path = ''