#!/usr/bin/env python

''' This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public Licence as published by
the Free Software Foundation, either version 3 of the Licence, 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
file COPYING for more details. '''

import os
import lv2

buildme = not bld.env.TOOLS_DISABLED

if buildme:
	examples = ["workhorse", "silence", "beep"]

	for slug in examples:
		
		bld(rule="../build/tools/ttl2c ${SRC} ${TGT}", \
			source=slug+'.ttl', \
			target=slug+'.h')
	
		bld.add_group()
	
		plugin = bld.shlib(
			lv2_bundle	  =	 True,
			lv2_resources = ["%s.manifest.ttl.in" % slug,"%s.ttl" % slug],
			name          = slug,
			target        = slug,
			source        = "%s.cpp" % slug,
			includes      = ["../build/examples"],
			use           = bld.env.LIB_LVTK_PLUGIN,
			LIB_EXT		  = bld.env.pluginlib_EXT
		)
		
		
		uislug = slug + "_ui"
		uisrc  = uislug + ".cpp"
		
		if bld.path.find_resource(uisrc):
			ui = bld.shlib(
				lv2_bundle	  =	True,
				lv2_target    = slug + ".lv2",
				name          = uislug,
				target        = uislug,
				source        = uisrc,
				cxxflags       = ['-Wl,-z,nodelete'],
				includes      = ["../build/examples"],
				use           = [bld.env.LIB_LVTK_UI, "gtkmm"],
				LIB_EXT		  = bld.env.pluginlib_EXT
			)
