#!/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 = [
        './RTNeural/RTNeural/RTNeural.cpp',
        ]

    incl = ['../headers', '..',
        './RTNeural/RTNeural/',
        './RTNeural/modules/Eigen/',
        './RTNeural/modules/json/',
        ]

    cxx_flags = ["-std=c++17",
                 "-Wno-sign-compare",
                 "-Wno-reorder",
                 "-Wno-infinite-recursion",
                 "-Ofast",
                 "-DRTNEURAL_DEFAULT_ALIGNMENT=32",
                 "-DRTNEURAL_USE_EIGEN=1",
                 "-DRTNEURAL_NAMESPACE=RTNeural"
                 ]

    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 = 'librtneural',
        includes = incl,
        export_includes=['..'],
        source = src,
        use = [],
        cxxflags = cxx_flags,
        target = 'rtneural',
        )
