SConscript 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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" and rtconfig.ARCH != "arm":
  13. # not supported arch
  14. src = []
  15. elif rtconfig.ARCH == "arm" and rtconfig.CPU != "cortex-a":
  16. # not supported arch
  17. src = []
  18. else:
  19. vdso_user = os.path.join(cwd, 'user')
  20. process_env = os.environ.copy()
  21. if hasattr(rtconfig, 'EXEC_PATH') and rtconfig.EXEC_PATH is not None:
  22. process_env['RTT_EXEC_PATH'] = rtconfig.EXEC_PATH
  23. if hasattr(rtconfig, 'PREFIX') and rtconfig.PREFIX is not None:
  24. process_env['RTT_CC_PREFIX'] = rtconfig.PREFIX
  25. if hasattr(rtconfig, 'DEVICE') and rtconfig.DEVICE is not None:
  26. process_env['RTT_DEVICE'] = rtconfig.DEVICE
  27. command = ["scons", "-C", vdso_user, "RTT_VDSO_ARCH=%s" % rtconfig.ARCH]
  28. if GetOption('clean'):
  29. command = ["scons", "-C", vdso_user, "RTT_VDSO_ARCH=%s" % rtconfig.ARCH, "--clean"]
  30. try:
  31. result = subprocess.run(command, env=process_env, check=True)
  32. # generic error handle
  33. except :
  34. print('exec command: "%s" failed.' % ' '.join(command))
  35. exit(1)
  36. print("Command executed successfully")
  37. group = DefineGroup('lwProcess', src, depend = ['RT_USING_SMART','RT_USING_VDSO'], CPPPATH = CPPPATH)
  38. Return('group')