Skip to content

Support newer toolchains: C++17, CMake 4, Boost 1.92, GDAL 3.13, SWIG 4.5, Python 3.14 - #286

Open
zihaooo wants to merge 1 commit into
cyang-kth:masterfrom
zihaooo:pr/modern-toolchain
Open

Support newer toolchains: C++17, CMake 4, Boost 1.92, GDAL 3.13, SWIG 4.5, Python 3.14#286
zihaooo wants to merge 1 commit into
cyang-kth:masterfrom
zihaooo:pr/modern-toolchain

Conversation

@zihaooo

@zihaooo zihaooo commented Sep 3, 2026

Copy link
Copy Markdown

Summary

Makes fmm build with current toolchains, tested with GCC 15.3, CMake 4.4, Boost 1.92, GDAL 3.13, SWIG 4.5 and Python 3.14, while still building with the versions that work today (tested with GCC 13.3, CMake 3.28, Boost 1.74, GDAL 3.4.3, SWIG 4.0/4.2, Python 3.10). No functional change: the map matching output is identical before and after.

Today the newest usable combination is roughly Boost 1.74 / Python 3.10, because Boost.Geometry >= 1.75 requires C++14 and the Python detection relies on distutils, which was removed in Python 3.12.

Changes

CMake

  • CMAKE_CXX_STANDARD 17 (Boost.Geometry >= 1.75 needs C++14, GDAL >= 3.9 headers need C++17); cmake_minimum_required(VERSION 3.16...4.4).
  • Python detection with find_package(Python3 COMPONENTS Interpreter Development.Module); the module is installed into Python3_SITEARCH (override with -DFMM_PYTHON_INSTALL_DIR=...). This replaces FindPythonInterp/FindPythonLibs and the distutils.sysconfig call. The extension is no longer linked against libpython, as recommended for CPython extension modules.
  • GDAL, Boost and OpenMP are consumed through imported targets (GDAL::GDAL, Boost::serialization, Boost::headers, OpenMP::OpenMP_CXX), so the build also works with CMake >= 3.30 where the FindBoost module was removed in favour of BoostConfig.cmake.
  • The SWIG target uses swig_add_library + target_link_libraries and installs $<TARGET_PROPERTY:pyfmm,SWIG_SUPPORT_FILES> instead of a hard-coded path to fmm.py.
  • -O3 -DNDEBUG now come from the Release build type (the default) instead of overriding CMAKE_CXX_FLAGS, so user flags are respected. An unknown CMAKE_BUILD_TYPE falls back to Release instead of silently building without optimisation.
  • New options: FMM_NATIVE_ARCH (default OFF, adds -march=native) and FMM_SPDLOG_ACTIVE_LEVEL (default SPDLOG_LEVEL_TRACE, unchanged behaviour).

Sources

  • third_party/cxxopts/cxxopts.hpp: add #include <cstdint> (newer libstdc++ no longer includes it transitively).
  • src/network/network.cpp: OGRGeomFieldDefn::GetSpatialRef() returns const OGRSpatialReference * in GDAL 3.
  • Remove the deprecated boost/function_output_iterator.hpp include (unused).

Verification

  • Built and run with both toolchain sets listed above.
  • fmm's output for 20.7 M GPS points (two data sets) is byte-identical between the old build (GCC 13 / Boost 1.74 / GDAL 3.4.3 / Python 3.10) and the new one (GCC 15 / Boost 1.92 / GDAL 3.12 / Python 3.14), compared after sorting because the line order depends on thread scheduling.
  • Timings are unchanged by this PR alone.

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com

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.

1 participant