Skip to content

Repository files navigation

Gecode - Generic Constraint Development Environment

Gecode

Gecode is an open source C++ toolkit for developing constraint-based systems and applications. Gecode provides a constraint solver with state-of-the-art performance while being modular and extensible.

CI

Getting All the Info You Need...

You can find lots of information on Gecode's webpages, including how to download, compile, install, and use it.

In particular, Gecode comes with extensive tutorial and reference documentation.

CMake Build Options

CMake exposes options aligned with the Autoconf build switches. The minimum required CMake version is 3.21. configure.ac is the canonical autoconf source, and configure is generated from it. Version metadata shared by autoconf and CMake lives in gecode-version.m4. build/ is reserved for generated build outputs.

Autoconf switchCMake option / mechanismStatusNotes
--enable-sharedGECODE_BUILD_SHAREDSupported directlyDefault ON
--enable-staticGECODE_BUILD_STATICSupported directlyDefault OFF
--enable-threadGECODE_ENABLE_THREADSupported directlyDefault ON
--enable-osx-unfair-mutexGECODE_ENABLE_OSX_UNFAIR_MUTEXSupported directlyDefault ON
--enable-qtGECODE_ENABLE_QTSupported directlyAUTO by default; Qt 6 preferred; Qt 5.15+ supported
--enable-gistGECODE_ENABLE_GISTSupported directlyAUTO by default except macOS; disabled automatically if Qt GUI support is unavailable
--enable-cpprofilerGECODE_ENABLE_CPPROFILERSupported directlyDefault ON
--enable-cbsGECODE_ENABLE_CBSSupported directlyDefault OFF
--enable-examplesGECODE_ENABLE_EXAMPLESSupported directlyDefault ON for top-level builds, OFF for subprojects
--enable-searchGECODE_ENABLE_SEARCHSupported directlyDefault ON
--enable-int-varsGECODE_ENABLE_INT_VARSSupported directlyDefault ON
--enable-set-varsGECODE_ENABLE_SET_VARSSupported directlyDefault ON
--enable-float-varsGECODE_ENABLE_FLOAT_VARSSupported directlyDefault ON
--enable-minimodelGECODE_ENABLE_MINIMODELSupported directlyDefault ON
--enable-driverGECODE_ENABLE_DRIVERSupported directlyDefault ON
--enable-flatzincGECODE_ENABLE_FLATZINCSupported directlyDefault ON
--enable-mpfrGECODE_ENABLE_MPFRSupported directlyDefault ON; uses find_package(MPFR)
--enable-allocatorGECODE_ENABLE_ALLOCATORSupported directlyDefault ON
--enable-auditGECODE_ENABLE_AUDITSupported directlyDefault OFF
NoneGECODE_ENABLE_FAULT_INJECTIONCMake-onlyTest-only, process-global failpoints in an isolated single-threaded check-fault suite; default OFF
NoneGECODE_SANITIZERCMake-onlyaddress, undefined, address-undefined, or thread; currently requires GCC/Clang-style flags
--enable-gcc-visibilityGECODE_ENABLE_GCC_VISIBILITYSupported directlyDefault ON
--with-freelist32-size-maxGECODE_FREELIST32_SIZE_MAXSupported directlyCache string
--with-freelist64-size-maxGECODE_FREELIST64_SIZE_MAXSupported directlyCache string
--with-visGECODE_WITH_VISSupported directlyComma-separated list
--with-lib-prefixGECODE_LIB_PREFIXSupported directlyPrefixes generated library basenames
--with-lib-suffixGECODE_LIB_SUFFIXSupported directlySuffixes generated library basenames
--enable-debugCMAKE_BUILD_TYPE=Debug (or multi-config Debug)Mapped to native CMake mechanismUse standard CMake build-type workflows
--enable-small-codesizeCMAKE_BUILD_TYPE=MinSizeRel or compiler size flagsMapped to native CMake mechanismUse standard size-optimized build settings
--enable-leak-debugNoneNot supported in CMakeNo CMake option enables the GECODE_HAS_MTRACE test hook
--enable-profileToolchain/CMake compile+link flagsMapped to native CMake mechanismConfigure profiling via standard compiler flags
--enable-gcovToolchain/CMake coverage flagsMapped to native CMake mechanismConfigure coverage instrumentation via compiler/linker flags
--with-mpfr-include, --with-mpfr-libCMAKE_PREFIX_PATH, MPFR_ROOT, toolchain include/link pathsMapped to native CMake mechanismUse CMake package and toolchain discovery
--with-gmp-include, --with-gmp-libToolchain include/link pathsMapped to native CMake mechanismGMP is resolved through MPFR/toolchain linkage
--with-host-osNoneNot supported in CMakeGenerator/toolchain already determine host/target platform
--with-compiler-vendorNoneNot supported in CMakeCompiler is selected through toolchain and generator
--with-sdk, --with-macosx-version-min, --with-architecturesNoneNot supported in CMakeUse native CMake/macOS toolchain settings
--enable-frameworkNoneNot supported in CMakeNo framework-bundle generator path is implemented
--enable-resourceNoneNot supported in CMakeNo autoconf-style resource toggle in CMake
--enable-peakheapNoneNot supported in CMakeNo CMake option defines the peak-heap tracking macros
--enable-doc-dot, --enable-doc-search, --enable-doc-tagfileGECODE_DOC_DOT, GECODE_DOC_SEARCH, GECODE_DOC_TAGFILESupported by doc targetRequires Doxygen 1.17.0 or newer; helper pages require uv

By default, CMake uses checked-in gecode/kernel/var-type.hpp and gecode/kernel/var-imp.hpp; regeneration is opt-in via -DGECODE_REGENERATE_VARIMP=ON. A nonempty GECODE_WITH_VIS list enables regeneration automatically and validates every specification during configuration; relative paths are resolved from the source directory. Build-time script execution uses uv run --script ... and requires Python 3.11 or newer. Autoconf builds require uv on PATH; CMake requires it only for generated-script paths such as -DGECODE_REGENERATE_VARIMP=ON and the doc target. Documentation generation requires Doxygen 1.17.0 or newer.

Autoconf make check deliberately does not build or run the CMake-only failpoint sources. Its ordinary test executable therefore never mixes process-global fault cases into the multi-threaded check run.

When changing generated-source inputs, run make regenerate after configuring the project. This uses the same version-checked workflow as CI and caches the Autoconf 2.72 bootstrap locally; Bison 3.8.2, Flex 2.6.4, and uv must be available. Ordinary C++ changes do not require regeneration.

GECODE_ENABLE_QT and GECODE_ENABLE_GIST accept AUTO, ON, and OFF. Use ON to require the dependency and fail configuration if it is missing or too old, OFF to disable it, and AUTO to use it when the local toolchain provides a supported Qt.

Deprecated compatibility aliases are accepted for the Gecode 6.x line: ENABLE_THREADS, ENABLE_GIST, BUILD_EXAMPLES, ENABLE_CPPROFILER.

For a Visual Studio + vcpkg workflow (including preset-based commands for MPFR), see docs/cmake-build.md.

Qt 6 is the preferred Qt line for Gecode builds. Qt 5.15 or newer remains supported for legacy environments, but older Qt releases are ignored unless GECODE_ENABLE_QT=ON, in which case configuration fails. On macOS, use a Qt build that supports the active macOS SDK; recent Qt 6 releases are the safest choice. Gist is opt-in for CMake builds on macOS. Use -DGECODE_ENABLE_GIST=ON when Qt is installed and its framework link interface is usable.

CMake Package Consumption

For CMake build/install workflows and downstream find_package(Gecode) usage, see docs/cmake-build.md.

Minimal downstream example:

find_package(GecodeCONFIGREQUIRED)
target_link_libraries(my_targetPRIVATEGecode::gecode)

Use Gecode_VERSION from package config for version checks.

Download Gecode

Gecode 6.4.0 is distributed as source code. Source archives can be downloaded from GitHub or Gecode's webpages.

Contributing to Gecode

We happily accept smaller contributions and fixes, please provide them as pull requests against the main branch. For larger contributions, please get in touch.

Gecode License

Gecode is licensed under the MIT license.

Releases

Packages

Used by

Contributors

Languages