Skip to content

Commit 7ecbaf7

Browse files
authored
Merge branch '2github-actions' into master
2 parents d75730b + e7bdf2d commit 7ecbaf7

9 files changed

Lines changed: 175 additions & 74 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
on: push
2+
3+
jobs:
4+
build_wheels:
5+
name: Build wheels on ${{ matrix.os }}
6+
runs-on: ${{ matrix.os }}
7+
strategy:
8+
matrix:
9+
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel, macos-latest]
10+
11+
steps:
12+
- uses: actions/checkout@v6
13+
with:
14+
persist-credentials: false
15+
16+
# Used to host cibuildwheel
17+
- uses: actions/setup-python@v6
18+
19+
- name: Install cibuildwheel
20+
run: python -m pip install cibuildwheel==4.0.0
21+
22+
- name: Build wheels
23+
run: python -m cibuildwheel --output-dir wheelhouse
24+
# to supply options, put them in 'env', like:
25+
# env:
26+
# CIBW_SOME_OPTION: value
27+
# ...
28+
29+
- uses: actions/upload-artifact@v6
30+
with:
31+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
32+
path: ./wheelhouse/*.whl
33+
34+
make_sdist:
35+
name: Make SDist
36+
runs-on: ubuntu-slim
37+
steps:
38+
- uses: actions/checkout@v6
39+
with:
40+
persist-credentials: false
41+
42+
- name: Build SDist
43+
run: pipx run build --sdist
44+
45+
- uses: actions/upload-artifact@v4
46+
with:
47+
name: cibw-sdist
48+
path: dist/*.tar.gz
49+
50+
51+
upload_all:
52+
needs: [build_wheels, make_sdist]
53+
environment: pypi
54+
permissions:
55+
id-token: write
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/download-artifact@v5
59+
with:
60+
pattern: cibw-*
61+
path: dist
62+
merge-multiple: true
63+
64+
- uses: pypa/gh-action-pypi-publish@release/v1
65+
with:
66+
password: ${{ secrets.PYPI_API_TOKEN }}
67+
skip-existing: true

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
.idea
22
CMakeLists.txt.user
3-
/ndicapiExport.h
43
/build
5-
setup.py

CMakeLists.txt

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PROJECT(ndicapi)
22
CMAKE_MINIMUM_REQUIRED(VERSION 3.22.6)
33

4-
SET(ndicapi_VERSION 1.6.0)
4+
SET(ndicapi_VERSION 3.7.4)
55

66
# --------------------------------------------------------------------------
77
# Configure output paths for libraries and executables.
@@ -65,20 +65,6 @@ IF(BUILD_PYTHON)
6565
" shared library (CMake option BUILD_SHARED_LIBS)."
6666
)
6767
ENDIF()
68-
SET(SETUP_PY_FILEPATH ${CMAKE_CURRENT_SOURCE_DIR}/setup.py)
69-
CONFIGURE_FILE(
70-
${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in
71-
${SETUP_PY_FILEPATH}
72-
)
73-
MESSAGE(
74-
"Successfully generated ${SETUP_PY_FILEPATH} for the Python"
75-
" extension module. To install the Python extension module:"
76-
"\n\t0) Install the C++ library: make && make install"
77-
" (might need admin access)"
78-
"\n\t1) Go to ${CMAKE_CURRENT_SOURCE_DIR}"
79-
"\n\t2) Build and install the Python extension:"
80-
" python setup.py install (might require admin access)"
81-
)
8268
ENDIF()
8369

8470
FIND_PACKAGE(Threads)

MANIFEST.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include *.cxx
2+
include *.h
3+
include README.pypi.md
4+
include CMakeLists.txt
5+
include ndicapiConfig.cmake.in
6+
include ndicapiConfigVersion.cmake.in

README.md

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,23 @@
1+
-[![Build Status](https://github.com/scikit-surgery/ndicapi/workflows/.github/workflows/ci.yml/badge.svg)](https://github.com/scikit-surgery/ndicapi/actions)
2+
13
# History
24
* Program: NDI Combined API C Interface Library
35
* Creator: David Gobbi
46
* Language: English
5-
* Authors:
7+
* Authors:
68
* David Gobbi
79
* Andras Lasso <lassoan@queensu.ca>
810
* Adam Rankin <arankin@robarts.ca>
9-
* Version: 1.4
10-
* Date: 2005/07/01
11-
* Version: 1.5
12-
* Date: 2015/05/30
13-
* Version: 1.6
14-
* Date: 2016/03/08
11+
* Stephen Thompson <s.thompson@ucl.ac.uk>
1512

1613
# Overview
1714

1815
This package provides a portable C library that provides a straightforward interface to AURORA, POLARIS, and VEGA systems manufactured by Northern Digital Inc. This library is provided by the Plus library, and is not supported by Northern Digital Inc.
1916

20-
The contents of this package have been built successfully under a wide range of compilers. It is a [CMake](https://cmake.org/download/) project and can be configured and built as such.
17+
This fork implements continuous integration and deployment of binary Python wheels to PyPi. Otherwise it should remain identical to the upstream project.
2118

2219
## Building
23-
To build, configure first using CMake, then build according to your chosen generator.
24-
25-
### Python
26-
To build the [Python][python] extension module of this library:
27-
28-
1. Build **and** install the C++ library first.
29-
1. Then build and install the Python extension: `pip install .` (assuming the command is called in your repo clone directory)
30-
31-
[python]: http://www.python.org
32-
33-
You can test your installation by running `python -c 'import ndicapy'`
20+
Building and deployment should be handled automatically using github actions. For details see .github/workflows/ci.yml
3421

3522
## Contents
3623
The main contents of this package are as follows:
@@ -39,4 +26,11 @@ The main contents of this package are as follows:
3926

4027
2) Two C++ header files (ndicapi.h and ndicapi_math.h) that provide and interface, via libndicapi.a, to an NDI device via the NDICAPI Serial Communications API that predated the Combined API. Documentation is provided in the polaris_html directory.
4128

42-
4) A python interface to the ndicapi library. However, only the original POLARIS API is supported through python. The full ndicapi interface is not yet supported.
29+
4) A pythoninterface to the ndicapi library. However, only the original POLARIS API is supported through python. The full ndicapi interface is not yet supported.
30+
31+
## Acknowledgments
32+
33+
The implementation of continuous integration and deployment was Supported by the [Wellcome Trust](https://wellcome.ac.uk/) and the [EPSRC](https://www.epsrc.ac.uk/) as part of the [Wellcome Centre for Interventional and Surgical Sciences](http://www.ucl.ac.uk/weiss).
34+
The ndicapi library was developed as part of the [PLUS Toolkit](https://plustoolkit.github.io/).
35+
36+

README.pypi.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# History
2+
* Program: NDI Combined API C Interface Library
3+
* Creator: David Gobbi
4+
* Language: English
5+
* Authors:
6+
* David Gobbi
7+
* Andras Lasso <lassoan@queensu.ca>
8+
* Adam Rankin <arankin@robarts.ca>
9+
* Stephen Thompson <s.thompson@ucl.ac.uk>
10+
11+
# Overview
12+
These are binary python wheels of the PlusToolKits's ndicapi library (https://github.com/PlusToolkit/ndicapi).
13+
The CI scripts where developed on and hosted by (https://github.com/scikit-surgery/ndicapi).
14+
15+
This package provides provides a straightforward Python interface to AURORA, POLARIS, and VEGA systems manufactured by Northern Digital Inc. This library is provided by the Plus library, and is not supported by Northern Digital Inc.
16+
17+
## Acknowledgments
18+
19+
The implementation of continuous integration and deployment was Supported by the [Wellcome Trust](https://wellcome.ac.uk/) and the [EPSRC](https://www.epsrc.ac.uk/) as part of the [Wellcome Centre for Interventional and Surgical Sciences](http://www.ucl.ac.uk/weiss).
20+
The ndicapi library was developed as part of the [PLUS Toolkit](https://plustoolkit.github.io/).
21+
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#ifndef __ndicapiExport_h
1313
#define __ndicapiExport_h
1414

15-
#cmakedefine ndicapi_STATIC
16-
1715
#if defined(WIN32) && !defined(ndicapi_STATIC)
1816
#if defined(ndicapi_EXPORTS)
1917
#define ndicapiExport __declspec( dllexport )

setup.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import setuptools
2+
import sys
3+
import io
4+
5+
mac_indicator = 'darwin'
6+
linux_indicator = 'linux'
7+
windows_indicator = 'win'
8+
platform = sys.platform
9+
10+
long_description = io.open('README.pypi.md', encoding="utf-8").read()
11+
12+
extra_link_args = []
13+
if platform.startswith(mac_indicator):
14+
extra_link_args.append('-Wl') # pass the following options to linker
15+
16+
libraries=[]
17+
if platform.startswith(windows_indicator):
18+
libraries.append('wsock32')
19+
libraries.append('ws2_32')
20+
21+
ndicapy = setuptools.Extension('ndicapy',
22+
sources=[
23+
'ndicapi.cxx',
24+
'ndicapi_math.cxx',
25+
'ndicapi_serial.cxx',
26+
'ndicapi_thread.cxx',
27+
'ndicapi_socket.cxx',
28+
'ndicapimodule.cxx',
29+
],
30+
extra_link_args=extra_link_args,
31+
libraries=libraries,
32+
)
33+
34+
setuptools.setup(name='ndicapi',
35+
version='3.7.4',
36+
url='https://github.com/SciKit-Surgery/ndicapi',
37+
license='MIT',
38+
description='This package allows interfacing with NDI tracking devices',
39+
long_description=long_description,
40+
long_description_content_type="text/markdown",
41+
maintainer="Stephen Thompson",
42+
maintainer_email="s.thompson@ucl.ac.uk",
43+
classifiers=[
44+
'Development Status :: 3 - Alpha',
45+
'Environment :: Console',
46+
'Intended Audience :: Developers',
47+
'Intended Audience :: Education',
48+
'Intended Audience :: Information Technology',
49+
'Intended Audience :: Science/Research',
50+
'License :: OSI Approved :: MIT License',
51+
'Operating System :: MacOS',
52+
'Operating System :: Microsoft :: Windows',
53+
'Operating System :: POSIX',
54+
'Operating System :: Unix',
55+
'Programming Language :: Python :: 3.8',
56+
'Programming Language :: Python :: 3.9',
57+
'Programming Language :: Python :: 3.10',
58+
'Programming Language :: Python :: 3.11',
59+
'Programming Language :: Python :: 3.12',
60+
'Programming Language :: C',
61+
'Programming Language :: Python :: Implementation :: CPython',
62+
'Topic :: Scientific/Engineering',
63+
'Topic :: System :: Hardware',
64+
],
65+
ext_modules=[ndicapy],
66+
)

setup.py.in

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)