SCsub 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. "miniupnpc.c",
  11. "upnpcommands.c",
  12. "miniwget.c",
  13. "upnpdev.c",
  14. "igd_desc_parse.c",
  15. "minissdpc.c",
  16. "minisoap.c",
  17. "minixml.c",
  18. "connecthostport.c",
  19. "receivedata.c",
  20. "portlistingparse.c",
  21. "upnpreplyparse.c",
  22. ]
  23. thirdparty_sources = [thirdparty_dir + "miniupnpc/" + file for file in thirdparty_sources]
  24. env_upnp.Prepend(CPPPATH=[thirdparty_dir])
  25. env_upnp.Append(CPPDEFINES=["MINIUPNP_STATICLIB"])
  26. env_upnp.Append(CPPDEFINES=["MINIUPNPC_SET_SOCKET_TIMEOUT"])
  27. env_thirdparty = env_upnp.Clone()
  28. env_thirdparty.disable_warnings()
  29. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
  30. env.modules_sources += thirdparty_obj
  31. # Godot source files
  32. module_obj = []
  33. env_upnp.add_source_files(module_obj, "*.cpp")
  34. env.modules_sources += module_obj
  35. # Needed to force rebuilding the module files when the thirdparty library is updated.
  36. env.Depends(module_obj, thirdparty_obj)