member.parts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. ############################################################################
  16. Import('*')
  17. env.PartName('member')
  18. api_headers = Pattern(src_dir='.', includes=['*.h'], recursive=False).files()
  19. src_files = Pattern(src_dir='src', includes=['*.c'], recursive=False).files()
  20. internal_headers = Pattern(
  21. src_dir='src', includes=['*.h'], recursive=False).files()
  22. tpm_utest_wrapper_files = Pattern(
  23. src_dir='tpm2/unittests',
  24. includes=['tpm2_wrapper-testhelper.cc'],
  25. recursive=False).files()
  26. utest_files = Pattern(
  27. src_dir='unittests',
  28. includes=[
  29. '*-test.cc',
  30. '*-testhelper.cc',
  31. ],
  32. recursive=False).files()
  33. utest_headers = Pattern(
  34. src_dir='unittests', includes=[
  35. '*-testhelper.h',
  36. ], recursive=False).files()
  37. build_files = Pattern(
  38. src_dir='.', includes=['*.parts', 'Makefile'], recursive=False).files()
  39. env.Part(parts_file='tpm2/tpm2.parts')
  40. if 'use_tss' in env['MODE']:
  41. env.Append(CPPDEFINES=['TPM_TSS'])
  42. if 'install_package' in env['MODE']:
  43. env.InstallTopLevel(api_headers, sub_dir='epid/${PART_SHORT_NAME}')
  44. env.InstallTopLevel(
  45. src_files + internal_headers, sub_dir='epid/${PART_SHORT_NAME}/src')
  46. env.InstallTopLevel(
  47. utest_files + utest_headers,
  48. sub_dir='epid/${PART_SHORT_NAME}/unittests')
  49. env.InstallTopLevel(build_files, sub_dir='epid/${PART_SHORT_NAME}')
  50. else:
  51. env.DependsOn([
  52. Component('common'),
  53. Component('member.tpm2'),
  54. ])
  55. env.Append(CPPPATH='#')
  56. testenv = env.Clone()
  57. outputs = env.Library('${PART_NAME}', src_files)
  58. env.Sdk(outputs)
  59. env.SdkInclude(api_headers, sub_dir='epid/${PART_SHORT_NAME}')
  60. if 'install_lib' in env['MODE']:
  61. env.InstallLib(outputs)
  62. env.InstallInclude(api_headers, sub_dir='${PART_SHORT_NAME}')
  63. #unit tests
  64. testenv['UNIT_TEST_TARGET_NAME'] = "${PART_NAME}-${UNIT_TEST_TARGET}"
  65. testenv.UnitTest(
  66. "utest",
  67. utest_files + tpm_utest_wrapper_files,
  68. command_args=[
  69. '--gtest_color=yes',
  70. '--gtest_print_time=1',
  71. '--gtest_output=xml',
  72. '--gtest_filter=**',
  73. ],
  74. make_pdb=(env.isConfigBasedOn('debug') or
  75. env.isConfigBasedOn('static_crt_debug')),
  76. depends=[
  77. Component('gtest'), Component('common-testhelper'),
  78. Component('member'), Component('verifier')
  79. ],
  80. INSTALL_BIN='${INSTALL_TEST_BIN}')