-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from mbientlab/win_usb
Release Win 10 support in binary format
- Loading branch information
Showing
2 changed files
with
19 additions
and
7 deletions.
There are no files selected for viewing
Submodule MetaWear-SDK-Cpp
updated
10 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,11 @@ def run(self): | |
if os.path.isfile(bindings): | ||
os.remove(bindings) | ||
|
||
if (platform.system() == 'Linux'): | ||
if (platform.system() == 'Windows'): | ||
dll = os.path.join(dest, "MetaWear.Win32.dll") | ||
if os.path.isfile(dll): | ||
os.remove(dll) | ||
elif (platform.system() == 'Linux'): | ||
for f in os.listdir(dest): | ||
if (f.startswith("libmetawear.so")): | ||
os.remove(os.path.join(dest, f)) | ||
|
@@ -34,14 +38,20 @@ def _move(src, dest, basename): | |
def run(self): | ||
cpp_sdk = os.path.join(root, 'MetaWear-SDK-Cpp') | ||
system = platform.system() | ||
dist_dir = os.path.join(cpp_sdk, 'dist', 'release', 'lib', machine) | ||
dist_dir = os.path.join(cpp_sdk, 'dist', 'release', 'lib', "Win32" if machine == "x86" and system == "Windows" else machine) | ||
|
||
if os.path.exists(os.path.join(root, '.git')): | ||
status = call(["git", "submodule", "update", "--init"], cwd=root, stderr=STDOUT) | ||
if (status != 0): | ||
raise RuntimeError("Could not init git submodule") | ||
|
||
if (system == 'Linux'): | ||
if (system == 'Windows'): | ||
if not os.path.exists(os.path.join(dist_dir, "MetaWear.Win32.dll")): | ||
if (call(["MSBuild.exe", "MetaWear.Win32.vcxproj", "/p:Platform=%s" % machine, "/p:Configuration=Release"], cwd=cpp_sdk, stderr=STDOUT) != 0): | ||
raise RuntimeError("Failed to compile MetaWear.dll") | ||
|
||
copy2(os.path.join(dist_dir, "MetaWear.Win32.dll"), dest) | ||
elif (system == 'Linux'): | ||
status = call(["make", "-C", "MetaWear-SDK-Cpp", "OPT_FLAGS=-Wno-strict-aliasing", "-j%d" % (cpu_count())], cwd=root, stderr=STDOUT) | ||
if (status != 0): | ||
raise RuntimeError("Failed to compile C++ SDK") | ||
|
@@ -53,11 +63,11 @@ def run(self): | |
copy2(os.path.join(cpp_sdk, 'bindings', 'python', 'mbientlab', 'metawear', 'cbindings.py'), dest) | ||
build_py.run(self) | ||
|
||
so_pkg_data = ['libmetawear.so'] | ||
so_pkg_data = ['libmetawear.so'] if platform.system() == 'Linux' else ['MetaWear.Win32.dll'] | ||
setup( | ||
name='metawear', | ||
packages=['mbientlab', 'mbientlab.metawear'], | ||
version='1.0.3', | ||
version='1.0.4', | ||
description='Python bindings for the MetaWear C++ SDK by MbientLab', | ||
long_description=open(os.path.join(os.path.dirname(__file__), "README.md")).read(), | ||
package_data={'mbientlab.metawear': so_pkg_data}, | ||
|
@@ -67,7 +77,8 @@ def run(self): | |
author_email="[email protected]", | ||
install_requires=[ | ||
'warble >= 1.1, < 2.0', | ||
'requests' | ||
'requests', | ||
'pyserial' | ||
], | ||
cmdclass={ | ||
'build_py': MetaWearBuild, | ||
|
@@ -79,6 +90,7 @@ def run(self): | |
'Development Status :: 4 - Beta', | ||
'Intended Audience :: Developers', | ||
'Operating System :: POSIX :: Linux', | ||
'Operating System :: Microsoft :: Windows :: Windows 10', | ||
'Programming Language :: Python :: 3', | ||
] | ||
) |