Skip to content

Commit

Permalink
Merge pull request #511 from m-a-d-n-e-s-s/evaleev/feature/switch-to-…
Browse files Browse the repository at this point in the history
…findpython

FindPython3 -> FindPython
  • Loading branch information
evaleev authored Dec 21, 2023
2 parents d108709 + 6655296 commit cc464a8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 31 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
51 changes: 25 additions & 26 deletions cmake/modules/FindTBB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
#====================================================
Expand Down Expand Up @@ -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})
Expand Down
8 changes: 4 additions & 4 deletions src/madness/tensor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit cc464a8

Please sign in to comment.