Skip to content
This repository was archived by the owner on Jul 20, 2025. It is now read-only.

Commit 387c0eb

Browse files
committed
Fixed path issue with Win32 build
1 parent 5b4cd4c commit 387c0eb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

setup.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import platform
1010
import sys
1111

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"))
1313
root = os.path.dirname(os.path.abspath(__file__))
1414
dest = os.path.join("mbientlab", "metawear")
1515

@@ -37,19 +37,20 @@ def _move(src, dest, basename):
3737

3838
def run(self):
3939
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)
4142

4243
if os.path.exists(os.path.join(root, '.git')):
4344
status = call(["git", "submodule", "update", "--init"], cwd=root, stderr=STDOUT)
4445
if (status != 0):
4546
raise RuntimeError("Could not init git submodule")
4647

47-
if (platform.system() == 'Windows'):
48+
if (system == 'Windows'):
4849
if (call(["MSBuild.exe", "MetaWear.Win32.vcxproj", "/p:Platform=%s" % machine, "/p:Configuration=Release"], cwd=cpp_sdk, stderr=STDOUT) != 0):
4950
raise RuntimeError("Failed to compile MetaWear.dll")
5051

5152
move(os.path.join(dist_dir, "MetaWear.Win32.dll"), dest)
52-
elif (platform.system() == 'Linux'):
53+
elif (system == 'Linux'):
5354
status = call(["make", "-C", "MetaWear-SDK-Cpp", "OPT_FLAGS=-Wno-strict-aliasing", "-j%d" % (cpu_count())], cwd=root, stderr=STDOUT)
5455
if (status != 0):
5556
raise RuntimeError("Failed to compile C++ SDK")

0 commit comments

Comments
 (0)