From 4875c315139d11fa6aa1ca4f3527369fce99a294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Fri, 17 Apr 2026 15:50:49 +0200 Subject: [PATCH] bumped pybind version, cmake fixes (#300) - Bumped pybind11 version - Bumped libfmt version - Patch Minuit to avoid messing around with CMake policy --- CMakeLists.txt | 13 +++++++------ conda-recipe/meta.yaml | 2 +- patches/minuit2.patch | 39 +++++++++++++++++++++++++++++++++++++++ python/CMakeLists.txt | 4 ++-- 4 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 patches/minuit2.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index 69d6f18..9d81e92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,10 +150,15 @@ else() endif() if(AARE_FETCH_MINUIT2) + # Patch minuit2 to avoid messing with cmake policies + set(MINUIT2_PATCH_COMMAND git apply + ${CMAKE_CURRENT_SOURCE_DIR}/patches/minuit2.patch) FetchContent_Declare( Minuit2 GIT_REPOSITORY https://github.com/GooFit/Minuit2.git - GIT_TAG master) + GIT_TAG master + PATCH_COMMAND ${MINUIT2_PATCH_COMMAND} + UPDATE_DISCONNECTED 1) # Disable Minuit2 extras we don't need set(minuit2_mpi OFF @@ -164,11 +169,7 @@ if(AARE_FETCH_MINUIT2) set(BUILD_TESTING OFF CACHE BOOL "") - set(CMAKE_POLICY_VERSION_MINIMUM - 3.5 - CACHE STRING "Allow older CMake compat for Minuit2") FetchContent_MakeAvailable(Minuit2) - unset(CMAKE_POLICY_VERSION_MINIMUM CACHE) set_property(TARGET Minuit2Math PROPERTY POSITION_INDEPENDENT_CODE ON) set_property(TARGET Minuit2 PROPERTY POSITION_INDEPENDENT_CODE ON) else() @@ -231,7 +232,7 @@ if(AARE_FETCH_FMT) FetchContent_Declare( fmt GIT_REPOSITORY https://github.com/fmtlib/fmt.git - GIT_TAG 10.2.1 + GIT_TAG 12.1.0 GIT_PROGRESS TRUE USES_TERMINAL_DOWNLOAD TRUE) set(FMT_INSTALL diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 9843ce7..66fbe2e 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -27,7 +27,7 @@ requirements: - pip - numpy >=2.1 - scikit-build-core - - pybind11 >=2.13.0 + - pybind11 >=3.0.3 - matplotlib # needed in host to solve the environment for run run: diff --git a/patches/minuit2.patch b/patches/minuit2.patch new file mode 100644 index 0000000..b2752bf --- /dev/null +++ b/patches/minuit2.patch @@ -0,0 +1,39 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4e72289..33dd58a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,7 +4,7 @@ + # For the licensing terms see $ROOTSYS/LICENSE. + # For the list of contributors see $ROOTSYS/README/CREDITS. + +-cmake_minimum_required(VERSION 3.1) ++cmake_minimum_required(VERSION 3.15) + + if(NOT CMAKE_PROJECT_NAME STREQUAL ROOT) + project(Minuit2 LANGUAGES CXX) +diff --git a/StandAlone.cmake b/StandAlone.cmake +index 0a662ba..b7a05ca 100644 +--- a/StandAlone.cmake ++++ b/StandAlone.cmake +@@ -1,12 +1,12 @@ +-cmake_minimum_required(VERSION 3.1) +- +-# Tested with and supporting policies up to the following CMake version. +-# Not using ... syntax due to parser bug in MSVC's built-in CMake server mode. +-if(${CMAKE_VERSION} VERSION_LESS 3.12) +- cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) +-else() +- cmake_policy(VERSION 3.12) +-endif() ++cmake_minimum_required(VERSION 3.15) ++ ++# # Tested with and supporting policies up to the following CMake version. ++# # Not using ... syntax due to parser bug in MSVC's built-in CMake server mode. ++# if(${CMAKE_VERSION} VERSION_LESS 3.12) ++# cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) ++# else() ++# cmake_policy(VERSION 3.12) ++# endif() + + include(FeatureSummary) + include(CMakeDependentOption) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index f71b18f..6d3ff60 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -11,10 +11,10 @@ if(AARE_FETCH_PYBIND11) FetchContent_Declare( pybind11 GIT_REPOSITORY https://github.com/pybind/pybind11 - GIT_TAG v2.13.6) + GIT_TAG v3.0.3) FetchContent_MakeAvailable(pybind11) else() - find_package(pybind11 2.13 REQUIRED) + find_package(pybind11 3.0.3 REQUIRED) endif() # Add the compiled python extension