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

import sys

def configure(conf):
    pass

def build(bld):
    bundle2 = 'gxpreamp_stereo.lv2'
    
    src2 = ['gxpreamp_stereo.cpp'
           ]
    incl2 = ['../../','./','../', '../../DSP']
    lib2 = []
    if sys.platform.startswith("linux"):
        lib2.append('dl')
    uselib2 = ['LV2CORE','GLIBMM']
    cxxflag2 =[]
    if not bld.env['OPT'] and bld.env['SSE2']:
        cxxflag2 = [ "-msse2", "-mfpmath=sse"]
    lv2_plugin_stereo = bld(
        features='cxx cshlib ',
        includes = incl2,
        lib = lib2,
        use = uselib2,
        obj_ext  = '_12.o',
        cxxflags = cxxflag2,
        defines  = ["LV2_SO"],
        target   = 'gxpreamp_stereo',
        source   = src2,
        install_path = '${LV2DIR}/%s' % bundle2,
        chmod = 0o755,
        )
    lv2_plugin_stereo.env['cxxshlib_PATTERN'] = '%s.so'
    
    incl3 = ['../../../../libgxwmm','../../../../libgxw','../']
    if sys.platform.startswith("linux"):
        lib3.append('dl')
    
    lv2_plugin_gui_stereo = bld(
        features='cxx cshlib ',
        includes = incl3,
        use = ['LV2CORE','GTKMM','gxwmm'],
        linkflags = '-Wl,-z,nodelete',
        defines  = ["LV2_GUI"],
        target   = 'gxpreamp_gui_stereo',
        source   = '../widget.cpp ../gxpreamp_gui.cpp',
        install_path = '${LV2DIR}/%s' % bundle2,
        chmod = 0o755,
        )
    lv2_plugin_gui_stereo.env['cxxshlib_PATTERN'] = '%s.so'

    
    install_path = '${LV2DIR}/%s' % bundle2,
    bld.install_files('${LV2DIR}/gxpreamp_stereo.lv2', 'manifest.ttl')
    bld.install_files('${LV2DIR}/gxpreamp_stereo.lv2', 'gxpreamp_stereo.ttl')
    
