SConstruct 1.3 KB

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