Skip to content

Build system modernization#210

Open
zayenz wants to merge 53 commits into
release/6.3.0from
build-modernization
Open

Build system modernization#210
zayenz wants to merge 53 commits into
release/6.3.0from
build-modernization

Conversation

@zayenz

@zayenz zayenz commented Feb 20, 2026

Copy link
Copy Markdown
Member

This PR prepares Gecode 6.4.0 by modernizing the build and release surface while keeping the Autoconf path supported. The main shift is from a legacy, repository-local build setup to a smaller maintenance surface with first-class CMake packaging and current CI coverage.

In broad terms, it:

  • removes obsolete contrib and Travis-era maintenance paths;
  • makes CMake the package/export path for downstream consumers, with component targets and install smoke tests;
  • refreshes Autoconf and moves helper scripts from Perl to Python/uv;
  • updates dependency handling for MPFR, vcpkg, and Qt, preferring Qt 6 while retaining Qt 5.15+ support;
  • expands CI across Linux, macOS, Windows, Qt/Gist, MPFR, static/shared, and package-consumer cases.

The goal is to make 6.4.0 easier to build, package, test, and consume on current platforms without dropping existing Autoconf users.

@chatgpt-codex-connector

This comment was marked as off-topic.

@zayenz zayenz requested a review from guidotack February 20, 2026 08:44
Comment thread contribs/qecode/examples/MatrixGame.cpp
@zayenz

zayenz commented Feb 20, 2026

Copy link
Copy Markdown
Member Author

@greptile Review this please

@greptile-apps

greptile-apps Bot commented Feb 20, 2026

Copy link
Copy Markdown

Greptile Summary

This PR comprehensively modernizes Gecode's build infrastructure across CMake, autoconf, and CI/CD pipelines. The changes establish uv as the unified dependency manager for Python-based build scripts, raise CMake to version 3.21 with proper GECODE_* option namespacing, and make configure.ac the canonical autoconf source with version metadata centralized in gecode-version.m4.

Major Changes:

  • CMake modernization: Minimum version raised to 3.21, full decoupling from autoconf, new GecodeSources.cmake for source inventory, proper GECODE_* option naming with deprecation warnings for legacy aliases
  • Autoconf modernization: Updated to 2.69+, configure.ac is now canonical (no longer generated), version metadata shared via gecode-version.m4, Perl dependency replaced with uv
  • Python migration: All Perl build scripts converted to Python 3.9+ with PEP 723 inline metadata for uv execution (genvarimp.py, allexamples.py, genchangelog.py, etc.)
  • CI expansion: Comprehensive test matrix covering Linux, macOS, and Windows across both build systems, including MSYS2-based autoconf testing on Windows
  • Contribs cleanup: Removed unmaintained qecode and quacode modules (13,000+ lines deleted)
  • Windows fixes: CPProfiler now compiles on Windows/MinGW with proper _WIN32 guards and conditional MSVC pragmas

The migration is well-executed with proper backward compatibility (deprecation warnings for old CMake options), comprehensive CI coverage, and detailed changelog entries. All Python scripts use modern syntax with type hints and PEP 723 metadata for reproducible uv-based execution.

Confidence Score: 5/5

  • This PR is safe to merge - comprehensive build system modernization with excellent CI coverage and proper migration path
  • The changes are well-structured with backward compatibility, comprehensive testing across platforms (Linux, macOS, Windows) and build systems (CMake, autoconf), proper deprecation warnings, detailed documentation updates, and appropriate changelog entries. The Python migrations follow best practices with PEP 723 metadata, and the Windows compilation fixes are minimal and correct.
  • No files require special attention - all changes follow consistent patterns and are properly tested

Important Files Changed

Filename Overview
.github/workflows/build.yml Added comprehensive CI matrix testing Linux, macOS, and Windows builds via CMake and autoconf, with uv dependency management
CMakeLists.txt Modernized CMake (min 3.21), decoupled from autoconf, added proper option namespacing (GECODE_*), and uv-based code generation
configure.ac Modernized to autoconf 2.69+, made canonical source (no longer generated from configure.ac.in), centralized version metadata in gecode-version.m4
gecode-version.m4 New canonical version metadata file shared by autoconf and CMake, defines version, soversion, and flatzinc version
misc/genvarimp.py Python migration of variable implementation code generator, uses PEP 723 inline script metadata for uv
gecode/search/cpprofiler/connector.hpp Fixed Windows/MinGW compilation by using standard _WIN32 guards and conditionally applying MSVC-specific pragmas
Makefile.in Replaced Perl script calls with uv-based Python execution, removed contribs support, added CPProfiler linking for Windows
README.md Updated documentation for CMake 3.21 requirement, uv dependency, and GECODE_* option naming conventions

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Build System Modernization] --> B[CMake Path]
    A --> C[Autoconf Path]
    
    B --> B1[CMakeLists.txt<br/>Min version 3.21]
    B1 --> B2[GecodeSources.cmake<br/>Decoupled source lists]
    B2 --> B3[GenerateVarImp.cmake<br/>uv-based codegen]
    
    C --> C1[configure.ac<br/>Canonical source]
    C1 --> C2[gecode-version.m4<br/>Shared metadata]
    C2 --> C3[Makefile.in<br/>uv script execution]
    
    B3 --> D[Python Scripts<br/>PEP 723 metadata]
    C3 --> D
    
    D --> D1[genvarimp.py]
    D --> D2[allexamples.py]
    D --> D3[genchangelog.py]
    D --> D4[Other utilities]
    
    A --> E[CI/CD Matrix]
    E --> E1[Linux: autoconf + CMake]
    E --> E2[macOS: autoconf + CMake]
    E --> E3[Windows: CMake + MSYS2]
    
    E1 --> F[uv dependency]
    E2 --> F
    E3 --> F
    
    A --> G[Cleanup]
    G --> G1[Remove contribs/]
    G --> G2[Remove configure.ac.in]
    G --> G3[Remove Perl scripts]
Loading

Last reviewed commit: 35fa496

@mrahn

mrahn commented Mar 19, 2026

Copy link
Copy Markdown

The branch seems to break dependency handling when custom variable implementations are used.

When I run (what used to work in the past):

> CFLAGS="-fPIC" CXXFLAGS="-std=c++11 -fPIC -DGECODE_MEMORY_ALIGNMENT=16" ./configure --with-vis=CUSTOM_VIS --disable-cpprofiler --disable-examples --disable-flatzinc --disable-float-vars --disable-gist --disable-qt
> make -j$(nproc)

I run into errors of the kind

gecode/kernel/core.hpp:1868:28: error: ‘AllVarConf’ has not been declared
 1868 |         VarImpBase* vars_u[AllVarConf::idx_c];
gecode/kernel/core.hpp:4311:24: error: ‘struct Gecode::Space::<unnamed union>::<unnamed>’ has no member named ‘vars_u’
 4311 |       reg = &home.pc.c.vars_u[idx_c];

As a workaround I replace the make -j$(nproc) by

> make mkcompiledirs
> make gecode/kernel/var-type.hpp gecode/kernel/var-imp.hpp
> make -j$(nproc)

and that works okay.

zayenz added 26 commits May 27, 2026 08:00
Composite cutoff generators delete owned Cutoff instances through the polymorphic base type. Those destructor calls cannot be forcibly inlined in the general case, even though the definitions live in the header.

Use ordinary inline for the header-defined composite destructors while leaving forceinline on the small non-polymorphic cutoff helpers.
Fix the reviewed CMake and Autoconf build edge cases: derive FlatZinc wrapper and MiniZinc solver paths from the configured install layout, keep Qt Core package tracking separate from the Gist GUI probe, reject var-imp regeneration without inputs, and move GECODE_NO_AUTOLINK from the installed public config header to exported CMake targets.

Also make MSYS/MinGW Autoconf hosts use compiler discovery instead of defaulting to cl, add the new m4 inputs to configure regeneration, clarify the uv/Python and Qt dependency docs, and hide Windows build presets on non-Windows hosts.
Include documented example .cpp files in the Doxygen input again while excluding implementation .cpp files from the library, tests, and FlatZinc tool sources.

Remove stale example \relates commands that Doxygen 1.17 reports as duplicate relation commands, and keep long helper input lists out of the CMake command line by passing an input-list file to the Python generators.
Raise the uv script metadata from Python 3.9 to Python 3.11 across the remaining maintenance helpers.

Also align the plain-text ChangeLog generator with the Doxygen generator so float, graph, and driver entries are not dropped.
Track successful WSAStartup calls and balance them with WSACleanup on failed connects and disconnects.

Initialize the socket descriptor, avoid closing invalid descriptors, and release addrinfo on connection failure.
Bump shared release metadata to 6.4.0 and refresh the generated configure script.

Update the autoconf Qt probe to require Qt 5.15 or newer and find moc from modern Qt install layouts.
Add AUTO/ON/OFF Qt and Gist modes, enforce the supported Qt baseline, and select a complete Qt stack for Gist.

Tighten exported MPFR/Qt dependencies, static Gist headers, generated MiniZinc solver flags, and configured script permissions.
Remove the stale Travis configuration and add GitHub Actions smoke coverage for package consumers, Qt 5/6 Gist exports, old Qt rejection, and solver metadata.
Clean up trailing whitespace in examples, FlatZinc sources, generated parser output, and nearby headers without changing behavior.
Strengthen the CMake consumer smoke test to require GECODE_HAS_MPFR, MPFR::MPFR, and an MPFR-backed float link from the installed package.
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.

3 participants