# 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('about_env')

if not about_env.has_key('_ALLJOYNCORE_'):
    about_env.Append(LIBS = ['alljoyn'])
    if about_env['BR'] == 'on' :
        about_env.Prepend(LIBS = ['ajrouter'])
    if about_env['OS'] == 'openwrt':
        about_env.AppendUnique(LIBS = [ 'stdc++', 'pthread' ])

# Make about dist a sub-directory of the alljoyn dist.  This avoids any conflicts with alljoyn dist targets.
about_env['ABOUT_DISTDIR'] = about_env['DISTDIR'] + '/cpp'

about_env.Install('$ABOUT_DISTDIR/inc/alljoyn/about', about_env.Glob('inc/alljoyn/about/*.h'))

# About libraries
about_env.Install('$ABOUT_DISTDIR/lib', about_env.SConscript('src/SConscript', exports = ['about_env']))

# Sample programs
about_env.Install('$ABOUT_DISTDIR/bin/samples', about_env.SConscript('samples/SConscript', exports = ['about_env']))

# only include command line samples, unit test, test programs if we are not 
# building for iOS. No support on iOS for command line applications.
if not (about_env['OS'] == 'darwin' and about_env['CPU'] in ['arm', 'armv7', 'armv7s', 'arm64',]):
    # Build unit Tests
    about_env.SConscript('unit_test/SConscript', exports = ['about_env'], variant_dir='$OBJDIR_ABOUT/unittest', duplicate = 0)
