member.parts 3.2 KB

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