• Home
  • 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############################################################################
16Import('*')
17env.PartName('verifier')
18
19api_headers = Pattern(src_dir='.',
20                      includes=['*.h'],
21                      recursive=False).files()
22src_files = Pattern(src_dir='src',
23                    includes=['*.c'],
24                    recursive=False).files()
25internal_headers = Pattern(src_dir='src',
26                           includes=['*.h', '*.inc'],
27                           recursive=False).files()
28utest_files = Pattern(src_dir='unittests',
29                      includes=['*-test.cc', '*-testhelper.cc'],
30                      recursive=False).files()
31utest_headers = Pattern(src_dir='unittests',
32                        includes=['*-testhelper.h',],
33                        recursive=False).files()
34utest_data_files = Pattern(src_dir='unittests/testdata/sigrl',
35                           includes=['*.inc'],
36                           excludes=[],
37                           recursive=False).files()
38
39epid11_headers = Pattern(src_dir='1.1',
40                         includes=['*.h'],
41                         recursive=False).files()
42epid11_src_files = Pattern(src_dir='1.1/src',
43                           includes=['*.c'],
44                           recursive=False).files()
45epid11_internal_headers = Pattern(src_dir='1.1/src',
46                                  includes=['*.h', '*.inc'],
47                                  recursive=False).files()
48epid11_utest_files = Pattern(src_dir='1.1/unittests',
49                             includes=['*-test.cc', '*-testhelper.cc'],
50                             recursive=False).files()
51epid11_utest_headers = Pattern(src_dir='1.1/unittests',
52                               includes=['*-testhelper.h',],
53                               recursive=False).files()
54epid11_utest_data_files = Pattern(src_dir='1.1/unittests/testdata',
55                                  includes=['*.inc'],
56                                  recursive=False).files()
57
58build_files = Pattern(src_dir='.',
59                      includes=['*.parts', 'Makefile'],
60                      recursive=False).files()
61
62if 'install_package' in env['MODE']:
63    env.InstallTopLevel(api_headers,
64                        sub_dir='epid/${PART_SHORT_NAME}')
65    env.InstallTopLevel(src_files + internal_headers,
66                        sub_dir='epid/${PART_SHORT_NAME}/src')
67    env.InstallTopLevel(utest_files + utest_headers,
68                        sub_dir='epid/${PART_SHORT_NAME}/unittests')
69    env.InstallTopLevel(
70        utest_data_files,
71        sub_dir='epid/${PART_SHORT_NAME}/unittests/testdata/sigrl')
72
73    env.InstallTopLevel(epid11_headers,
74                        sub_dir='epid/${PART_SHORT_NAME}/1.1')
75    env.InstallTopLevel(epid11_src_files + epid11_internal_headers,
76                        sub_dir='epid/${PART_SHORT_NAME}/1.1/src')
77    env.InstallTopLevel(epid11_utest_files + epid11_utest_headers,
78                        sub_dir='epid/${PART_SHORT_NAME}/1.1/unittests')
79    env.InstallTopLevel(
80        epid11_utest_data_files,
81        sub_dir='epid/${PART_SHORT_NAME}/1.1/unittests/testdata')
82
83    env.InstallTopLevel(build_files, sub_dir='epid/${PART_SHORT_NAME}')
84
85else:
86    env.DependsOn([
87        Component('common'),
88    ])
89
90    env.Append(CPPPATH='#')
91
92    if 'use_tss' in env['MODE']:
93        env.Append(CPPDEFINES=['TPM_TSS'])
94
95    testenv = env.Clone()
96    outputs = env.Library('${PART_NAME}', src_files + epid11_src_files)
97    env.Sdk(outputs)
98    env.SdkInclude(api_headers, sub_dir='epid/${PART_SHORT_NAME}')
99    env.SdkInclude(epid11_headers, sub_dir='epid/${PART_SHORT_NAME}/1.1')
100
101    if 'install_lib' in env['MODE']:
102        env.InstallLib(outputs)
103        env.InstallInclude(api_headers, sub_dir='${PART_SHORT_NAME}')
104        env.InstallInclude(epid11_headers, sub_dir='${PART_SHORT_NAME}/1.1')
105
106    testenv['UNIT_TEST_TARGET_NAME'] = "${PART_NAME}-${UNIT_TEST_TARGET}"
107    testenv.UnitTest("utest",
108                     utest_files + epid11_utest_files,
109                     command_args=[
110                         '--gtest_color=yes',
111                         '--gtest_print_time=1',
112                         '--gtest_output=xml',
113                         '--gtest_filter=**',
114                     ],
115                     make_pdb=(env.isConfigBasedOn('debug') or
116                               env.isConfigBasedOn('static_crt_debug')),
117                     depends=[Component('gtest'),
118                              Component('common-testhelper'),
119                              Component('verifier')],
120                     INSTALL_BIN='${INSTALL_TEST_BIN}')
121