#===============================================================================
#
# sshdcpapp build script
#
# GENERAL DESCRIPTION
#    build script
#
# Copyright (c) 2010, 2017 by QUALCOMM, Incorporated.
# All Rights Reserved.
# QUALCOMM Proprietary/GTDR
#
#-------------------------------------------------------------------------------
#
#  $Header: //components/rel/ssg.tz/1.0/bsp/trustzone/qsapps/smplap64/build/SConscript#2 $
#  $DateTime: 2017/06/01 16:59:19 $
#  $Author: pwbldsvc $
#  $Change: 13476595 $
#                      EDIT HISTORY FOR FILE
#
#  This section contains comments describing changes made to the module.
#  Notice that changes are listed in reverse chronological order.
#
#===============================================================================
import os
Import('env')

env = env.Clone()

def HDCP_LOGD(str):
  print("\n\033[0;33;40m" +  "[HDCP_DBG] " + str + "\033[0;m\n")
#------------------------------------------------------------------------------
# SET Branch Path
#------------------------------------------------------------------------------
CHIPSET = env['CHIPSET']
HDCP_LOGD("CHIPSET :" + CHIPSET)

if os.path.exists(env['BUILD_ROOT'] + '/ssg'):
    QSEE_APP_DIR = env['BUILD_ROOT'] + "/ssg"
else:
    QSEE_APP_DIR = env['BUILD_ROOT'] + "/core"

#------------------------------------------------------------------------------
# Check if we need to load this script or just bail-out
#------------------------------------------------------------------------------
# alias - First alias is always the target then the other possible aliases
aliases = [
   'sshdcpapp'
]

if CHIPSET in ['msm8937']:
    env.InitImageVars(
       alias_list = aliases,       # list of aliases, unique name index [0]
       proc = 'scorpion',          # proc settings
       config = 'apps',            # config settings
       build_tags = ['APPS_PROC',
          'SSHDCPAPP_IMAGE'],  # list of build tags for sub lib scripts
    )
else:
    env.InitImageVars(
       alias_list = aliases,       # list of aliases, unique name index [0]
       proc = 'A53_64',          # proc settings
       config = 'apps',            # config settings
       build_tags = ['APPS_PROC',
          'SSHDCPAPP_IMAGE'],  # list of build tags for sub lib scripts
    )

if not env.CheckAlias():
   Return()

#------------------------------------------------------------------------------
# Configure and load in USES and path variables
#------------------------------------------------------------------------------
env.LoadToolScript(QSEE_APP_DIR + '/bsp/build/scripts/secure_app_builder.py')
env.InitBuildConfig()
env.Append(OUT_DIR = os.getcwd())
sconspath = env.subst(QSEE_APP_DIR + '/securemsm/trustzone/qsapps/sshdcpapp/src/SConscript')
env.Replace(SRC_SCONS_ROOT = sconspath.split('SConscript')[0])
SConscript(sconspath, exports='env',)
