# Copyright (c) 2018-2021 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.

import os
Import('env')
env = env.Clone()

includes = [
  '../inc/',
  '../../common/inc',
  '../../shared_headers'
]

sources = [
  'ca_main.c',
  'example_listener.cpp',
  'run_cipher.c',
  'run_hash.cpp',
  'run_listener.c',
  'run_uptime.c',
  'run_cppFeatures.c',
  'utils.c',
]

# The name of the TA to load is defined as EXAMPLE_APP_TA_NAME
example_app_ta_name = \
  'example_cppapp_ta' + ['32', '64'][env.Is64BitImage()]

env.Append(CPPDEFINES = \
           'EXAMPLE_APP_TA_NAME=\\"{}\\"'.format(example_app_ta_name))

# TA_INSTALL_PATH is added to the env in the calling SConstruct.
env.Append(CPPDEFINES='TA_PATH_DEFINE=\\"{}\\"'.format(env['TA_INSTALL_PATH']))

example_lib = env['LIB_OUT_DIR'] + '/example_lib.lib'

app = env.OfftargetClientAppBuilder(
  includes = includes,
  sources = sources,
  image = 'example_cppapp_ca',
  user_libs = [example_lib]
)

env.Alias('example_cppapp_ca', app)

env.Depends(app, env.Alias('installed_ta'))
env.Depends(app, env.Alias('example_lib'))

Return('app')
