SCsub 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env python
  2. from misc.utility.scons_hints import *
  3. Import("env")
  4. Import("env_modules")
  5. env_ws = env_modules.Clone()
  6. thirdparty_obj = []
  7. if env["platform"] == "web":
  8. # Our JavaScript/C++ interface.
  9. env.AddJSLibraries(["library_godot_websocket.js"])
  10. elif env["builtin_wslay"]:
  11. # Thirdparty source files
  12. thirdparty_dir = "#thirdparty/wslay/"
  13. thirdparty_sources = [
  14. "wslay_net.c",
  15. "wslay_event.c",
  16. "wslay_queue.c",
  17. "wslay_frame.c",
  18. ]
  19. thirdparty_sources = [thirdparty_dir + s for s in thirdparty_sources]
  20. env_ws.Prepend(CPPPATH=[thirdparty_dir])
  21. env_ws.Append(CPPDEFINES=["HAVE_CONFIG_H"])
  22. if env["platform"] == "windows":
  23. env_ws.Append(CPPDEFINES=["HAVE_WINSOCK2_H"])
  24. else:
  25. env_ws.Append(CPPDEFINES=["HAVE_NETINET_IN_H"])
  26. env_thirdparty = env_ws.Clone()
  27. env_thirdparty.disable_warnings()
  28. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
  29. env.modules_sources += thirdparty_obj
  30. # Godot source files
  31. module_obj = []
  32. env_ws.add_source_files(module_obj, "*.cpp")
  33. if env.editor_build:
  34. env_ws.add_source_files(module_obj, "editor/*.cpp")
  35. env.modules_sources += module_obj
  36. # Needed to force rebuilding the module files when the thirdparty library is updated.
  37. env.Depends(module_obj, thirdparty_obj)