util.parts 2.0 KB

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