#!/usr/bin/env python
# encoding: utf-8

from waflib import Task, Options, Logs
from waflib.TaskGen import extension
import shutil, os

#import sys, ctypes
#from waflib import TaskGen

def options(opt):
    pass

def build(bld):

    src = [
        './NeuralAmpModelerCore/NAM/activations.cpp',
        './NeuralAmpModelerCore/NAM/convnet.cpp',
        './NeuralAmpModelerCore/NAM/dsp.cpp',
        './NeuralAmpModelerCore/NAM/get_dsp.cpp',
        './NeuralAmpModelerCore/NAM/lstm.cpp',
        './NeuralAmpModelerCore/NAM/util.cpp',
        './NeuralAmpModelerCore/NAM/wavenet.cpp',
        ]

    incl = ['../headers', '..',
        './NeuralAmpModelerCore/NAM/',
        './NeuralAmpModelerCore/Dependencies/eigen/',
        './NeuralAmpModelerCore/Dependencies/nlohmann/',
        ]

    cxx_flags = ["-std=c++17", "-Wno-sign-compare", "-Ofast"]

    if not bld.env['LTO']:
        if any('clang' not in s for s in bld.env["CXX"]):
            cxx_flags.append ("-fno-fat-lto-objects")

    bld.stlib(
        name = 'libnam',
        includes = incl,
        export_includes=['..'],
        source = src,
        use = [],
        cxxflags = cxx_flags,
        target = 'nam',
        )
