#! /usr/bin/env python

# SCSub
#
# FRT - A Godot platform targeting single board computers
# Copyright (c) 2017-2022  Emanuele Fornara
# SPDX-License-Identifier: MIT
#

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_cc_action, suffix='.gen.cc', src_suffix='.dl')})

for dl in Glob('dl/*.dl'):
	env.DLH(str(dl))
	env.DLCPP(str(dl))

env.Depends('platform_config.h', 'dl/gles2.gen.h')
env.Depends('platform_config.h', 'dl/gles2.gen.cc')

frt_env = env.Clone()
frt_env.ParseConfig(env['FRT_PKG_CONFIG'] + ' sdl2 --cflags --libs')

common_sources = [ 'frt_exe.cc', 'frt.cc', 'frt_godot3.cc', 'dl/gles2.gen.cc' ]

std = env['frt_std']

if std != 'no':
	frt_env.Append(CCFLAGS=['-std=c++14'])

prog = frt_env.add_program('#bin/pandemonium', common_sources)