#!/usr/bin/env python


from waflib import Logs


def configure(conf):
	if conf.check_cfg(package = 'libimxvpuapi', uselib_store = 'IMXVPUAPI', args = '--cflags --libs', mandatory = 0):
		Logs.pprint('GREEN', 'found installed imxvpuapi library - VPU elements will be built')
		conf.env['BUILD_VPU_ELEMENTS'] = 1
	else:
		Logs.pprint('YELLOW', 'could not find installed imxvpuapi library - VPU elements will not be built')


def build(bld):
	if bld.env['BUILD_VPU_ELEMENTS']:
		bld(
			features = ['c', bld.env['CLIBTYPE']],
			includes = ['.', '../..'],
			uselib = bld.env['COMMON_USELIB'] + ['IMXVPUAPI'],
			use = 'gstimxcommon',
			target = 'gstimxvpu',
			source = bld.path.ant_glob('*.c'),
			install_path = bld.env['PLUGIN_INSTALL_PATH']
		)

