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