2017-12-21 03:13:23 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2020-03-30 08:28:32 +02:00
|
|
|
Import("env")
|
|
|
|
Import("env_modules")
|
2017-12-21 03:13:23 +01:00
|
|
|
|
2019-06-24 15:46:24 +02:00
|
|
|
env_ws = env_modules.Clone()
|
2017-12-21 03:13:23 +01:00
|
|
|
|
2020-12-17 16:01:36 +01:00
|
|
|
thirdparty_obj = []
|
|
|
|
|
2020-10-17 23:31:30 +02:00
|
|
|
if env["platform"] == "javascript":
|
|
|
|
# Our JavaScript/C++ interface.
|
|
|
|
env.AddJSLibraries(["library_godot_websocket.js"])
|
2020-12-17 16:01:36 +01:00
|
|
|
|
2020-10-17 23:31:30 +02:00
|
|
|
elif env["builtin_wslay"]:
|
|
|
|
# Thirdparty source files
|
2020-12-17 16:01:36 +01:00
|
|
|
thirdparty_dir = "#thirdparty/wslay/"
|
|
|
|
thirdparty_sources = [
|
2019-06-24 15:46:24 +02:00
|
|
|
"wslay_net.c",
|
|
|
|
"wslay_event.c",
|
|
|
|
"wslay_queue.c",
|
|
|
|
"wslay_stack.c",
|
|
|
|
"wslay_frame.c",
|
|
|
|
]
|
2020-12-17 16:01:36 +01:00
|
|
|
thirdparty_sources = [thirdparty_dir + s for s in thirdparty_sources]
|
|
|
|
|
|
|
|
env_ws.Prepend(CPPPATH=[thirdparty_dir + "includes/"])
|
2019-07-01 18:14:26 +02:00
|
|
|
env_ws.Append(CPPDEFINES=["HAVE_CONFIG_H"])
|
2020-12-17 16:01:36 +01:00
|
|
|
|
2019-06-24 15:46:24 +02:00
|
|
|
if env["platform"] == "windows" or env["platform"] == "uwp":
|
2019-07-01 18:14:26 +02:00
|
|
|
env_ws.Append(CPPDEFINES=["HAVE_WINSOCK2_H"])
|
2019-06-24 15:46:24 +02:00
|
|
|
else:
|
2019-07-01 18:14:26 +02:00
|
|
|
env_ws.Append(CPPDEFINES=["HAVE_NETINET_IN_H"])
|
2019-06-24 15:46:24 +02:00
|
|
|
|
2020-12-17 16:01:36 +01: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)
|