#! /usr/bin/python3
# encoding: utf-8
#
# Copyright (C) 2015, 2017-2018 Karl Linden <karl.j.linden@gmail.com>
#
# 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.
#
# 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.
#

test_programs = {
    # For testing purposes
    # 'synchroClient': ['testSynchroClient.cpp'],
    # 'synchroServer': ['testSynchroServer.cpp'],
    # 'synchroServerClient': ['testSynchroServerClient.cpp'],
    # 'testSem': ['testSem.cpp'],
    'jack_test': ['test.cpp'],
    'jack_cpu': ['cpu.c'],
    'jack_iodelay': ['iodelay.cpp'],
    'jack_multiple_metro': ['external_metro.cpp'],
    }


def build(bld):
    for test_program, test_program_sources in list(test_programs.items()):
        prog = bld(features='cxx cxxprogram')
        if bld.env['IS_MACOSX']:
            prog.includes = ['..', '../macosx', '../posix', '../common/jack', '../common']
        if bld.env['IS_LINUX']:
            prog.includes = ['..', '../linux', '../posix', '../common/jack', '../common']
        if bld.env['IS_FREEBSD']:
            prog.includes = ['..', '../freebsd', '../posix', '../common/jack', '../common']
        if bld.env['IS_SUN']:
            prog.includes = ['..', '../solaris', '../posix', '../common/jack', '../common']
        prog.source = test_program_sources
        if bld.env['IS_LINUX']:
            prog.uselib = 'RT'
        prog.use = 'clientlib'
        prog.target = test_program
