# -*- python -*- # # Copyright (c) 2017 Stefan Seefeld # All rights reserved. # # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) from faber import platform from faber.feature import set from faber.tools.compiler import define, libs, linkpath from faber.artefacts.binary import binary from faber.test import test, report, fail from os.path import join boost_suffix = options.get_with('boost-suffix') boost_suffix = '-' + boost_suffix if boost_suffix else '' boost_unit_test_framework = 'boost_unit_test_framework' + boost_suffix boost_filesystem = 'boost_filesystem' + boost_suffix boost_system = 'boost_system' + boost_suffix test_features = set(define('BOOST_TEST_DYN_LINK'), libs(boost_unit_test_framework, boost_system, boost_filesystem)) without_jpeg = options.get_without('jpeg') jpeg_features = test_features + set(libs('jpeg')) jpeg_prefix = options.get_with('jpeg-prefix') if jpeg_prefix: jpeg_features += include(join(jpeg_prefix, 'include')) jpeg_features += linkpath(join(jpeg_prefix, 'lib64'), join(jpeg_prefix, 'lib')) without_png = options.get_without('png') png = options.get_with('png') or 'png' # on some platforms the library uses another name png_features = test_features + set(libs(png)) png_prefix = options.get_with('png-prefix') if png_prefix: png_features += include(join(png_prefix, 'include')) png_features += linkpath(join(png_prefix, 'lib64'), join(png_prefix, 'lib')) without_tiff = options.get_without('tiff') tiff_features = test_features + set(libs('tiff')) tiff_prefix = options.get_with('tiff-prefix') if tiff_prefix: tiff_features += include(join(tiff_prefix, 'include')) tiff_features += linkpath(join(tiff_prefix, 'lib64'), join(tiff_prefix, 'lib')) def gil_test(name, sources, features, condition=True): return test(name, binary(name, sources, features=features, condition=condition)) tests = [gil_test('all_formats_test', ['all_formats_test.cpp'], features=test_features | png_features | jpeg_features), gil_test('bmp', ['bmp_test.cpp', 'bmp_old_test.cpp', 'bmp_read_test.cpp', 'bmp_write_test.cpp'], features=test_features), gil_test('jpeg', ['jpeg_test.cpp', 'jpeg_old_test.cpp', 'jpeg_read_test.cpp', 'jpeg_write_test.cpp'], features=jpeg_features, condition=not without_jpeg), gil_test('png', ['png_test.cpp', 'png_old_test.cpp', 'png_file_format_test.cpp', 'png_read_test.cpp'], features=png_features, condition=not without_png), gil_test('pnm', ['pnm_test.cpp', 'pnm_old_test.cpp', 'pnm_read_test.cpp', 'pnm_write_test.cpp'], features=test_features), gil_test('targa', ['targa_test.cpp', 'targa_old_test.cpp', 'targa_read_test.cpp', 'targa_write_test.cpp'], features=test_features), gil_test('tiff', ['tiff_test.cpp', 'tiff_old_test.cpp', 'tiff_file_format_test.cpp', 'tiff_tiled_float_test.cpp', 'tiff_tiled_minisblack_test_1-10.cpp', 'tiff_tiled_minisblack_test_11-20.cpp', 'tiff_tiled_minisblack_test_21-31_32-64.cpp', 'tiff_tiled_minisblack_write_test_1-10.cpp', 'tiff_tiled_minisblack_write_test_11-20.cpp', 'tiff_tiled_minisblack_write_test_21-31_32-64.cpp', 'tiff_tiled_palette_test_1-8.cpp', 'tiff_tiled_palette_test_8-16.cpp', 'tiff_tiled_palette_write_test_1-8.cpp', 'tiff_tiled_palette_write_test_8-16.cpp', 'tiff_tiled_rgb_contig_test_1-10.cpp', 'tiff_tiled_rgb_contig_test_11-20.cpp', 'tiff_tiled_rgb_contig_test_21-31_32_64.cpp', 'tiff_tiled_rgb_contig_write_test_1-10.cpp', 'tiff_tiled_rgb_contig_write_test_11-20.cpp', 'tiff_tiled_rgb_contig_write_test_21-31_32_64.cpp', 'tiff_tiled_rgb_planar_test_1-10.cpp', 'tiff_tiled_rgb_planar_test_11-20.cpp', 'tiff_tiled_rgb_planar_test_21-31_32_64.cpp', 'tiff_tiled_test.cpp', 'tiff_write_test.cpp'], features=tiff_features, condition=not without_tiff) ] default = report('report', tests, fail_on_failures=True)