From c0c4ea543439c740e3ee848fdd055c633a47f6c5 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Wed, 20 Dec 2023 15:53:43 -0500 Subject: [PATCH 1/2] FindPython3 -> FindPython this allows to unify python discovery across the stack (instead of using a mix of PythonInterp, Python3, and Python) --- CMakeLists.txt | 2 +- src/madness/tensor/CMakeLists.txt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 169c067afc3..2e398df6dc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.11.0) +cmake_minimum_required (VERSION 3.12.0) # for FindPython if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) diff --git a/src/madness/tensor/CMakeLists.txt b/src/madness/tensor/CMakeLists.txt index 2747e619609..acc872e7b3a 100644 --- a/src/madness/tensor/CMakeLists.txt +++ b/src/madness/tensor/CMakeLists.txt @@ -1,18 +1,18 @@ # src/madness/tensor # Add targets for generated header files -find_package(Python3) -if(Python3_Interpreter_FOUND) +find_package(Python COMPONENTS Interpreter) +if(TARGET Python::Interpreter) add_custom_command( OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/tensoriter_spec.h ${CMAKE_CURRENT_SOURCE_DIR}/tensor_spec.h - COMMAND ${Python3_EXECUTABLE} tempspec.py + COMMAND ${Python_EXECUTABLE} tempspec.py MAIN_DEPENDENCY tempspec.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Generating tensoriter_spec.h and tensor_spec.h") elseif(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tensoriter_spec.h.h OR NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tensor_spec.h) - message(FATAL_ERROR "PYTHON executable is not available to generate required source files") + message(FATAL_ERROR "Python executable is not available to generate required source files") endif() # Source lists for MADtensor From 66552962aea6e8b51f1d1ce29cbf62991ead9957 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Mon, 11 Dec 2023 09:06:11 -0500 Subject: [PATCH 2/2] try to fix TBB detection issues described in https://github.com/m-a-d-n-e-s-s/madness/issues/510 --- cmake/modules/FindTBB.cmake | 51 ++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/cmake/modules/FindTBB.cmake b/cmake/modules/FindTBB.cmake index b832016b4b6..2199921f0e9 100644 --- a/cmake/modules/FindTBB.cmake +++ b/cmake/modules/FindTBB.cmake @@ -73,32 +73,6 @@ # FindTBB helper functions and macros # -# Use TBBConfig.cmake if possible. - -set(_tbb_find_quiet) -if (TBB_FIND_QUIETLY) - set(_tbb_find_quiet QUIET) -endif () -set(_tbb_find_components) -set(_tbb_find_optional_components) -foreach (_tbb_find_component IN LISTS TBB_FIND_COMPONENTS) - if (TBB_FIND_REQUIRED_${_tbb_find_component}) - list(APPEND _tbb_find_components "${_tbb_find_component}") - else () - list(APPEND _tbb_find_optional_components "${_tbb_find_component}") - endif () -endforeach () -unset(_tbb_find_component) -find_package(TBB CONFIG ${_tbb_find_quiet} - COMPONENTS ${_tbb_find_components} - OPTIONAL_COMPONENTS ${_tbb_find_optional_components}) -unset(_tbb_find_quiet) -unset(_tbb_find_components) -unset(_tbb_find_optional_components) -if (TBB_FOUND) - return () -endif () - #==================================================== # Fix the library path in case it is a linker script #==================================================== @@ -238,6 +212,31 @@ set(TBB_PREFIX_PATH ${TBBROOT} ${ENV_TBBROOT}) set(TBB_INC_SEARCH_PATH "") set(TBB_LIB_SEARCH_PATH "") +# Use TBBConfig.cmake if possible. +set(_tbb_find_quiet) +if (TBB_FIND_QUIETLY) + set(_tbb_find_quiet QUIET) +endif () +set(_tbb_find_components) +set(_tbb_find_optional_components) +foreach (_tbb_find_component IN LISTS TBB_FIND_COMPONENTS) + if (TBB_FIND_REQUIRED_${_tbb_find_component}) + list(APPEND _tbb_find_components "${_tbb_find_component}") + else () + list(APPEND _tbb_find_optional_components "${_tbb_find_component}") + endif () +endforeach () +unset(_tbb_find_component) +find_package(TBB CONFIG ${_tbb_find_quiet} + COMPONENTS ${_tbb_find_components} + OPTIONAL_COMPONENTS ${_tbb_find_optional_components} + HINTS ${TBB_PREFIX_PATH}) +unset(_tbb_find_quiet) +unset(_tbb_find_components) +unset(_tbb_find_optional_components) +if (TBB_FOUND) + return () +endif () # If user built from sources set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX})