add check for Python version. Require minimum of Python 3.6 (Sphinx requires 3.8)
This commit is contained in:
@ -225,6 +225,12 @@ if(DEFINED ENV{VIRTUAL_ENV} AND NOT Python_EXECUTABLE)
|
|||||||
" Setting Python interpreter to: ${Python_EXECUTABLE}")
|
" Setting Python interpreter to: ${Python_EXECUTABLE}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
find_package(Python COMPONENTS Interpreter QUIET)
|
||||||
|
# NOTE: RHEL 8.0 and Ubuntu 18.04LTS ship with Python 3.6, Python 3.8 was EOL in 2024
|
||||||
|
if(Python_VERSION VERSION_LESS 3.6)
|
||||||
|
message(FATAL_ERROR "LAMMPS requires Python 3.6 or later")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(LAMMPS_MACHINE "" CACHE STRING "Suffix to append to lmp binary (WON'T enable any features automatically")
|
set(LAMMPS_MACHINE "" CACHE STRING "Suffix to append to lmp binary (WON'T enable any features automatically")
|
||||||
mark_as_advanced(LAMMPS_MACHINE)
|
mark_as_advanced(LAMMPS_MACHINE)
|
||||||
if(LAMMPS_MACHINE)
|
if(LAMMPS_MACHINE)
|
||||||
|
|||||||
@ -1,40 +1,39 @@
|
|||||||
# use default (or custom) Python executable, if version is sufficient
|
# use default (or custom) Python executable.
|
||||||
if(Python_VERSION VERSION_GREATER_EQUAL 3.6)
|
# Python version check is in main CMakeLists.txt file
|
||||||
|
if(Python_EXECUTABLE)
|
||||||
set(Python3_EXECUTABLE ${Python_EXECUTABLE})
|
set(Python3_EXECUTABLE ${Python_EXECUTABLE})
|
||||||
endif()
|
endif()
|
||||||
find_package(Python3 COMPONENTS Interpreter)
|
find_package(Python3 COMPONENTS Interpreter)
|
||||||
|
|
||||||
if(Python3_EXECUTABLE)
|
if(Python3_EXECUTABLE)
|
||||||
if(Python3_VERSION VERSION_GREATER_EQUAL 3.6)
|
add_custom_target(
|
||||||
add_custom_target(
|
check-whitespace
|
||||||
check-whitespace
|
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py .
|
||||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py .
|
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
COMMENT "Check for whitespace errors")
|
||||||
COMMENT "Check for whitespace errors")
|
add_custom_target(
|
||||||
add_custom_target(
|
check-homepage
|
||||||
check-homepage
|
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/homepage.py .
|
||||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/homepage.py .
|
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
COMMENT "Check for homepage URL errors")
|
||||||
COMMENT "Check for homepage URL errors")
|
add_custom_target(
|
||||||
add_custom_target(
|
check-permissions
|
||||||
check-permissions
|
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/permissions.py .
|
||||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/permissions.py .
|
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
COMMENT "Check for permission errors")
|
||||||
COMMENT "Check for permission errors")
|
add_custom_target(
|
||||||
add_custom_target(
|
fix-whitespace
|
||||||
fix-whitespace
|
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py -f .
|
||||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py -f .
|
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
COMMENT "Fix whitespace errors")
|
||||||
COMMENT "Fix whitespace errors")
|
add_custom_target(
|
||||||
add_custom_target(
|
fix-homepage
|
||||||
fix-homepage
|
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/homepage.py -f .
|
||||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/homepage.py -f .
|
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
COMMENT "Fix homepage URL errors")
|
||||||
COMMENT "Fix homepage URL errors")
|
add_custom_target(
|
||||||
add_custom_target(
|
fix-permissions
|
||||||
fix-permissions
|
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/permissions.py -f .
|
||||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/permissions.py -f .
|
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||||
WORKING_DIRECTORY ${LAMMPS_DIR}
|
COMMENT "Fix permission errors")
|
||||||
COMMENT "Fix permission errors")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -24,9 +24,7 @@ if(MLIAP_ENABLE_PYTHON)
|
|||||||
if(NOT PKG_PYTHON)
|
if(NOT PKG_PYTHON)
|
||||||
message(FATAL_ERROR "Must enable PYTHON package for including Python support in ML-IAP")
|
message(FATAL_ERROR "Must enable PYTHON package for including Python support in ML-IAP")
|
||||||
endif()
|
endif()
|
||||||
if(Python_VERSION VERSION_LESS 3.6)
|
# Python version check is in main CMakeLists.txt file
|
||||||
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython)
|
set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython)
|
||||||
file(GLOB MLIAP_CYTHON_SRC CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/ML-IAP/*.pyx)
|
file(GLOB MLIAP_CYTHON_SRC CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/ML-IAP/*.pyx)
|
||||||
|
|||||||
Reference in New Issue
Block a user