Skip to content

dev/modernize cmake#2

Open
predat wants to merge 112 commits intoav_developfrom
dev/modernizeCmake
Open

dev/modernize cmake#2
predat wants to merge 112 commits intoav_developfrom
dev/modernizeCmake

Conversation

@predat
Copy link
Copy Markdown

@predat predat commented Mar 18, 2026

Summary

Modernize the CoinUtils CMake build system to align with current best
practices and with the lemon refactoring done in the same effort.

Changes

CMake

  • Bump cmake_minimum_required to 3.31
  • Switch C++ standard from C++14 to C++20 (EXTENSIONS OFF)
  • Add BUILD_SHARED_LIBS support — static remains the default
    (-DBUILD_SHARED_LIBS=ON to produce a .so)
  • Replace hardcoded lib/bin destinations with GNUInstallDirs
    variables (CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_BINDIR) — fixes
    incorrect install paths on Rocky Linux where libdir is lib64
  • Add POSITION_INDEPENDENT_CODE ON, VERSION and SOVERSION
    properties on the library target
  • Replace check_include_file with check_include_file_cxx for
    consistency with a C++ project

Packaging / find_package()

  • Switch to configure_package_config_file with PATH_VARS to produce
    a relocatable package (install prefix was previously baked in at
    configure time)
  • Generate CoinUtilsConfigVersion.cmake via
    write_basic_package_version_file (SameMajorVersion compatibility)
  • Export CoinUtilsTargets.cmake via install(EXPORT ...) — encodes
    the actual library type (STATIC/SHARED) instead of reconstructing the
    path manually in Config.cmake.in
  • Update Config.cmake.in to consume CoinUtilsTargets.cmake and
    expose set_and_check-validated paths

Interoperability

  • Add add_library(Coin::CoinUtils ALIAS CoinUtils) so consumers can
    use target_link_libraries(... Coin::CoinUtils) whether CoinUtils is
    found via find_package() or pulled in via add_subdirectory() in
    the AliceVision superbuild

Testing

Verified against:

  • GCC 12.4 / Rocky Linux / CMake 3.31
  • Static build (default)
  • Shared build (-DBUILD_SHARED_LIBS=ON)
  • Standalone (cmake -S . -B build) and as subdirectory in AliceVision
    superbuild

jjhforrest and others added 30 commits September 23, 2022 12:46
- autoconf-archive 2021.02.19 -> 2022.09.03
- automake 1.16.3 -> 1.16.5
- libtool 2.4.6 -> 2.4.7
- fixes -Wunused-private-field warnings
…oin-or#203)

* Squash windows-ci for VS 2022 v17 
CoinUtils v17 solution and windows-ci

* Simplify VS2022 preprocessor defines
For Linux-ci move to ubuntu 22.04 from 18.04 and macos-12 from 10.15. For windows-ci add unit tests.
The netlib data files are not included in the coinbrew build and therefore must not be used in the automated CoinUtilsTest.cmd.
jjhforrest and others added 28 commits January 4, 2026 09:54
…es (gave up only with semi-continuous or semi-integer for now), allow to parametrize tolerances, more debugging code, remove redundant macros. Improve documentation.
* Add missing new cpp files to CoinUtilsUnitTest.vcxproj
* Add missing new cpp files to libCoinUtils.vcxproj
* Update linux-ci to move from macos-13 to macos-15-intel
Related to Issuer coin-or#256 to resolve DLL-related compiler error.
…e pairwise clique deduplication

Instead of iterating all clique elements and deduplicating via
indicator vector (O(n * sum(clique_sizes))), approximate the degree
by adding (cliqueSize - 1) per clique. This may overestimate when
nodes share multiple cliques or overlap with direct conflicts, but
degree is only used for prioritization (BronKerbosch, OddWheel,
CliqueExtender). Capped at size_-1 to avoid exceeding node count.
The static int counter1 in CoinFactorization2.cpp is incremented and read
by multiple threads concurrently when CBC runs with -threads N.  Convert
it to std::atomic<int> so that concurrent access is race-free.  All
existing printf sites cast to (int) for format compatibility.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
FLUSH_PRINT_BUFFER was never defined anywhere in the build, so fflush
was never called and log messages could be delayed in file output due
to C library full buffering. Define it to 1 unconditionally.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Check elapsed time every 128 iterations in searchOddWheels() outer loop.
Initialize maxSeconds_=0.0 (disabled by default).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
prepareGraph() builds a bipartite conflict arc structure in O(icaCount_²),
which could dominate the total separation time (e.g. 896s/call on
chromaticindex512-7 with 0 cuts found).  Previously the time limit was only
checked AFTER prepareGraph() returned.

Changes:
- prepareGraph() now accepts startTime and returns bool (false = aborted)
- Time checked every 64 outer iterations inside the O(n²) arc-build loop
- searchOddWheels() computes startTime before prepareGraph() call and
  returns immediately if prepareGraph() aborts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- lengthMessages_ cannot be negative at this point
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.

9 participants