|
9 | 9 | import platform |
10 | 10 | import sys |
11 | 11 |
|
12 | | -machine = "arm" if "arm" in platform.machine() else ("x64" if sys.maxsize > 2**32 else "x86") |
| 12 | +machine = os.environ['MACHINE'] if 'MACHINE' in os.environ else ("arm" if "arm" in platform.machine() else ("x64" if sys.maxsize > 2**32 else "x86")) |
13 | 13 | root = os.path.dirname(os.path.abspath(__file__)) |
14 | 14 | dest = os.path.join("mbientlab", "metawear") |
15 | 15 |
|
@@ -37,19 +37,20 @@ def _move(src, dest, basename): |
37 | 37 |
|
38 | 38 | def run(self): |
39 | 39 | cpp_sdk = os.path.join(root, 'MetaWear-SDK-Cpp') |
40 | | - dist_dir = os.path.join(cpp_sdk, 'dist', 'release', 'lib', machine) |
| 40 | + system = platform.system() |
| 41 | + dist_dir = os.path.join(cpp_sdk, 'dist', 'release', 'lib', "Win32" if machine == "x86" and system == "Windows" else machine) |
41 | 42 |
|
42 | 43 | if os.path.exists(os.path.join(root, '.git')): |
43 | 44 | status = call(["git", "submodule", "update", "--init"], cwd=root, stderr=STDOUT) |
44 | 45 | if (status != 0): |
45 | 46 | raise RuntimeError("Could not init git submodule") |
46 | 47 |
|
47 | | - if (platform.system() == 'Windows'): |
| 48 | + if (system == 'Windows'): |
48 | 49 | if (call(["MSBuild.exe", "MetaWear.Win32.vcxproj", "/p:Platform=%s" % machine, "/p:Configuration=Release"], cwd=cpp_sdk, stderr=STDOUT) != 0): |
49 | 50 | raise RuntimeError("Failed to compile MetaWear.dll") |
50 | 51 |
|
51 | 52 | move(os.path.join(dist_dir, "MetaWear.Win32.dll"), dest) |
52 | | - elif (platform.system() == 'Linux'): |
| 53 | + elif (system == 'Linux'): |
53 | 54 | status = call(["make", "-C", "MetaWear-SDK-Cpp", "OPT_FLAGS=-Wno-strict-aliasing", "-j%d" % (cpu_count())], cwd=root, stderr=STDOUT) |
54 | 55 | if (status != 0): |
55 | 56 | raise RuntimeError("Failed to compile C++ SDK") |
|
0 commit comments