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

Commit 5454bae

Browse files
committed
win: update metawear sdk version and restore setup script.
1 parent 31a7a5d commit 5454bae

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

setup.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ def run(self):
1919
if os.path.isfile(bindings):
2020
os.remove(bindings)
2121

22-
if (platform.system() == 'Linux'):
22+
if (platform.system() == 'Windows'):
23+
dll = os.path.join(dest, "MetaWear.Win32.dll")
24+
if os.path.isfile(dll):
25+
os.remove(dll)
26+
elif (platform.system() == 'Linux'):
2327
for f in os.listdir(dest):
2428
if (f.startswith("libmetawear.so")):
2529
os.remove(os.path.join(dest, f))
@@ -34,14 +38,19 @@ def _move(src, dest, basename):
3438
def run(self):
3539
cpp_sdk = os.path.join(root, 'MetaWear-SDK-Cpp')
3640
system = platform.system()
37-
dist_dir = os.path.join(cpp_sdk, 'dist', 'release', 'lib', machine)
41+
dist_dir = os.path.join(cpp_sdk, 'dist', 'release', 'lib', "Win32" if machine == "x86" and system == "Windows" else machine)
3842

3943
if os.path.exists(os.path.join(root, '.git')):
4044
status = call(["git", "submodule", "update", "--init"], cwd=root, stderr=STDOUT)
4145
if (status != 0):
4246
raise RuntimeError("Could not init git submodule")
4347

44-
if (system == 'Linux'):
48+
if (system == 'Windows'):
49+
if (call(["MSBuild.exe", "MetaWear.Win32.vcxproj", "/p:Platform=%s" % machine, "/p:Configuration=Release"], cwd=cpp_sdk, stderr=STDOUT) != 0):
50+
raise RuntimeError("Failed to compile MetaWear.dll")
51+
52+
move(os.path.join(dist_dir, "MetaWear.Win32.dll"), dest)
53+
elif (system == 'Linux'):
4554
status = call(["make", "-C", "MetaWear-SDK-Cpp", "OPT_FLAGS=-Wno-strict-aliasing", "-j%d" % (cpu_count())], cwd=root, stderr=STDOUT)
4655
if (status != 0):
4756
raise RuntimeError("Failed to compile C++ SDK")
@@ -53,11 +62,11 @@ def run(self):
5362
copy2(os.path.join(cpp_sdk, 'bindings', 'python', 'mbientlab', 'metawear', 'cbindings.py'), dest)
5463
build_py.run(self)
5564

56-
so_pkg_data = ['libmetawear.so']
65+
so_pkg_data = ['libmetawear.so'] if platform.system() == 'Linux' else ['MetaWear.Win32.dll']
5766
setup(
5867
name='metawear',
5968
packages=['mbientlab', 'mbientlab.metawear'],
60-
version='1.0.3',
69+
version='1.0.4',
6170
description='Python bindings for the MetaWear C++ SDK by MbientLab',
6271
long_description=open(os.path.join(os.path.dirname(__file__), "README.md")).read(),
6372
package_data={'mbientlab.metawear': so_pkg_data},
@@ -79,6 +88,7 @@ def run(self):
7988
'Development Status :: 4 - Beta',
8089
'Intended Audience :: Developers',
8190
'Operating System :: POSIX :: Linux',
91+
'Operating System :: Microsoft :: Windows :: Windows 10',
8292
'Programming Language :: Python :: 3',
8393
]
8494
)

0 commit comments

Comments
 (0)