#
# Copyright (C) 2007 Arnold Krille
# Copyright (C) 2007 Pieter Palmers
#
# This file is part of FFADO
# FFADO = Free Firewire (pro-)audio drivers for linux
#
# FFADO is based upon FreeBoB.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import os
import sys

Import( 'env' )
dbus_env = env.Clone()

if dbus_env.has_key('DBUS1_FLAGS'):
    dbus_env.MergeFlags( dbus_env['DBUS1_FLAGS'] )

# add the local version of libdbus++
dbus_env.AppendUnique( CPPPATH=["#/external/dbus/include"] )
dbus_env.AppendUnique( LIBPATH=[dbus_env['build_base']+"external/dbus"])
dbus_env.AppendUnique( LIBS=["dbus-c++"] )
dbus_env.AppendUnique( CCFLAGS=["-DDBUS_API_SUBJECT_TO_CHANGE"] )

sources = [
	'src/connection.cpp',
	'src/debug.cpp',
	'src/dispatcher.cpp',
	'src/error.cpp',
	'src/eventloop.cpp',
	'src/interface.cpp',
	'src/introspection.cpp',
	'src/property.cpp',
	'src/message.cpp',
	'src/object.cpp',
	'src/pendingcall.cpp',
	'src/server.cpp',
	'src/types.cpp'
]

if dbus_env.has_key('DEBUG') and dbus_env['DEBUG']:
	dbus_env.AppendUnique( CCFLAGS=["-DDEBUG","-g"] )

dbus_env.PrependUnique( LIBS=["expat"] )
libdbuspp=dbus_env.StaticLibrary('dbus-c++', sources)

#
# tools
#

tools_env = dbus_env

introspect_sources = [
	'tools/introspect.cpp',
]

xml2cpp_sources = [
	'tools/xml.cpp','tools/xml2cpp.cpp'
]

tools_env.AppendUnique( CCFLAGS=["-DDBUS_API_SUBJECT_TO_CHANGE"] )
tools_env.AppendUnique( CPPPATH=["#/external/dbus/include"] )
tools_env.PrependUnique( LIBPATH=dbus_env['build_base']+"external/dbus" )
tools_env.PrependUnique( LIBS="dbus-c++" )

dbusxx_introspect = tools_env.Program('dbusxx-introspect', introspect_sources)
dbusxx_xml2cpp = tools_env.Program('dbusxx-xml2cpp', xml2cpp_sources)

