Import('mainEnv', 'resources', 'hasCollada', 'stubs')

converter_objects = []

if hasCollada:
	# Build the COLLADA importer if COLLADA-DOM is vailable
	colladaEnv = mainEnv.Clone()
	colladaEnv.Append(LIBS=['mitsuba-hw'])
	colladaEnv.Append(LIBPATH=['#src/libhw'])
	if colladaEnv.has_key('COLLADAINCLUDE'):
		colladaEnv.Prepend(CPPPATH=colladaEnv['COLLADAINCLUDE'])
	if colladaEnv.has_key('COLLADALIBDIR'):
		colladaEnv.Prepend(LIBPATH=colladaEnv['COLLADALIBDIR'])
	if colladaEnv.has_key('COLLADALIB'):
		colladaEnv.Prepend(LIBS=colladaEnv['COLLADALIB'])
	converter_objects += [
		colladaEnv.StaticObject('collada.cpp'),
		colladaEnv.StaticObject('obj.cpp'),
		colladaEnv.StaticObject('converter.cpp')
	]
	colladaEnv.Program('mtsimport', stubs + ['mtsimport.cpp'] 
		+ resources + converter_objects)

Return('converter_objects')
