1 from setuptools
import setup, Extension
2 from setuptools.command.build_ext
import build_ext
10 """Helper class to determine the pybind11 include path 12 The purpose of this class is to postpone importing pybind11 13 until it is actually installed, so that the ``get_include()`` 14 method can be invoked. """ 21 return pybind11.get_include(self.
user)
27 [
'src/log_reader.cpp',
28 '../../src/cltool.cpp',
29 '../../src/cltool_main.cpp',
30 '../../src/convert_ins.cpp',
31 '../../src/com_manager.c',
32 '../../src/data_sets.c',
33 '../../src/DataChunk.cpp',
34 '../../src/DataChunkSorted.cpp',
35 '../../src/DataCSV.cpp',
36 '../../src/DataJSON.cpp',
37 '../../src/DataKML.cpp',
38 '../../src/DeviceLog.cpp',
39 '../../src/DeviceLogCSV.cpp',
40 '../../src/DeviceLogJSON.cpp',
41 '../../src/DeviceLogKML.cpp',
42 '../../src/DeviceLogSerial.cpp',
43 '../../src/DeviceLogSorted.cpp',
44 '../../src/InertialSense.cpp',
45 '../../src/inertialSenseBootLoader.c',
47 '../../src/ISDataMappings.cpp',
48 '../../src/ISDisplay.cpp',
49 '../../src/ISEarth.c',
50 '../../src/ISFileManager.cpp',
51 '../../src/ISLogFile.cpp',
52 '../../src/ISLogger.cpp',
53 '../../src/ISMatrix.c',
55 '../../src/ISSerialPort.cpp',
56 '../../src/ISStream.cpp',
57 '../../src/ISTcpClient.cpp',
58 '../../src/ISTcpServer.cpp',
59 '../../src/ISUtilities.cpp',
60 '../../src/linked_list.c',
61 '../../src/serialPort.c',
62 '../../src/serialPortPlatform.c',
63 '../../src/time_conversion.c',
64 '../../src/tinystr.cpp',
65 '../../src/tinyxml.cpp',
66 '../../src/tinyxmlerror.cpp',
67 '../../src/tinyxmlparser.cpp'],
84 """Return a boolean indicating whether a flag name is supported on 85 the specified compiler. 88 with tempfile.NamedTemporaryFile(
'w', suffix=
'.cpp')
as f:
89 f.write(
'int main (int argc, char **argv) { return 0; }')
91 compiler.compile([f.name], extra_postargs=[flagname])
92 except setuptools.distutils.errors.CompileError:
98 """Return the -std=c++[11/14] compiler flag. 100 The c++14 is prefered over c++11 (when it is available). 102 if has_flag(compiler,
'-std=c++14'):
104 elif has_flag(compiler,
'-std=c++11'):
107 raise RuntimeError(
'Unsupported compiler -- at least C++11 support ' 112 """A custom build extension for adding compiler-specific options.""" 118 if sys.platform ==
'darwin':
119 c_opts[
'unix'] += [
'-stdlib=libc++',
'-mmacosx-version-min=10.7']
122 ct = self.compiler.compiler_type
123 opts = self.
c_opts.get(ct, [])
125 opts.append(
'-DVERSION_INFO="%s"' % self.distribution.get_version())
126 opts.append(
cpp_flag(self.compiler))
130 opts.append(
'/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version())
131 for ext
in self.extensions:
132 ext.extra_compile_args = opts
133 build_ext.build_extensions(self)
138 author=
'James Jackson',
139 author_email=
'superjax08@gmail.com',
140 description=
'pybind interface to reading InertialSense Log files',
142 ext_modules=ext_modules,
143 install_requires=[
'pybind11>=2.2',
152 cmdclass={
'build_ext': BuildExt},
def has_flag(compiler, flagname)
def __init__(self, user=False)
def build_extensions(self)