• 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('common')
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()
31
32epid11_headers = Pattern(src_dir='1.1',
33                         includes=['*.h'],
34                         recursive=False).files()
35epid11_src_files = Pattern(src_dir='1.1/src',
36                           includes=['*.c'],
37                           recursive=False).files()
38epid11_internal_headers = Pattern(src_dir='1.1/src',
39                                  includes=['*.h', '*.inc'],
40                                  recursive=False).files()
41epid11_utest_files = Pattern(src_dir='1.1/unittests',
42                             includes=['*-test.cc', '*-testhelper.cc'],
43                             recursive=False).files()
44
45math_headers = Pattern(src_dir='math',
46                       includes=['*.h'],
47                       recursive=False).files()
48math_src_files = Pattern(src_dir='math/src',
49                         includes=['*.c'],
50                         recursive=False).files()
51math_internal_headers = Pattern(src_dir='math/src',
52                                includes=['*.h'],
53                                recursive=False).files()
54math_utest_files = Pattern(src_dir='math/unittests',
55                           includes=['*-test.cc', '*-testhelper.cc'],
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, sub_dir='epid/${PART_SHORT_NAME}')
64    env.InstallTopLevel(src_files + internal_headers,
65                        sub_dir='epid/${PART_SHORT_NAME}/src')
66    env.InstallTopLevel(utest_files,
67                        sub_dir='epid/${PART_SHORT_NAME}/unittests')
68
69
70    env.InstallTopLevel(epid11_headers, sub_dir='epid/${PART_SHORT_NAME}/1.1')
71    env.InstallTopLevel(epid11_src_files + epid11_internal_headers,
72                        sub_dir='epid/${PART_SHORT_NAME}/1.1/src')
73    env.InstallTopLevel(epid11_utest_files,
74                        sub_dir='epid/${PART_SHORT_NAME}/1.1/unittests')
75
76    env.InstallTopLevel(math_headers, sub_dir='epid/${PART_SHORT_NAME}/math')
77    env.InstallTopLevel(math_src_files + math_internal_headers,
78                        sub_dir='epid/${PART_SHORT_NAME}/math/src')
79    env.InstallTopLevel(math_utest_files,
80                        sub_dir='epid/${PART_SHORT_NAME}/math/unittests')
81
82    env.InstallTopLevel(build_files, sub_dir='epid/${PART_SHORT_NAME}')
83else:
84    env.DependsOn([
85        Component('ippcp'),
86    ])
87    if 'use_memory_profiler' in env['MODE']:
88        env.DependsOn([Component('memory_profiler')])
89
90    env.Append(CPPPATH='#')
91
92    testenv = env.Clone()
93
94    env.SdkInclude(api_headers, sub_dir='epid/${PART_SHORT_NAME}')
95    env.SdkInclude(epid11_headers, sub_dir='epid/${PART_SHORT_NAME}/1.1')
96
97    outputs = env.Library('${PART_NAME}',
98                          src_files + epid11_src_files + math_src_files)
99    env.Sdk(outputs)
100    if 'install_lib' in env['MODE']:
101        env.InstallLib(outputs)
102        env.InstallInclude(api_headers, sub_dir='${PART_SHORT_NAME}')
103        env.InstallInclude(epid11_headers, sub_dir='${PART_SHORT_NAME}/1.1')
104
105    # unit tests
106    testenv['UNIT_TEST_TARGET_NAME'] = "${PART_NAME}-${UNIT_TEST_TARGET}"
107    testenv.UnitTest("utest",
108                     utest_files + math_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')),
116                     depends=[Component('gtest'),
117                              Component('common'),
118                              Component('common-testhelper')],
119                     INSTALL_BIN='${INSTALL_TEST_BIN}')
120