util.parts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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("util")
  18. src_files = Pattern(src_dir='src',
  19. includes=['*.c'],
  20. recursive=True).files()
  21. api_headers = Pattern(src_dir='.',
  22. includes=['*.h'],
  23. recursive=False).files()
  24. parts_file = ['util.parts']
  25. makefile = ['Makefile']
  26. #unit tests
  27. utest_files = Pattern(src_dir='.',
  28. includes=['*-test.cc', '*-testhelper.cc'],
  29. excludes=[],
  30. recursive=True).files()
  31. if 'install_package' in env['MODE']:
  32. env.InstallTopLevel(src_files, sub_dir='example/${PART_SHORT_NAME}/src')
  33. env.InstallTopLevel(api_headers, sub_dir='example/${PART_SHORT_NAME}')
  34. env.InstallTopLevel(utest_files, sub_dir='example/${PART_SHORT_NAME}/utest')
  35. env.InstallTopLevel(parts_file, sub_dir='example/${PART_SHORT_NAME}')
  36. env.InstallTopLevel(makefile, sub_dir='example/${PART_SHORT_NAME}')
  37. else:
  38. env.DependsOn([Component('common', requires=REQ.HEADERS)])
  39. env.Append(CPPPATH='#/example')
  40. testenv = env.Clone()
  41. env.SdkInclude(api_headers, sub_dir='${PART_SHORT_NAME}')
  42. if env['TARGET_PLATFORM']['OS'] == 'win32':
  43. if env.isConfigBasedOn('debug'):
  44. env['PDB'] = '${PART_NAME}.pdb'
  45. #env.Append(CPPDEFINES = 'ENABLE_UTIL_DEBUG_PRINT_')
  46. env.Append(CPPDEFINES='_CRT_SECURE_NO_WARNINGS')
  47. outputs = env.Library('${PART_NAME}', src_files)
  48. env.Sdk(outputs)