SCsub 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env python
  2. from misc.utility.scons_hints import *
  3. Import("env")
  4. Import("env_modules")
  5. env_upnp = env_modules.Clone()
  6. # Thirdparty source files
  7. thirdparty_obj = []
  8. if env["builtin_miniupnpc"]:
  9. thirdparty_dir = "#thirdparty/miniupnpc/"
  10. thirdparty_sources = [
  11. "igd_desc_parse.c",
  12. "miniupnpc.c",
  13. "minixml.c",
  14. "minisoap.c",
  15. "minissdpc.c",
  16. "miniwget.c",
  17. "upnpcommands.c",
  18. "upnpdev.c",
  19. "upnpreplyparse.c",
  20. "connecthostport.c",
  21. "portlistingparse.c",
  22. "receivedata.c",
  23. "addr_is_reserved.c",
  24. ]
  25. thirdparty_sources = [thirdparty_dir + "src/" + file for file in thirdparty_sources]
  26. env_upnp.Prepend(CPPPATH=[thirdparty_dir + "include"])
  27. env_upnp.Append(CPPDEFINES=["MINIUPNP_STATICLIB"])
  28. if env["platform"] != "windows":
  29. env_upnp.Append(CPPDEFINES=["MINIUPNPC_SET_SOCKET_TIMEOUT"])
  30. env_thirdparty = env_upnp.Clone()
  31. env_thirdparty.disable_warnings()
  32. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
  33. env.modules_sources += thirdparty_obj
  34. # Godot source files
  35. module_obj = []
  36. env_upnp.add_source_files(module_obj, "*.cpp")
  37. env.modules_sources += module_obj
  38. # Needed to force rebuilding the module files when the thirdparty library is updated.
  39. env.Depends(module_obj, thirdparty_obj)