-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathSCsub
48 lines (35 loc) · 1.37 KB
/
SCsub
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
Import("env")
Import("env_modules")
env_serial = env_modules.Clone()
# Thirdparty source files
serial_obj = []
serial_dir = "serial/"
serial_sources = ["src/serial.cc"]
if env["platform"] == "windows":
serial_sources.append("src/impl/win.cc")
serial_sources.append("src/impl/list_ports/list_ports_win.cc")
if env.get("is_msvc", True):
env.Append(LINKFLAGS=["setupapi.lib", "Advapi32.lib"])
else:
env.Append(LIBS=["setupapi", "Advapi32"])
elif env["platform"].startswith("linux"):
serial_sources.append("src/impl/unix.cc")
serial_sources.append("src/impl/list_ports/list_ports_linux.cc")
env.Append(LIBS=["rt", "pthread"])
elif env["platform"] == "osx":
serial_sources.append("src/impl/unix.cc")
serial_sources.append("src/impl/list_ports/list_ports_osx.cc")
print("Build for {0}.".format(env["platform"]))
serial_sources = [serial_dir + file for file in serial_sources]
env_serial.Prepend(CPPPATH=[serial_dir + "include"])
env_serial = env_serial.Clone()
env_serial.disable_warnings()
env_serial.add_source_files(serial_obj, serial_sources)
env.modules_sources += serial_obj
# Godot source files
module_obj = []
env_serial.add_source_files(module_obj, "*.cpp")
env.modules_sources += module_obj
# Needed to force rebuilding the module files when the serial library is updated.
env.Depends(module_obj, serial_obj)