SCsub 1.3 KB

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