#! /usr/bin/env python

Import('env')

import sys
dl_path = './dl'
sys.path.append(dl_path)
import procdl
sys.path.remove(dl_path)

env.Append(BUILDERS={'DLH': env.Builder(action=procdl.build_h_action, suffix='.gen.h', src_suffix='.dl')})
env.Append(BUILDERS={'DLCPP': env.Builder(action=procdl.build_cpp_action, suffix='.gen.cpp', src_suffix='.dl')})

for dl in Glob('dl/*.dl'):
	env.DLH(str(dl))
	env.DLCPP(str(dl))
for libname in ['gles2', 'gles3']:
	env.Depends('platform_config.h', 'dl/' + libname + '.gen.h')

frt_env = env.Clone()
import os
if os.path.isfile('/opt/vc/include/bcm_host.h'):
	frt_env.Append(CCFLAGS=["-I/opt/vc/include/"])

if os.path.isfile('/usr/include/libdrm/drm.h'):
	frt_env.Append(CCFLAGS=["-I/usr/include/libdrm"])

frt_env.Program('#bin/godot', ['godot_frt.cpp', 'os_frt.cpp', 'frt_options.cpp'] + env['FRT_MODULES'])
