mirror of
https://github.com/nqrduck/LimeDriverBindings.git
synced 2024-09-28 00:20:39 +00:00
Enforce C++ compiler for Cython and fix Python binding
- Standardized the C++ compiler across build environments by setting it in `setup.py`, ensuring consistent compilation of Cython extensions. - Transitioned to using `setuptools.build_meta` as the build backend in `pyproject.toml` for enhanced package build processes. - Modified the extension module path in `setup.py` to align with the new Python binding structure. - Introduced Python property decorators to `PyLimeConfig` class in `limedriver.pyx` for getter methods, enhancing the Pythonic interface of the Cython module. - Facilitated direct import of the binding in `__init__.py`, streamlining the usage of the `limedriver` package.
This commit is contained in:
parent
4e279892aa
commit
1f24eb3f64
4 changed files with 10 additions and 3 deletions
|
@ -19,3 +19,5 @@ requires = [
|
|||
"wheel",
|
||||
"Cython"
|
||||
]
|
||||
|
||||
build-backend = "setuptools.build_meta"
|
5
setup.py
5
setup.py
|
@ -6,11 +6,12 @@ import os
|
|||
|
||||
from Cython.Build import cythonize
|
||||
|
||||
os.environ['CXX'] = 'h5c++'
|
||||
|
||||
class BuildExtCommand(build_ext):
|
||||
"""Custom build_ext command to ensure that the submodule is retrieved and built."""
|
||||
|
||||
def build_extensions(self):
|
||||
os.environ['CXX'] = 'h5c++'
|
||||
super().build_extensions()
|
||||
|
||||
def run(self):
|
||||
|
@ -31,7 +32,7 @@ class BuildExtCommand(build_ext):
|
|||
|
||||
ext_modules = [
|
||||
Extension(
|
||||
'limedriver',
|
||||
'limedriver.binding',
|
||||
sources=['src/limedriver/limedriver.pyx', 'extern/limedriver/src/limedriver.cpp'],
|
||||
include_dirs=["extern/limedriver/src/"],
|
||||
libraries=["LimeSuite"],
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
import limedriver.binding
|
|
@ -156,6 +156,7 @@ cdef class PyLimeConfig:
|
|||
def TX_IcorrDC(self, int value):
|
||||
self._config.TX_IcorrDC = value
|
||||
|
||||
@property
|
||||
def TX_QcorrDC(self):
|
||||
return self._config.TX_QcorrDC
|
||||
|
||||
|
@ -234,6 +235,7 @@ cdef class PyLimeConfig:
|
|||
for i in range(4):
|
||||
self._config.RX_gain_rback[i] = values[i]
|
||||
|
||||
@property
|
||||
def TX_gain_rback(self):
|
||||
return [self._config.TX_gain_rback[i] for i in range(3)]
|
||||
|
||||
|
@ -297,3 +299,4 @@ cdef class PyLimeConfig:
|
|||
@stamp_end.setter
|
||||
def stamp_end(self, value):
|
||||
self._config.stamp_end = value.encode('utf-8')
|
||||
|
||||
|
|
Loading…
Reference in a new issue