aboutsummaryrefslogtreecommitdiff
path: root/epid/common/common.parts
blob: dfa80b4d1ed6ed1aa7a84c4640bfcb419578b3db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
############################################################################
# Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
############################################################################
Import('*')
env.PartName('common')

api_headers = Pattern(src_dir='.',
                      includes=['*.h'],
                      recursive=False).files()
src_files = Pattern(src_dir='src',
                    includes=['*.c'],
                    recursive=False).files()
internal_headers = Pattern(src_dir='src',
                           includes=['*.h', '*.inc'],
                           recursive=False).files()
utest_files = Pattern(src_dir='unittests',
                      includes=['*-test.cc', '*-testhelper.cc'],
                      recursive=False).files()

epid11_headers = Pattern(src_dir='1.1',
                         includes=['*.h'],
                         recursive=False).files()
epid11_src_files = Pattern(src_dir='1.1/src',
                           includes=['*.c'],
                           recursive=False).files()
epid11_internal_headers = Pattern(src_dir='1.1/src',
                                  includes=['*.h', '*.inc'],
                                  recursive=False).files()
epid11_utest_files = Pattern(src_dir='1.1/unittests',
                             includes=['*-test.cc', '*-testhelper.cc'],
                             recursive=False).files()

math_headers = Pattern(src_dir='math',
                       includes=['*.h'],
                       recursive=False).files()
math_src_files = Pattern(src_dir='math/src',
                         includes=['*.c'],
                         recursive=False).files()
math_internal_headers = Pattern(src_dir='math/src',
                                includes=['*.h'],
                                recursive=False).files()
math_utest_files = Pattern(src_dir='math/unittests',
                           includes=['*-test.cc', '*-testhelper.cc'],
                           recursive=False).files()

build_files = Pattern(src_dir='.',
                      includes=['*.parts', 'Makefile'],
                      recursive=False).files()

if 'install_package' in env['MODE']:
    env.InstallTopLevel(api_headers, sub_dir='epid/${PART_SHORT_NAME}')
    env.InstallTopLevel(src_files + internal_headers,
                        sub_dir='epid/${PART_SHORT_NAME}/src')
    env.InstallTopLevel(utest_files,
                        sub_dir='epid/${PART_SHORT_NAME}/unittests')


    env.InstallTopLevel(epid11_headers, sub_dir='epid/${PART_SHORT_NAME}/1.1')
    env.InstallTopLevel(epid11_src_files + epid11_internal_headers,
                        sub_dir='epid/${PART_SHORT_NAME}/1.1/src')
    env.InstallTopLevel(epid11_utest_files,
                        sub_dir='epid/${PART_SHORT_NAME}/1.1/unittests')

    env.InstallTopLevel(math_headers, sub_dir='epid/${PART_SHORT_NAME}/math')
    env.InstallTopLevel(math_src_files + math_internal_headers,
                        sub_dir='epid/${PART_SHORT_NAME}/math/src')
    env.InstallTopLevel(math_utest_files,
                        sub_dir='epid/${PART_SHORT_NAME}/math/unittests')

    env.InstallTopLevel(build_files, sub_dir='epid/${PART_SHORT_NAME}')
else:
    env.DependsOn([
        Component('ippcp'),
    ])
    if 'use_memory_profiler' in env['MODE']:
        env.DependsOn([Component('memory_profiler')])

    env.Append(CPPPATH='#')

    testenv = env.Clone()

    env.SdkInclude(api_headers, sub_dir='epid/${PART_SHORT_NAME}')
    env.SdkInclude(epid11_headers, sub_dir='epid/${PART_SHORT_NAME}/1.1')

    outputs = env.Library('${PART_NAME}',
                          src_files + epid11_src_files + math_src_files)
    env.Sdk(outputs)
    if 'install_lib' in env['MODE']:
        env.InstallLib(outputs)
        env.InstallInclude(api_headers, sub_dir='${PART_SHORT_NAME}')
        env.InstallInclude(epid11_headers, sub_dir='${PART_SHORT_NAME}/1.1')

    # unit tests
    testenv['UNIT_TEST_TARGET_NAME'] = "${PART_NAME}-${UNIT_TEST_TARGET}"
    testenv.UnitTest("utest",
                     utest_files + math_utest_files + epid11_utest_files,
                     command_args=[
                         '--gtest_color=yes',
                         '--gtest_print_time=1',
                         '--gtest_output=xml',
                         '--gtest_filter=**',
                     ],
                     make_pdb=(env.isConfigBasedOn('debug')),
                     depends=[Component('gtest'),
                              Component('common'),
                              Component('common-testhelper')],
                     INSTALL_BIN='${INSTALL_TEST_BIN}')