Skip to content

Windows: build with pybind and add workflow for wheels#392

Draft
leonardocarreras wants to merge 12 commits intomasterfrom
ci-add-windows-build
Draft

Windows: build with pybind and add workflow for wheels#392
leonardocarreras wants to merge 12 commits intomasterfrom
ci-add-windows-build

Conversation

@leonardocarreras
Copy link
Copy Markdown
Contributor

@leonardocarreras leonardocarreras commented May 9, 2025

This is an initial test to build windows wheels, following the idea in #368

This PR does:

  • Create a Pybind compilation test for windows
  • Create a CI workflow to publish python c313 artifacts for windows

Additionally, to make this possible:

  • Fixes some of the bindings due to sonarcloud errors
  • Changes CMakefiles to allow the multi-platform (and multi-compiler) use in the cmake dependencies
  • Fixes some missing destructors

@leonardocarreras leonardocarreras force-pushed the ci-add-windows-build branch 2 times, most recently from 9b4ce6a to bbbc721 Compare May 9, 2025 21:41
Signed-off-by: Leonardo Carreras <leonardo.carreras@eonerc.rwth-aachen.de>
Signed-off-by: Leonardo Carreras <leonardo.carreras@eonerc.rwth-aachen.de>
Signed-off-by: Leonardo Carreras <leonardo.carreras@eonerc.rwth-aachen.de>
Signed-off-by: Leonardo Carreras <leonardo.carreras@eonerc.rwth-aachen.de>
Signed-off-by: Leonardo Carreras <leonardo.carreras@eonerc.rwth-aachen.de>
Signed-off-by: Leonardo Carreras <leonardo.carreras@eonerc.rwth-aachen.de>
Signed-off-by: Leonardo Carreras <leonardo.carreras@eonerc.rwth-aachen.de>
Signed-off-by: Leonardo Carreras <leonardo.carreras@eonerc.rwth-aachen.de>
Signed-off-by: Leonardo Carreras <leonardo.carreras@eonerc.rwth-aachen.de>
Signed-off-by: Leonardo Carreras <leonardo.carreras@eonerc.rwth-aachen.de>
@leonardocarreras leonardocarreras linked an issue May 10, 2025 that may be closed by this pull request
@leonardocarreras leonardocarreras changed the title Build of windows wheels Windows: build with pybind and add workflow for wheels May 10, 2025
Signed-off-by: Leonardo Carreras <leonardo.carreras@eonerc.rwth-aachen.de>
Signed-off-by: Leonardo Carreras <leonardo.carreras@eonerc.rwth-aachen.de>
@sonarqubecloud
Copy link
Copy Markdown

@leonardocarreras leonardocarreras marked this pull request as ready for review May 10, 2025 12:59
@stv0g
Copy link
Copy Markdown
Contributor

stv0g commented May 11, 2025

Hi @leonardocarreras,

Thanks for this great initiative :)

Is there a motivation why you dont you cibuildwheel as we already use it for the Linux wheels:

uses: pypa/cibuildwheel@v2.23.2

I am strong for using it, as this will limit our maintenance burden in the long run as cibuildwheel is an officil project of the Python Packaging Authority (PyPA).

Also, it would allow us to build Wheels for more platforms like MacOS and automatically for more Python versions & interpreters.

@stv0g
Copy link
Copy Markdown
Contributor

stv0g commented May 11, 2025

Ideally, we use the existing GitHub actions workflow and extend it with a build matrix for more platforms.

@leonardocarreras
Copy link
Copy Markdown
Contributor Author

Hi @stv0g

Maybe there are two different things in this PR, they can be split if needed. One is just about being able to compile in Windows with pybind, which is now possible after some changes.

The other is the cibuildwheel, that I actually did it in a new file

- name: Build wheel
uses: pypa/cibuildwheel@v2.23.2
env:
CIBW_BUILD: "${{ matrix.python }}-*"
CIBW_ARCHS: "${{ matrix.cibw_arch }}"
CIBW_BEFORE_BUILD: "pip install pybind11[global]"
CIBW_ENVIRONMENT: >
CMAKE_ARGS="-DWITH_PYBIND=ON -DCMAKE_VERBOSE_MAKEFILE=ON"
CMAKE_BUILD_PARALLEL_LEVEL=4

I did not know exactly how to join the linux and windows ones together (the way to create the matrix is a bit more convoluted), probably something like this is needed
https://github.com/matplotlib/matplotlib/blob/main/.github/workflows/cibuildwheel.yml

@leonardocarreras
Copy link
Copy Markdown
Contributor Author

Lets say that I can try to find some more time (or some more help) to make it cleaner in the next weeks, but for the moment the good news is that it works on windows (I tested locally with VS2022 too).

@leonardocarreras leonardocarreras marked this pull request as draft May 11, 2025 22:10
@stv0g
Copy link
Copy Markdown
Contributor

stv0g commented May 12, 2025

Hi @leonardocarreras,

Sorry I missed the CI build wheel part. I will have another and closer look.

@leonardocarreras leonardocarreras moved this to In Progress in DPsim May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Start building wheels for Windows

2 participants