Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bdaced5
Use pybind11 to replace boost.python
CalaW Apr 13, 2025
f683608
Simplify ocl_dropcutter.
CalaW Apr 13, 2025
dded9f1
fix pip .so installation
CalaW Apr 14, 2025
51c42fd
Cleanup ocl_geometry python binding
CalaW Apr 15, 2025
98862f6
Fix macos test, default to arm64 if not specified in install.sh args.
CalaW Apr 15, 2025
362969a
cleanup install script, remove boost-python
CalaW Apr 15, 2025
21022dc
Cleanup ocl_algo python binding
CalaW Apr 18, 2025
646ca4e
fix dropcutter get cl points
CalaW Apr 18, 2025
9125966
Point inherit in python
CalaW Apr 18, 2025
c8530dc
add stub file, reorder python export to avoid c++ type in docstrings …
CalaW Apr 19, 2025
0171aca
Revert "Add Boost.Python patch for Python 3.11 support"
CalaW Apr 19, 2025
a126700
fix scikit-build
CalaW Jul 15, 2026
2171fad
Add py::keep_alive so we can do `waterline.setCutter(ocl.CylCutter())…
CalaW Jul 31, 2026
bc11c1d
remove usage of to_array so pythonlib can use c++14
CalaW Jul 31, 2026
6850a6c
fix: correct syntax in str() override for MillingCutter_py
CalaW Aug 1, 2026
1d37ecd
Remove incomplete Python cutter override support
CalaW Aug 2, 2026
51ae05f
Create venv for Python
vespakoen Jul 18, 2026
871983e
Install script and nodejs lib fixes
vespakoen Jul 18, 2026
67fd0c0
install script: better support for Python venv and fix Docker argumen…
CalaW Jul 28, 2026
3f87e9e
fix(install): use the active Python environment
CalaW Aug 2, 2026
e468628
change macos libomp bottle tag to sequoia
CalaW Aug 2, 2026
40bf8fd
workflow manual run
CalaW Aug 2, 2026
c645bba
fix(install): update Homebrew libomp fetching for macOS architecture
CalaW Aug 2, 2026
30ba5e1
use sequoia instead of tahoe
CalaW Aug 2, 2026
9c4c317
update readme
CalaW Aug 5, 2026
e6808d3
refine binding
CalaW Aug 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions .github/patches/boost-python-3.11.patch

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
release:
types:
- published
workflow_dispatch:

jobs:
cxx:
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- develop
tags:
- v*
workflow_dispatch:

jobs:
cxx:
Expand Down Expand Up @@ -38,6 +39,10 @@ jobs:
if [ "${{ matrix.os_short }}" == "linux" ]; then
export OCL_SUDO_INSTALL="1"
fi
if [ "${{ matrix.os_short }}" == "macos" ]; then
export OCL_SUDO_INSTALL="1"
export OCL_MACOS_ARCHITECTURE="$(arch)"
fi
./install.sh \
--install-ci-deps \
--build-library cxx \
Expand All @@ -57,13 +62,10 @@ jobs:
include:
- os: "windows-2022"
os_short: "windows"
libdir: windows-nodejs-x64
- os: "macos-15"
os_short: "macos"
libdir: macos-nodejs-x64
- os: "ubuntu-22.04"
os_short: "linux"
libdir: linux-nodejs-x64
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -74,15 +76,17 @@ jobs:
if [ "${{ matrix.os_short }}" == "linux" ]; then
export OCL_SUDO_INSTALL="1"
fi
if [ "${{ matrix.os_short }}" == "macos" ]; then
export OCL_MACOS_ARCHITECTURE="$(arch)"
fi
./install.sh \
--install-ci-deps \
--build-library nodejs \
--build-type release \
--node-architecture x64 \
--node-architecture $(node -p "require('os').arch()") \
--install-boost \
--boost-prefix $(pwd) \
--install \
--install-prefix $(pwd)/src/npmpackage/build/Release/${{ matrix.libdir }} \
--test
python:
name: ${{ matrix.os_short }} python
Expand All @@ -95,27 +99,24 @@ jobs:
include:
- os: "windows-2022"
os_short: "windows"
python_version: "3.10"
- os: "macos-15"
os_short: "macos"
python_version: "3.11"
cmake_generator: "Unix Makefiles"
- os: "ubuntu-22.04"
os_short: "linux"
python_version: "3.10"
cmake_generator: "Unix Makefiles"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
python-version: "3.13"
- name: Install
shell: bash
run: |
if [ "${{ matrix.os_short }}" == "linux" ]; then
export OCL_INSTALL_BOOST="1"
export OCL_BOOST_WITH_PYTHON="1"
export OCL_BOOST_PREFIX="$(pwd)"
else
export OCL_INSTALL_BOOST_FROM_REPO="1"
Expand Down
58 changes: 18 additions & 40 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ OpenCAMLib provides pre-compiled C++, Node.js and Python libraries for the follo
| **Linux** | x86_64 / aarch64 |
+-------------+------------------+

- The Python library is called ``opencamlib`` and is hosted on PyPi (pypi.org), precompiled libraries are available for Python v3.7 up to v3.11.
- The Python library is called ``opencamlib`` and is hosted on PyPi (pypi.org), precompiled libraries are available for Python v3.9 up to v3.14.
- The Node.js + emscripten library is called ``@opencamlib/opencamlib`` and is hosted on npm (npmjs.org), precompiled libraries are available for Node-API v3 and up.
- The C++ library is called ``libocl`` and is hosted on our Github Releases page.

Expand Down Expand Up @@ -137,13 +137,7 @@ Having trouble with a pre-compiled library? Please report it to us.
If there are no pre-compiled libraries for your platform or architecture, or want to customize or package opencamlib, this is for you.

OpenCAMLib uses functionality from a library called Boost.
For the Python library it uses an extra library called Boost.Python.

Only the Python bindings need Boost to be **compiled** (with Boost.Python).
All other libraries **DO NOT** need Boost to be compiled, in those cases, a headers only version will suffice.
So, if you are not compiling the Python libraries, simply download Boost, extract it into a folder, and tell CMake where to look for it.

Make sure to download Boost from the boost.org downloads page, if you download it from github, you have to make sure to install the git submodules **and** build the headers.
Only Boost headers are required; Boost does not need to be compiled.

We provide a ``install.sh`` script that helps with installation of dependencies and building OpenCAMLib libraries, you might want to take a look at it first.
You can run ``./install.sh --help`` to look at the available options, or inspect it's source code to find out more.
Expand All @@ -157,7 +151,10 @@ To compile OpenCAMLib, you need:
- **C++ compiler** (It should at least support C++ 14)
- **Git** (This is used for cloning the repository, and the emscripten SDK)
- **CMake** (At least version 3.15)
- **Boost** (When compiling the Python library, you have to **compile** Boost.Python for your Python version after installation)
- **Boost** headers

Building the Python bindings additionally requires Python development headers.
pybind11 is installed automatically when building the package with pip.

At this time of writing, here are the packages to install:

Expand All @@ -166,14 +163,14 @@ Ubuntu Dependencies

.. code-block:: shell

sudo apt install -y git cmake curl build-essential libboost-dev
sudo apt install -y git cmake curl build-essential libboost-dev python3-dev python3-pip

macOS Dependencies
------------------

.. code-block:: shell

brew install git cmake curl boost python@3.11 boost-python3
brew install git cmake curl boost python

Windows Dependencies
--------------------
Expand Down Expand Up @@ -272,42 +269,23 @@ Next, use cmake-js to compile the library:
Building for Python
===================

The Python library can be compiled similarly to the C++ example above, however, this time Boost.Python has to be compiled first.
Most systems have Boost.Python available as a download, but only for a specific Python version only (usually the latest Python version).
These might work if you are using Python from the same package provider, but, unfortunately, this is not a very reliable method, so compiling them yourself is usually the best option.

First, download and extract Boost:
The Python bindings use pybind11 and can be built and installed directly with pip.
From the repository root, run:

.. code-block:: shell

curl "https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.gz" --output "boost_1_80_0.tar.gz" --location
tar -zxf boost_1_80_0.tar.gz -C /tmp/boost
cd /tmp/boost/boost_1_80_0
python -m pip install .

pip creates an isolated build environment and installs scikit-build-core and pybind11 as declared build dependencies.
Boost is still required in the system.

Now we can compile it:
The package includes a ``py.typed`` marker and type information for the ``opencamlib.ocl`` extension, so Python type checkers and editors can use the bundled API signatures.
To generate the type stubs, you can use the ``pybind11-stubgen`` tool:

.. code-block:: shell

echo "using python ;" > ./user-config.jam
./bootstrap.sh
./b2 \
-a \
threading="multi" \
-j4 \
variant="release" \
link="static" \
address-model="64" \
architecture="x86" \
--layout="system" \
--with-python \
--user-config="./user-config.jam" \
cxxflags="-fPIC" \
stage

Note that you can customize the user-config.jam file to point it to your Python installation
(see: https://www.boost.org/doc/libs/1_78_0/libs/python/doc/html/building/configuring_boost_build.html).
You should also specify the correct architecture and address-model.
On windows, make sure to use windows style paths, e.g. ``C:\\path\\to\\Python``
python -m pip install pybind11-stubgen
pybind11-stubgen opencamlib -o src/pythonlib/

*****
Usage
Expand Down
Loading