# -*- mode: python -*- vim: filetype=python
# -----------------------------------------------------------------------------
# Copyright (c) 2014-2020, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
# -----------------------------------------------------------------------------

def configure(ctx):
    ctx.check_cc(lib='cmocka', mandatory=False, uselib_store='CMOCKA')

def build(ctx):

    def test_program(name):
        ctx.program(
            source= ["test_%s.c" % name],
            target="test_%s" % name,
            includes='../src',
            use=ctx.env.link_with_dynlibs + ["CMOCKA", "OBJECTS"],
            stlib=ctx.env.link_with_staticlibs,
            install_path=None,
        )

    if "LIB_CMOCKA" in ctx.env:
        test_program("path")
        test_program("launch")
