common.parts 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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('common')
  18. api_headers = Pattern(src_dir='.',
  19. includes=['*.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', '*.inc'],
  26. recursive=False).files()
  27. utest_files = Pattern(src_dir='unittests',
  28. includes=['*-test.cc', '*-testhelper.cc'],
  29. recursive=False).files()
  30. epid11_headers = Pattern(src_dir='1.1',
  31. includes=['*.h'],
  32. recursive=False).files()
  33. epid11_src_files = Pattern(src_dir='1.1/src',
  34. includes=['*.c'],
  35. recursive=False).files()
  36. epid11_internal_headers = Pattern(src_dir='1.1/src',
  37. includes=['*.h', '*.inc'],
  38. recursive=False).files()
  39. epid11_utest_files = Pattern(src_dir='1.1/unittests',
  40. includes=['*-test.cc', '*-testhelper.cc'],
  41. recursive=False).files()
  42. math_headers = Pattern(src_dir='math',
  43. includes=['*.h'],
  44. recursive=False).files()
  45. math_src_files = Pattern(src_dir='math/src',
  46. includes=['*.c'],
  47. recursive=False).files()
  48. math_internal_headers = Pattern(src_dir='math/src',
  49. includes=['*.h'],
  50. recursive=False).files()
  51. math_utest_files = Pattern(src_dir='math/unittests',
  52. includes=['*-test.cc', '*-testhelper.cc'],
  53. recursive=False).files()
  54. build_files = Pattern(src_dir='.',
  55. includes=['*.parts', 'Makefile'],
  56. recursive=False).files()
  57. if 'install_package' in env['MODE']:
  58. env.InstallTopLevel(api_headers, sub_dir='epid/${PART_SHORT_NAME}')
  59. env.InstallTopLevel(src_files + internal_headers,
  60. sub_dir='epid/${PART_SHORT_NAME}/src')
  61. env.InstallTopLevel(utest_files,
  62. sub_dir='epid/${PART_SHORT_NAME}/unittests')
  63. env.InstallTopLevel(epid11_headers, sub_dir='epid/${PART_SHORT_NAME}/1.1')
  64. env.InstallTopLevel(epid11_src_files + epid11_internal_headers,
  65. sub_dir='epid/${PART_SHORT_NAME}/1.1/src')
  66. env.InstallTopLevel(epid11_utest_files,
  67. sub_dir='epid/${PART_SHORT_NAME}/1.1/unittests')
  68. env.InstallTopLevel(math_headers, sub_dir='epid/${PART_SHORT_NAME}/math')
  69. env.InstallTopLevel(math_src_files + math_internal_headers,
  70. sub_dir='epid/${PART_SHORT_NAME}/math/src')
  71. env.InstallTopLevel(math_utest_files,
  72. sub_dir='epid/${PART_SHORT_NAME}/math/unittests')
  73. env.InstallTopLevel(build_files, sub_dir='epid/${PART_SHORT_NAME}')
  74. else:
  75. env.DependsOn([
  76. Component('ippcp'),
  77. ])
  78. if 'use_memory_profiler' in env['MODE']:
  79. env.DependsOn([Component('memory_profiler')])
  80. env.Append(CPPPATH='#')
  81. testenv = env.Clone()
  82. env.SdkInclude(api_headers, sub_dir='epid/${PART_SHORT_NAME}')
  83. env.SdkInclude(epid11_headers, sub_dir='epid/${PART_SHORT_NAME}/1.1')
  84. outputs = env.Library('${PART_NAME}',
  85. src_files + epid11_src_files + math_src_files)
  86. env.Sdk(outputs)
  87. if 'install_lib' in env['MODE']:
  88. env.InstallLib(outputs)
  89. env.InstallInclude(api_headers, sub_dir='${PART_SHORT_NAME}')
  90. env.InstallInclude(epid11_headers, sub_dir='${PART_SHORT_NAME}/1.1')
  91. # unit tests
  92. testenv['UNIT_TEST_TARGET_NAME'] = "${PART_NAME}-${UNIT_TEST_TARGET}"
  93. testenv.UnitTest("utest",
  94. utest_files + math_utest_files + epid11_utest_files,
  95. command_args=[
  96. '--gtest_color=yes',
  97. '--gtest_print_time=1',
  98. '--gtest_output=xml',
  99. '--gtest_filter=**',
  100. ],
  101. make_pdb=(env.isConfigBasedOn('debug')),
  102. depends=[Component('gtest'),
  103. Component('common'),
  104. Component('common-testhelper')],
  105. INSTALL_BIN='${INSTALL_TEST_BIN}')