SCsub 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/bin/env python
  2. Import("env")
  3. Import("env_modules")
  4. env_ws = env_modules.Clone()
  5. thirdparty_obj = []
  6. if env["platform"] == "javascript":
  7. # Our JavaScript/C++ interface.
  8. env.AddJSLibraries(["library_godot_websocket.js"])
  9. elif env["builtin_wslay"]:
  10. # Thirdparty source files
  11. thirdparty_dir = "#thirdparty/wslay/"
  12. thirdparty_sources = [
  13. "wslay_net.c",
  14. "wslay_event.c",
  15. "wslay_queue.c",
  16. "wslay_stack.c",
  17. "wslay_frame.c",
  18. ]
  19. thirdparty_sources = [thirdparty_dir + s for s in thirdparty_sources]
  20. env_ws.Prepend(CPPPATH=[thirdparty_dir + "includes/"])
  21. env_ws.Append(CPPDEFINES=["HAVE_CONFIG_H"])
  22. if env["platform"] == "windows" or env["platform"] == "uwp":
  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. env.modules_sources += module_obj
  34. # Needed to force rebuilding the module files when the thirdparty library is updated.
  35. env.Depends(module_obj, thirdparty_obj)