# -*- coding: utf-8 -*-
# SConstrunct for dtl test

import os

def path_chomp(path):
    if path[-1] == '/':
        return path[:-1]
    return path

env  = Environment(
    CPPFLAGS=['-Wall', '-O2'],
    CPPPATH=['..'],
    CXXFLAGS="-std=c++14",
)

conf = Configure(env);

if not conf.CheckCXX():
    print("c++ compiler is not installed!")
    Exit(1)

libs = ['stdc++', 'pthread', 'gtest']
for lib in libs:
    if not conf.CheckLib(lib):
        print("library " + lib + " not installed!")
        Exit(1)

conf.Finish()

test = env.Program(
    'dtl_test',
    [Glob('*.cpp')],
)

test_alias = env.Alias(
    'check',
    test,
    test[0].abspath
)

env.AlwaysBuild(test_alias)
