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

Commit b730244

Browse files
authored
Merge pull request #25 from mbientlab/win_usb
Release Win 10 support in binary format
2 parents 5e18fae + fb1d754 commit b730244

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

setup.py

Lines changed: 18 additions & 6 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,20 @@ 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 not os.path.exists(os.path.join(dist_dir, "MetaWear.Win32.dll")):
50+
if (call(["MSBuild.exe", "MetaWear.Win32.vcxproj", "/p:Platform=%s" % machine, "/p:Configuration=Release"], cwd=cpp_sdk, stderr=STDOUT) != 0):
51+
raise RuntimeError("Failed to compile MetaWear.dll")
52+
53+
copy2(os.path.join(dist_dir, "MetaWear.Win32.dll"), dest)
54+
elif (system == 'Linux'):
4555
status = call(["make", "-C", "MetaWear-SDK-Cpp", "OPT_FLAGS=-Wno-strict-aliasing", "-j%d" % (cpu_count())], cwd=root, stderr=STDOUT)
4656
if (status != 0):
4757
raise RuntimeError("Failed to compile C++ SDK")
@@ -53,11 +63,11 @@ def run(self):
5363
copy2(os.path.join(cpp_sdk, 'bindings', 'python', 'mbientlab', 'metawear', 'cbindings.py'), dest)
5464
build_py.run(self)
5565

56-
so_pkg_data = ['libmetawear.so']
66+
so_pkg_data = ['libmetawear.so'] if platform.system() == 'Linux' else ['MetaWear.Win32.dll']
5767
setup(
5868
name='metawear',
5969
packages=['mbientlab', 'mbientlab.metawear'],
60-
version='1.0.3',
70+
version='1.0.4',
6171
description='Python bindings for the MetaWear C++ SDK by MbientLab',
6272
long_description=open(os.path.join(os.path.dirname(__file__), "README.md")).read(),
6373
package_data={'mbientlab.metawear': so_pkg_data},
@@ -67,7 +77,8 @@ def run(self):
6777
author_email="[email protected]",
6878
install_requires=[
6979
'warble >= 1.1, < 2.0',
70-
'requests'
80+
'requests',
81+
'pyserial'
7182
],
7283
cmdclass={
7384
'build_py': MetaWearBuild,
@@ -79,6 +90,7 @@ def run(self):
7990
'Development Status :: 4 - Beta',
8091
'Intended Audience :: Developers',
8192
'Operating System :: POSIX :: Linux',
93+
'Operating System :: Microsoft :: Windows :: Windows 10',
8294
'Programming Language :: Python :: 3',
8395
]
8496
)

0 commit comments

Comments
 (0)