SConscript 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. Import('rtconfig')
  2. from building import *
  3. import os
  4. import shutil
  5. src = ['perf_counter.c', 'os/perf_os_patch_rt_thread.c']
  6. cwd = GetCurrentDir()
  7. path = [cwd]
  8. CPPDEFINES = ['__PERF_COUNT_PLATFORM_SPECIFIC_HEADER__=<rtthread.h>', '__perf_counter_printf__=rt_kprintf']
  9. if GetDepend('PKG_PERF_COUNTER_USING_THREAD_STATISTIC'):
  10. CPPDEFINES += ['__PERF_CNT_USE_RTOS__']
  11. #delate unused files
  12. try:
  13. shutil.rmtree(os.path.join(cwd,'.github'))
  14. shutil.rmtree(os.path.join(cwd,'.vscode'))
  15. shutil.rmtree(os.path.join(cwd,'CI'))
  16. shutil.rmtree(os.path.join(cwd,'cmsis-pack'))
  17. shutil.rmtree(os.path.join(cwd,'lib'))
  18. shutil.rmtree(os.path.join(cwd,'example'))
  19. os.remove(os.path.join(cwd,'systick_wrapper_gcc.s'))
  20. os.remove(os.path.join(cwd,'systick_wrapper_gnu.s'))
  21. os.remove(os.path.join(cwd,'systick_wrapper_ual.s'))
  22. except:
  23. pass
  24. CXXFLAGS = ''
  25. if rtconfig.PLATFORM == 'armcc': # Keil AC5
  26. CXXFLAGS += ' --gnu'
  27. group = DefineGroup('perf_counter', src, depend = ['PKG_USING_PERF_COUNTER'], CPPDEFINES = CPPDEFINES, CPPPATH = path, CXXFLAGS = CXXFLAGS)
  28. Return('group')