| ############################################################################ |
| # 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("util") |
| |
| src_files = Pattern(src_dir='src', includes=['*.c'], recursive=True).files() |
| |
| api_headers = Pattern(src_dir='.', includes=['*.h'], recursive=False).files() |
| parts_file = ['util.parts'] |
| |
| makefile = ['Makefile'] |
| #unit tests |
| utest_files = Pattern( |
| src_dir='.', |
| includes=['*-test.cc', '*-testhelper.cc'], |
| excludes=[], |
| recursive=True).files() |
| |
| if 'use_tss' in env['MODE']: |
| env.Append(CPPDEFINES=['TPM_TSS']) |
| |
| if 'install_package' in env['MODE']: |
| env.InstallTopLevel(src_files, sub_dir='example/${PART_SHORT_NAME}/src') |
| env.InstallTopLevel(api_headers, sub_dir='example/${PART_SHORT_NAME}') |
| env.InstallTopLevel( |
| utest_files, sub_dir='example/${PART_SHORT_NAME}/utest') |
| env.InstallTopLevel(parts_file, sub_dir='example/${PART_SHORT_NAME}') |
| env.InstallTopLevel(makefile, sub_dir='example/${PART_SHORT_NAME}') |
| else: |
| env.DependsOn( |
| [Component('common', requires=REQ.HEADERS), |
| Component('member', requires=REQ.HEADERS)]) |
| |
| env.Append(CPPPATH='#/example') |
| |
| testenv = env.Clone() |
| |
| env.SdkInclude(api_headers, sub_dir='${PART_SHORT_NAME}') |
| |
| if env['TARGET_PLATFORM']['OS'] == 'win32': |
| if env.isConfigBasedOn('debug'): |
| env['PDB'] = '${PART_NAME}.pdb' |
| |
| #env.Append(CPPDEFINES = 'ENABLE_UTIL_DEBUG_PRINT_') |
| env.Append(CPPDEFINES='_CRT_SECURE_NO_WARNINGS') |
| |
| outputs = env.Library('${PART_NAME}', src_files) |
| |
| env.Sdk(outputs) |