import os

env = Environment(CPPPATH='..')
#CXX='g++-9')
env['ENV']['TERM'] = os.environ['TERM']

#DefaultEnvironment(CXX='g++-9')

srcs = 'Gpu.cpp main.cpp ../AllocTrac.cpp ../log.cpp ../common.cpp ../clwrap.cpp ../timeutil.cpp'.split()

# AlwaysBuild(Command('version.inc', [], 'echo \\"`git describe --tags --long --dirty --always`\\" > $TARGETS'))

# AlwaysBuild(Command('trig-wrap.cpp', ['trig.cl'], 'cat head.txt trig.cl tail.txt > trig-wrap.cpp'))
AlwaysBuild(Command('sp-wrap.cpp', ['sp.cl'], 'cat head.txt sp.cl tail.txt > sp-wrap.cpp'))

LIBPATH=['/opt/rocm/opencl/lib', '/opt/rocm-3.3.0/opencl/lib/x86_64', '/opt/rocm-3.5.0/opencl/lib']

config = '-g -fconcepts'
#config = '-g -O2'
#-fsanitize=address'
# -fstack-protector-strong -static-libasan'
#config = '-O2'

flags = '-std=c++17 -Wall -pthread ' + config
env.Program('sp', srcs, LIBPATH=LIBPATH, LIBS=['amdocl64', 'stdc++fs'], parse_flags=flags)
