2017-12-21 02:13:23 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2020-03-30 06:28:32 +00:00
|
|
|
Import("env")
|
|
|
|
Import("env_modules")
|
2017-12-21 02:13:23 +00:00
|
|
|
|
2019-06-24 13:46:24 +00:00
|
|
|
env_ws = env_modules.Clone()
|
2017-12-21 02:13:23 +00:00
|
|
|
|
2020-12-17 15:01:36 +00:00
|
|
|
thirdparty_obj = []
|
|
|
|
|
2020-10-17 21:31:30 +00:00
|
|
|
if env["platform"] == "javascript":
|
|
|
|
# Our JavaScript/C++ interface.
|
|
|
|
env.AddJSLibraries(["library_godot_websocket.js"])
|
2020-12-17 15:01:36 +00:00
|
|
|
|
2020-10-17 21:31:30 +00:00
|
|
|
elif env["builtin_wslay"]:
|
|
|
|
# Thirdparty source files
|
2020-12-17 15:01:36 +00:00
|
|
|
thirdparty_dir = "#thirdparty/wslay/"
|
|
|
|
thirdparty_sources = [
|
2019-06-24 13:46:24 +00:00
|
|
|
"wslay_net.c",
|
|
|
|
"wslay_event.c",
|
|
|
|
"wslay_queue.c",
|
|
|
|
"wslay_frame.c",
|
|
|
|
]
|
2020-12-17 15:01:36 +00:00
|
|
|
thirdparty_sources = [thirdparty_dir + s for s in thirdparty_sources]
|
|
|
|
|
2021-11-19 12:28:01 +00:00
|
|
|
env_ws.Prepend(CPPPATH=[thirdparty_dir])
|
2019-07-01 16:14:26 +00:00
|
|
|
env_ws.Append(CPPDEFINES=["HAVE_CONFIG_H"])
|
2020-12-17 15:01:36 +00:00
|
|
|
|
2019-06-24 13:46:24 +00:00
|
|
|
if env["platform"] == "windows" or env["platform"] == "uwp":
|
2019-07-01 16:14:26 +00:00
|
|
|
env_ws.Append(CPPDEFINES=["HAVE_WINSOCK2_H"])
|
2019-06-24 13:46:24 +00:00
|
|
|
else:
|
2019-07-01 16:14:26 +00:00
|
|
|
env_ws.Append(CPPDEFINES=["HAVE_NETINET_IN_H"])
|
2019-06-24 13:46:24 +00:00
|
|
|
|
2020-12-17 15:01:36 +00:00
|
|
|
env_thirdparty = env_ws.Clone()
|
|
|
|
env_thirdparty.disable_warnings()
|
|
|
|
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
|
|
|
|
env.modules_sources += thirdparty_obj
|
|
|
|
|
|
|
|
|
|
|
|
# Godot source files
|
|
|
|
|
|
|
|
module_obj = []
|
|
|
|
|
|
|
|
env_ws.add_source_files(module_obj, "*.cpp")
|
|
|
|
env.modules_sources += module_obj
|
|
|
|
|
|
|
|
# Needed to force rebuilding the module files when the thirdparty library is updated.
|
|
|
|
env.Depends(module_obj, thirdparty_obj)
|