From 29698f42efee0a6aef33ce36e8e2d61e93be9e63 Mon Sep 17 00:00:00 2001 From: Christian Koernig <ckoernig@mail.desy.de> Date: Fri, 26 Mar 2021 14:24:36 +0100 Subject: [PATCH] Updated to SWIG 4 - added autodoc feature to swig header, enabled doxygen commenting - It seems, SWIG needs doxygen comments in header, not source. So far, autodoc is used instead to provide at least some pydoc --- README.md | 2 +- examples/simple_connection.py | 3 ++- python/amptek_hardware_interface/AmptekHardwareInterface.i | 2 +- setup.py | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f685f68..4aeebb2 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Additionally, a basic simulator interface can be used during DAQ logic developme Prerequisites ------------- - libusb1-dev - - SWIG 3 (v4 currently not supported) + - SWIG v4 - numpy - pytango (optionally, only when using the tango server) diff --git a/examples/simple_connection.py b/examples/simple_connection.py index f04106c..e2a9e7d 100644 --- a/examples/simple_connection.py +++ b/examples/simple_connection.py @@ -19,8 +19,9 @@ amptek = ahi.AmptekHardwareInterface() # To connect to a specific device, change the -1 to the serial number # For basic tests, the simulator interface can be used, of no hardware is available. # Use amptek.connectSimulator() instead -amptek.connectUSB(-1) +amptek.connectUSB(-1) +# amptek.connectSimulator() diff --git a/python/amptek_hardware_interface/AmptekHardwareInterface.i b/python/amptek_hardware_interface/AmptekHardwareInterface.i index 127f487..4101576 100644 --- a/python/amptek_hardware_interface/AmptekHardwareInterface.i +++ b/python/amptek_hardware_interface/AmptekHardwareInterface.i @@ -4,7 +4,7 @@ #define SWIG_FILE_WITH_INIT #include "AmptekHardwareInterface.h" %} - +%feature("autodoc"); %include "numpy.i" %include "std_string.i" %init %{ diff --git a/setup.py b/setup.py index 3c0d351..a8975df 100644 --- a/setup.py +++ b/setup.py @@ -15,8 +15,8 @@ except AttributeError: # HexitecIO extension module _AmptekHardwareInterface = Extension("amptek_hardware_interface._AmptekHardwareInterface", ["python/amptek_hardware_interface/AmptekHardwareInterface.i",] + ["src/" + f for f in os.listdir("src") if os.path.isfile("src/" + f)], - include_dirs = [numpy_include, "include"], - swig_opts=['-c++',"-modern", "-nomodernargs" ], + include_dirs = [numpy_include, "include", "src"], + swig_opts=['-c++',"-doxygen"], extra_compile_args = ["-std=c++11", "-g"], libraries=["usb-1.0"] ) -- GitLab