Skip to content

Commit

Permalink
Potentially fixed Issue #9.
Browse files Browse the repository at this point in the history
Signed-off-by: David Rebbe <[email protected]>
  • Loading branch information
drebbe-intrepid committed Jul 17, 2019
1 parent 4638a06 commit cedbef6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
52 changes: 34 additions & 18 deletions python/setup.py → setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,48 @@ def __str__(self):
return pybind11.get_include(self.user)


source_includes = ['src/main.cpp', '../fifo.c', '../device.cpp',
'../hiddevice.cpp', '../libneoradio2.cpp', '../neoradio2device.cpp',]
source_includes = ['python/src/main.cpp', 'fifo.c', 'device.cpp',
'hiddevice.cpp', 'libneoradio2.cpp', 'neoradio2device.cpp',]

header_includes = []
for root, dirs, files in os.walk('.'):
for file in files:
if file.endswith('.h'):
header_includes.append(os.path.join(root, file))


library_includes = []
if 'NT' in os.name.upper():
source_includes.append('../hidapi/windows/hid.c')
source_includes.append('hidapi/windows/hid.c')
elif platform.system().upper() == 'DARWIN':
source_includes.append('../hidapi/mac/hid.c')
#library_includes.append('IOKit')
source_includes.append('hidapi/mac/hid.c')
else:
source_includes.append('../hidapi/linux/hid.c')
source_includes.append('hidapi/linux/hid.c')
library_includes.append('udev')

# Clang complains about the c++14 flag when its the clang c compiler so lets force
# it here to use the clang++ compiler always.
# macOS X clang linker complains if these are at the end of the argument parameters
# LDFLAGS puts them in the beginning.
if platform.system().upper() == 'DARWIN':
os.environ["LDFLAGS"] = "-framework IOKit -framework CoreFoundation"

ext_modules = [
Extension(
'neoradio2',
source_includes,
libraries = library_includes,
sources=source_includes,
libraries=library_includes,
include_dirs=[
# Path to pybind11 headers
get_pybind_include(),
get_pybind_include(user=True),
'../hidapi/hidapi',
'hidapi/hidapi',
'.',
get_python_inc(True),
os.path.abspath('./'),
os.path.abspath('../'),
os.path.abspath('.'),
],
language='c++'
),
]

print(os.path.abspath('../'))


print(os.path.abspath('.'))

# As of Python 3.6, CCompiler has a `has_flag` method.
# cf http://bugs.python.org/issue26689
Expand Down Expand Up @@ -147,18 +150,31 @@ def _new_compile(self, obj, src, ext, cc_args, extra_postargs):
build_ext.build_extensions(self)


def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()

setup(
name='neoradio2',
version=__version__,
author='David Rebbe',
author_email='[email protected]',
url='https://github.com/intrepidcs/libneoradio2',
download_url='https://github.com/intrepidcs/libneoradio2/releases',
description='neoRADIO2 python bindings',
long_description='',
long_description=read('README.md'),
ext_modules=ext_modules,
data_files=[('', ['version.py'].append(header_includes))],
install_requires=['pybind11>=2.2'],
setup_requires=['pybind11>=2.2'],
cmdclass={'build_ext': BuildExt},
zip_safe=False,

classifiers = [
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
)
File renamed without changes.

0 comments on commit cedbef6

Please sign in to comment.