• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1############################################################################
2# Copyright 2016-2017 Intel Corporation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15############################################################################
16
17Import('*')
18
19env.PartName("util")
20
21src_files = Pattern(src_dir='src', includes=['*.c'], recursive=True).files()
22
23api_headers = Pattern(src_dir='.', includes=['*.h'], recursive=False).files()
24parts_file = ['util.parts']
25
26makefile = ['Makefile']
27#unit tests
28utest_files = Pattern(
29    src_dir='.',
30    includes=['*-test.cc', '*-testhelper.cc'],
31    excludes=[],
32    recursive=True).files()
33
34if 'use_tss' in env['MODE']:
35    env.Append(CPPDEFINES=['TPM_TSS'])
36
37if 'install_package' in env['MODE']:
38    env.InstallTopLevel(src_files, sub_dir='example/${PART_SHORT_NAME}/src')
39    env.InstallTopLevel(api_headers, sub_dir='example/${PART_SHORT_NAME}')
40    env.InstallTopLevel(
41        utest_files, sub_dir='example/${PART_SHORT_NAME}/utest')
42    env.InstallTopLevel(parts_file, sub_dir='example/${PART_SHORT_NAME}')
43    env.InstallTopLevel(makefile, sub_dir='example/${PART_SHORT_NAME}')
44else:
45    env.DependsOn(
46        [Component('common', requires=REQ.HEADERS),
47         Component('member', requires=REQ.HEADERS)])
48
49    env.Append(CPPPATH='#/example')
50
51    testenv = env.Clone()
52
53    env.SdkInclude(api_headers, sub_dir='${PART_SHORT_NAME}')
54
55    if env['TARGET_PLATFORM']['OS'] == 'win32':
56        if env.isConfigBasedOn('debug'):
57            env['PDB'] = '${PART_NAME}.pdb'
58
59    #env.Append(CPPDEFINES = 'ENABLE_UTIL_DEBUG_PRINT_')
60    env.Append(CPPDEFINES='_CRT_SECURE_NO_WARNINGS')
61
62    outputs = env.Library('${PART_NAME}', src_files)
63
64    env.Sdk(outputs)
65