SConstruct 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/usr/bin/env python
  2. import os
  3. import platform
  4. import sys
  5. import subprocess
  6. from binding_generator import scons_generate_bindings, scons_emit_files
  7. EnsureSConsVersion(4, 0)
  8. try:
  9. Import("env")
  10. except:
  11. # Default tools with no platform defaults to gnu toolchain.
  12. # We apply platform specific toolchains via our custom tools.
  13. env = Environment(tools=["default"], PLATFORM="")
  14. env.PrependENVPath("PATH", os.getenv("PATH"))
  15. # Custom options and profile flags.
  16. customs = ["custom.py"]
  17. try:
  18. customs += Import("customs")
  19. except:
  20. pass
  21. profile = ARGUMENTS.get("profile", "")
  22. if profile:
  23. if os.path.isfile(profile):
  24. customs.append(profile)
  25. elif os.path.isfile(profile + ".py"):
  26. customs.append(profile + ".py")
  27. opts = Variables(customs, ARGUMENTS)
  28. cpp_tool = Tool("godotcpp", toolpath=["tools"])
  29. cpp_tool.options(opts, env)
  30. opts.Update(env)
  31. Help(opts.GenerateHelpText(env))
  32. # Detect and print a warning listing unknown SCons variables to ease troubleshooting.
  33. unknown = opts.UnknownVariables()
  34. if unknown:
  35. print("WARNING: Unknown SCons variables were passed and will be ignored:")
  36. for item in unknown.items():
  37. print(" " + item[0] + "=" + item[1])
  38. scons_cache_path = os.environ.get("SCONS_CACHE")
  39. if scons_cache_path is not None:
  40. CacheDir(scons_cache_path)
  41. Decider("MD5")
  42. cpp_tool.generate(env)
  43. library = env.GodotCPP()
  44. Return("env")