Skip to content

cmake: modernize CMake infrastructure; adds modules, bindings; build Windows wheels#21

Merged
arahlin merged 29 commits intoketiltrout:masterfrom
gsmecher:python-cmake
Feb 6, 2026
Merged

cmake: modernize CMake infrastructure; adds modules, bindings; build Windows wheels#21
arahlin merged 29 commits intoketiltrout:masterfrom
gsmecher:python-cmake

Conversation

@gsmecher
Copy link
Contributor

This PR builds on the previous one (#20), so while it's a big change, it's not as sprawling as it seems.

My primary motivation is getting Windows wheels built for pygetdata. This created a fair cascade of tasks because:

  • autotools only works on UNIX-like environments (including MSYS2/cygwin), but
  • on Windows, native Python .pyd modules are really only supported using MSVC
  • If we do that, the MacOS and Linux wheel builders should come along for the ride.

Practically speaking, native Windows support needs CMake instead of autotools, and switching the MacOS/Linux wheel builders at the same time makes sense. The autotools flow remains in place (and the github regression tests still pass against it.)

This PR contains a mix of "omnibus commits" (an incremental modernization of the CMake infrastructure does not make sense) and "drive-by commits" for individual bug fixes or improvements.

Note that we have definitely left Python 2.x behind (Numpy 2.x never supported it anyways).

@gsmecher
Copy link
Contributor Author

@ketiltrout and @arahlin, sorry to drop this on you before the holidays. This is a follow-up to #20 (and includes both series of commits).

@gsmecher gsmecher force-pushed the python-cmake branch 4 times, most recently from 667f835 to ccccf8e Compare December 17, 2025 20:28
… iterating

Without this poison, the following tests segfault:

	1426 - test_trunc (SEGFAULT)
	1427 - test_trunc_dir (SEGFAULT)
	1429 - test_trunc_truncsub (SEGFAULT)
…arch()

This has no impact on the current codebase, but in a future commit we'll
be adding Windows support (which means backslashes, which need to be
escaped.)
@gsmecher gsmecher force-pushed the python-cmake branch 12 times, most recently from 5f66b02 to f7099e1 Compare December 18, 2025 23:14
…n warnings

Since cmake on Windows unconditionally defines GD_C89_API, Windows
otherwise gives us warnings like:

\path\to\alter_crecip89.c(22,9): warning C4005: 'GD_C89_API': macro redefinition
This works within GCC but not within MSVC, and the c++ preprocessor
documentation (see 16.3.4 in N4594) seems to disavow this behaviour.
Now that CMake generates gd_config.h (consistent with the automake
flow), this macro was redundant and can be safely removed.
Squashes the warning:

	Warning: cibuildwheel: Invalid skip selector: 'cp36*'.
	cibuildwheel 3.x no longer supports Python < 3.8. Please use the
	2.x series or update `skip`. This selector will have no effect.

	Warning: cibuildwheel: Invalid skip selector: 'cp37*'.
	cibuildwheel 3.x no longer supports Python < 3.8. Please use the
	2.x series or update `skip`. This selector will have no effect.
This is a little clunky but reduces the number of redundant places where
the version numbering must be updated.
The DocStrings for the Python bindings report:

	encoding_support(encoding)

	The 'encoding' parameter should be one of the pygetdata.*_ENCODED
	symbols.  This method will return pygetdata.RDWR if the library can
	read and write the encoding, pygetdata.RDONLY if the library can
	only read the encoding, or None otherwise.  See
	gd_encoding_support(3).

However, the code returned None on GD_RDONLY==0 and the integer value of
the gd_encoding_support return code otherwise (typically GD_RDWR,
GD_E_UNKNOWN_ENCODING, or GD_E_UNSUPPORTED).
@gsmecher gsmecher force-pushed the python-cmake branch 7 times, most recently from fc4334e to bfe73d2 Compare February 6, 2026 18:14
The static link, in particular, is intended to sidestep upstream issues
that still seem unsettled:

	pypa/auditwheel#340
	aestream/aestream#112
@gsmecher gsmecher mentioned this pull request Feb 6, 2026
Copy link
Collaborator

@arahlin arahlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, I'm happy with how this is integrated while leaving the autotools build intact. Thanks for all the hard work!

@arahlin arahlin merged commit 472c2bf into ketiltrout:master Feb 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants