1# pylint:disable=I0011,W0401,W0614,C0103,E0602
2############################################################################
3# Copyright 2017 Intel Corporation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16############################################################################
17"""Build configuration for tiny math library.
18"""
19Import('*')
20env.PartName('math')
21
22env.DependsOn([
23    Component('member.tiny_stdlib'),
24    Component('tinycommon', requires=REQ.HEADERS)
25])
26
27include_files = Pattern(src_dir='.',
28                        includes=['*.h'],
29                        recursive=False).files()
30
31src_files = Pattern(src_dir='src',
32                    includes=['*.c'],
33                    recursive=False).files()
34
35env.Append(CPPPATH='#')
36
37outputs = env.Library('${PART_SHORT_NAME}', src_files)
38
39sdk_outs = env.Sdk(outputs)
40env.SdkInclude(include_files, sub_dir='${PART_SHORT_NAME}')
41
42if 'install_lib' in env['MODE'] and 'shared' not in env['MODE']:
43    env.InstallLib(outputs)
44
45is_utest_build = False
46for i in BUILD_TARGETS:
47    if "utest::" in str(i):
48        is_utest_build = True
49if is_utest_build:
50    env.Part(parts_file='unittests/utest.parts',
51             CONFIG=DefaultEnvironment().subst('$CONFIG'))
52