# Copyright AllSeen Alliance. All rights reserved.
#
#    Permission to use, copy, modify, and/or distribute this software for any
#    purpose with or without fee is hereby granted, provided that the above
#    copyright notice and this permission notice appear in all copies.
#
#    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
#    WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
#    MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
#    ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
#    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
#    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
#    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Import('cpsenv')

samples_env = cpsenv.Clone()

samples_env.Append(CPPPATH = samples_env.Dir('generated').srcnode())
samples_env.Append(CPPPATH = samples_env.Dir('provided').srcnode())
samples_env.Append(CPPPATH = samples_env.Dir('$APP_COMMON_DIR/cpp/samples_common').srcnode())

#samples_env.Append(CPPDEFINES = 'USE_SAMPLE_LOGGER')

samples_env.Prepend(LIBS = ['alljoyn_controlpanel', 'alljoyn_about', 'alljoyn_services_common'])

if samples_env['BR'] == 'on' and samples_env.has_key('ajrlib'):
    # Build apps with bundled daemon support
    samples_env.Prepend(LIBS = [samples_env['ajrlib']])

samples_env.VariantDir('AppCommon', '$APP_COMMON_DIR/cpp/samples_common/', duplicate = 0)
cobjs = samples_env.SConscript('AppCommon/SConscript', {'env': samples_env})

genobjs = samples_env.SConscript('generated/SConscript', {'env': samples_env})
providedobjs = samples_env.SConscript('provided/SConscript', {'env': samples_env})

############ Samples without Notification ############

# Sample programs
sample_dirs = [
    'ControlPanelSample'
    ]

exports = { 'env': samples_env, 'cobjs': cobjs, 'genobjs' : genobjs, 'providedobjs' : providedobjs }

progs = [ samples_env.SConscript('%s/SConscript' % sampleapp, exports = exports) for sampleapp in sample_dirs ]

############ Samples with Notification ############

samples_env2 = samples_env.Clone()

sample_dirs_with_notification = [
    'ControlPanelProducer',
    'ControlPanelController'
    ]

samples_env2.Prepend(LIBS = ['alljoyn_notification'])

exports = { 'env': samples_env2, 'cobjs': cobjs, 'genobjs' : genobjs, 'providedobjs' : providedobjs }

progs.append([ samples_env2.SConscript('%s/SConscript' % sampleapp, exports = exports) for sampleapp in sample_dirs_with_notification ])

Return('progs')
