Import('env', 'sys', 'os')

renderEnv = env.Clone()
renderEnv.Append(CPPDEFINES = [['MTS_BUILD_MODULE', 'MTS_MODULE_RENDER']] )
if renderEnv.has_key('XERCESINCLUDE'):
	renderEnv.Prepend(CPPPATH=renderEnv['XERCESINCLUDE'])
if renderEnv.has_key('XERCESLIBDIR'):
	renderEnv.Prepend(LIBPATH=renderEnv['XERCESLIBDIR'])
if renderEnv.has_key('XERCESLIB'):
	renderEnv.Prepend(LIBS=renderEnv['XERCESLIB'])

librender = renderEnv.SharedLibrary('mitsuba-render', [
	'bsdf.cpp', 'camera.cpp', 'film.cpp', 'integrator.cpp',
	'skdtree.cpp', 'luminaire.cpp', 'medium.cpp', 'renderjob.cpp', 
	'imageproc.cpp', 'rectwu.cpp', 'renderproc.cpp', 
	'imageblock.cpp', 'particleproc.cpp', 'renderqueue.cpp', 
	'mipmap.cpp',  'scene.cpp',  'subsurface.cpp', 'texture.cpp',
	'shape.cpp', 'trimesh.cpp', 'rfilter.cpp', 'sampler.cpp', 
	'util.cpp', 'irrcache.cpp', 'testcase.cpp', 'preview.cpp',
	'photonmap.cpp', 'gatherproc.cpp', 'mipmap3d.cpp', 'volume.cpp', 
	'vpl.cpp', 'shader.cpp', 'scenehandler.cpp', 'intersection.cpp', 
	'track.cpp', 'common.cpp', 'phase.cpp', 'noise.cpp', 'photon.cpp'
])

if sys.platform == "darwin":
	renderEnv.AddPostAction(librender, 'install_name_tool -id @executable_path/../Frameworks/libmitsuba-render.dylib $TARGET')

env.Append(LIBS=['mitsuba-render'])
env.Append(LIBPATH=[os.path.join(env['BUILDDIR'], 'librender')])
