SCsub 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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"] and env["platform"] != "web":
  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.Prepend(CPPPATH=[thirdparty_dir + "include/miniupnpc"])
  32. env_thirdparty.disable_warnings()
  33. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
  34. env.modules_sources += thirdparty_obj
  35. # Godot source files
  36. module_obj = []
  37. env_upnp.add_source_files(module_obj, "*.cpp")
  38. env.modules_sources += module_obj
  39. # Needed to force rebuilding the module files when the thirdparty library is updated.
  40. env.Depends(module_obj, thirdparty_obj)