SConscript 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import os
  2. import rtconfig
  3. import subprocess
  4. from building import *
  5. group = []
  6. cwd = GetCurrentDir()
  7. CPPPATH = [cwd, cwd + "/kernel"]
  8. list = os.listdir(cwd)
  9. src = Glob('kernel/*.c') + Glob('kernel/*.S')
  10. if not GetDepend(['RT_USING_VDSO']):
  11. Return('group')
  12. if rtconfig.ARCH != "aarch64" and rtconfig.ARCH != "risc-v":
  13. # not supported arch
  14. src = []
  15. else:
  16. vdso_user = os.path.join(cwd, 'user')
  17. process_env = os.environ.copy()
  18. if hasattr(rtconfig, 'EXEC_PATH') and rtconfig.EXEC_PATH is not None:
  19. process_env['RTT_EXEC_PATH'] = rtconfig.EXEC_PATH
  20. if hasattr(rtconfig, 'PREFIX') and rtconfig.PREFIX is not None:
  21. process_env['RTT_CC_PREFIX'] = rtconfig.PREFIX
  22. if hasattr(rtconfig, 'DEVICE') and rtconfig.DEVICE is not None:
  23. process_env['RTT_DEVICE'] = rtconfig.DEVICE
  24. command = ["scons", "-C", vdso_user, "RTT_VDSO_ARCH=%s" % rtconfig.ARCH]
  25. if GetOption('clean'):
  26. command = ["scons", "-C", vdso_user, "RTT_VDSO_ARCH=%s" % rtconfig.ARCH, "--clean"]
  27. try:
  28. result = subprocess.run(command, env=process_env, check=True)
  29. # generic error handle
  30. except :
  31. print('exec command: "%s" failed.' % ' '.join(command))
  32. exit(1)
  33. print("Command executed successfully")
  34. group = DefineGroup('lwProcess', src, depend = ['RT_USING_SMART','RT_USING_VDSO'], CPPPATH = CPPPATH)
  35. Return('group')