remove special case CMake code for versions before 3.16
This commit is contained in:
@ -22,13 +22,8 @@ endif()
|
|||||||
if(POLICY CMP0135)
|
if(POLICY CMP0135)
|
||||||
cmake_policy(SET CMP0135 OLD)
|
cmake_policy(SET CMP0135 OLD)
|
||||||
endif()
|
endif()
|
||||||
########################################
|
|
||||||
# Use CONFIGURE_DEPENDS as option for file(GLOB...) when available
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
unset(CONFIGURE_DEPENDS)
|
|
||||||
else()
|
|
||||||
set(CONFIGURE_DEPENDS CONFIGURE_DEPENDS)
|
set(CONFIGURE_DEPENDS CONFIGURE_DEPENDS)
|
||||||
endif()
|
|
||||||
########################################
|
########################################
|
||||||
|
|
||||||
project(lammps CXX)
|
project(lammps CXX)
|
||||||
@ -466,13 +461,8 @@ option(WITH_JPEG "Enable JPEG support" ${JPEG_FOUND})
|
|||||||
if(WITH_JPEG)
|
if(WITH_JPEG)
|
||||||
find_package(JPEG REQUIRED)
|
find_package(JPEG REQUIRED)
|
||||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG)
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
target_include_directories(lammps PRIVATE ${JPEG_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(lammps PRIVATE ${JPEG_LIBRARIES})
|
|
||||||
else()
|
|
||||||
target_link_libraries(lammps PRIVATE JPEG::JPEG)
|
target_link_libraries(lammps PRIVATE JPEG::JPEG)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(PNG QUIET)
|
find_package(PNG QUIET)
|
||||||
find_package(ZLIB QUIET)
|
find_package(ZLIB QUIET)
|
||||||
@ -819,20 +809,11 @@ install(
|
|||||||
# This is primarily for people that only want to use the Python wrapper.
|
# This is primarily for people that only want to use the Python wrapper.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
# adjust so we find Python 3 versions before Python 2 on old systems with old CMake
|
|
||||||
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
|
|
||||||
find_package(PythonInterp) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
# backward compatibility
|
# backward compatibility
|
||||||
if(PYTHON_EXECUTABLE)
|
if(PYTHON_EXECUTABLE)
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||||
endif()
|
endif()
|
||||||
find_package(Python COMPONENTS Interpreter)
|
find_package(Python COMPONENTS Interpreter)
|
||||||
endif()
|
|
||||||
if(BUILD_IS_MULTI_CONFIG)
|
if(BUILD_IS_MULTI_CONFIG)
|
||||||
set(MY_BUILD_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>)
|
set(MY_BUILD_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>)
|
||||||
else()
|
else()
|
||||||
@ -941,12 +922,10 @@ if(_index GREATER -1)
|
|||||||
endif()
|
endif()
|
||||||
message(STATUS "<<< Linker flags: >>>")
|
message(STATUS "<<< Linker flags: >>>")
|
||||||
message(STATUS "Executable name: ${LAMMPS_BINARY}")
|
message(STATUS "Executable name: ${LAMMPS_BINARY}")
|
||||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
|
|
||||||
get_target_property(OPTIONS lammps LINK_OPTIONS)
|
get_target_property(OPTIONS lammps LINK_OPTIONS)
|
||||||
if(OPTIONS)
|
if(OPTIONS)
|
||||||
message(STATUS "Linker options: ${OPTIONS}")
|
message(STATUS "Linker options: ${OPTIONS}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
if(CMAKE_EXE_LINKER_FLAGS)
|
if(CMAKE_EXE_LINKER_FLAGS)
|
||||||
message(STATUS "Executable linker flags: ${CMAKE_EXE_LINKER_FLAGS}")
|
message(STATUS "Executable linker flags: ${CMAKE_EXE_LINKER_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,19 +1,11 @@
|
|||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
find_package(PythonInterp 3.5 QUIET) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
set(Python3_VERSION ${PYTHON_VERSION_STRING})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
# use default (or custom) Python executable, if version is sufficient
|
# use default (or custom) Python executable, if version is sufficient
|
||||||
if(Python_VERSION VERSION_GREATER_EQUAL 3.5)
|
if(Python_VERSION VERSION_GREATER_EQUAL 3.6)
|
||||||
set(Python3_EXECUTABLE ${Python_EXECUTABLE})
|
set(Python3_EXECUTABLE ${Python_EXECUTABLE})
|
||||||
endif()
|
endif()
|
||||||
find_package(Python3 COMPONENTS Interpreter QUIET)
|
find_package(Python3 COMPONENTS Interpreter)
|
||||||
endif()
|
|
||||||
|
|
||||||
if(Python3_EXECUTABLE)
|
if(Python3_EXECUTABLE)
|
||||||
if(Python3_VERSION VERSION_GREATER_EQUAL 3.5)
|
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 .
|
||||||
|
|||||||
@ -5,10 +5,6 @@ option(BUILD_DOC "Build LAMMPS HTML documentation" OFF)
|
|||||||
|
|
||||||
if(BUILD_DOC)
|
if(BUILD_DOC)
|
||||||
# Current Sphinx versions require at least Python 3.8
|
# Current Sphinx versions require at least Python 3.8
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
find_package(PythonInterp 3.8 REQUIRED)
|
|
||||||
set(VIRTUALENV ${PYTHON_EXECUTABLE} -m venv)
|
|
||||||
else()
|
|
||||||
# use default (or custom) Python executable, if version is sufficient
|
# use default (or custom) Python executable, if version is sufficient
|
||||||
if(Python_VERSION VERSION_GREATER_EQUAL 3.8)
|
if(Python_VERSION VERSION_GREATER_EQUAL 3.8)
|
||||||
set(Python3_EXECUTABLE ${Python_EXECUTABLE})
|
set(Python3_EXECUTABLE ${Python_EXECUTABLE})
|
||||||
@ -18,12 +14,10 @@ if(BUILD_DOC)
|
|||||||
message(FATAL_ERROR "Python 3.8 and up is required to build the HTML documentation")
|
message(FATAL_ERROR "Python 3.8 and up is required to build the HTML documentation")
|
||||||
endif()
|
endif()
|
||||||
set(VIRTUALENV ${Python3_EXECUTABLE} -m venv)
|
set(VIRTUALENV ${Python3_EXECUTABLE} -m venv)
|
||||||
endif()
|
|
||||||
find_package(Doxygen 1.8.10 REQUIRED)
|
find_package(Doxygen 1.8.10 REQUIRED)
|
||||||
|
|
||||||
file(GLOB DOC_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_DOC_DIR}/src/[^.]*.rst)
|
file(GLOB DOC_SOURCES ${CONFIGURE_DEPENDS} ${LAMMPS_DOC_DIR}/src/[^.]*.rst)
|
||||||
|
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT docenv
|
OUTPUT docenv
|
||||||
COMMAND ${VIRTUALENV} docenv
|
COMMAND ${VIRTUALENV} docenv
|
||||||
|
|||||||
@ -7,15 +7,7 @@
|
|||||||
# adapted from https://github.com/cmarshall108/cython-cmake-example/blob/master/cmake/FindCython.cmake
|
# adapted from https://github.com/cmarshall108/cython-cmake-example/blob/master/cmake/FindCython.cmake
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
|
|
||||||
find_package(PythonInterp 3.6 QUIET) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
find_package(Python 3.6 COMPONENTS Interpreter QUIET)
|
find_package(Python 3.6 COMPONENTS Interpreter QUIET)
|
||||||
endif()
|
|
||||||
|
|
||||||
# Use the Cython executable that lives next to the Python executable
|
# Use the Cython executable that lives next to the Python executable
|
||||||
# if it is a local installation.
|
# if it is a local installation.
|
||||||
|
|||||||
@ -1,12 +1,7 @@
|
|||||||
set(KIM-API_MIN_VERSION 2.1.3)
|
set(KIM-API_MIN_VERSION 2.1.3)
|
||||||
find_package(CURL)
|
find_package(CURL)
|
||||||
if(CURL_FOUND)
|
if(CURL_FOUND)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
target_include_directories(lammps PRIVATE ${CURL_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(lammps PRIVATE ${CURL_LIBRARIES})
|
|
||||||
else()
|
|
||||||
target_link_libraries(lammps PRIVATE CURL::libcurl)
|
target_link_libraries(lammps PRIVATE CURL::libcurl)
|
||||||
endif()
|
|
||||||
target_compile_definitions(lammps PRIVATE -DLMP_KIM_CURL)
|
target_compile_definitions(lammps PRIVATE -DLMP_KIM_CURL)
|
||||||
set(LMP_DEBUG_CURL OFF CACHE STRING "Set libcurl verbose mode on/off. If on, it displays a lot of verbose information about its operations.")
|
set(LMP_DEBUG_CURL OFF CACHE STRING "Set libcurl verbose mode on/off. If on, it displays a lot of verbose information about its operations.")
|
||||||
mark_as_advanced(LMP_DEBUG_CURL)
|
mark_as_advanced(LMP_DEBUG_CURL)
|
||||||
|
|||||||
@ -26,30 +26,10 @@ if(DOWNLOAD_MDI)
|
|||||||
|
|
||||||
# detect if we have python development support and thus can enable python plugins
|
# detect if we have python development support and thus can enable python plugins
|
||||||
set(MDI_USE_PYTHON_PLUGINS OFF)
|
set(MDI_USE_PYTHON_PLUGINS OFF)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
if(NOT PYTHON_VERSION_STRING)
|
|
||||||
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
|
|
||||||
# search for interpreter first, so we have a consistent library
|
|
||||||
find_package(PythonInterp) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
# search for the library matching the selected interpreter
|
|
||||||
set(Python_ADDITIONAL_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
|
|
||||||
find_package(PythonLibs QUIET) # Deprecated since version 3.12
|
|
||||||
if(PYTHONLIBS_FOUND)
|
|
||||||
if(NOT (PYTHON_VERSION_STRING STREQUAL PYTHONLIBS_VERSION_STRING))
|
|
||||||
message(FATAL_ERROR "Python Library version ${PYTHONLIBS_VERSION_STRING} does not match Interpreter version ${PYTHON_VERSION_STRING}")
|
|
||||||
endif()
|
|
||||||
set(MDI_USE_PYTHON_PLUGINS ON)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
find_package(Python QUIET COMPONENTS Development)
|
find_package(Python QUIET COMPONENTS Development)
|
||||||
if(Python_Development_FOUND)
|
if(Python_Development_FOUND)
|
||||||
set(MDI_USE_PYTHON_PLUGINS ON)
|
set(MDI_USE_PYTHON_PLUGINS ON)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
# python plugins are not supported and thus must be always off on Windows
|
# python plugins are not supported and thus must be always off on Windows
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
unset(Python_Development_FOUND)
|
unset(Python_Development_FOUND)
|
||||||
@ -102,13 +82,9 @@ if(DOWNLOAD_MDI)
|
|||||||
# if compiling with python plugins we need
|
# if compiling with python plugins we need
|
||||||
# to add python libraries as dependency.
|
# to add python libraries as dependency.
|
||||||
if(MDI_USE_PYTHON_PLUGINS)
|
if(MDI_USE_PYTHON_PLUGINS)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
list(APPEND MDI_DEP_LIBS ${PYTHON_LIBRARIES})
|
|
||||||
else()
|
|
||||||
list(APPEND MDI_DEP_LIBS Python::Python)
|
list(APPEND MDI_DEP_LIBS Python::Python)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
|
||||||
# need to add support for dlopen/dlsym, except when compiling for Windows.
|
# need to add support for dlopen/dlsym, except when compiling for Windows.
|
||||||
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows"))
|
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows"))
|
||||||
list(APPEND MDI_DEP_LIBS "${CMAKE_DL_LIBS}")
|
list(APPEND MDI_DEP_LIBS "${CMAKE_DL_LIBS}")
|
||||||
|
|||||||
@ -2,12 +2,7 @@
|
|||||||
set(MLIAP_ENABLE_PYTHON_DEFAULT OFF)
|
set(MLIAP_ENABLE_PYTHON_DEFAULT OFF)
|
||||||
if(PKG_PYTHON)
|
if(PKG_PYTHON)
|
||||||
find_package(Cythonize QUIET)
|
find_package(Cythonize QUIET)
|
||||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.14)
|
|
||||||
find_package(Python COMPONENTS NumPy QUIET)
|
find_package(Python COMPONENTS NumPy QUIET)
|
||||||
else()
|
|
||||||
# assume we have NumPy
|
|
||||||
set(Python_NumPy_FOUND ON)
|
|
||||||
endif()
|
|
||||||
if(Cythonize_FOUND AND Python_NumPy_FOUND)
|
if(Cythonize_FOUND AND Python_NumPy_FOUND)
|
||||||
set(MLIAP_ENABLE_PYTHON_DEFAULT ON)
|
set(MLIAP_ENABLE_PYTHON_DEFAULT ON)
|
||||||
endif()
|
endif()
|
||||||
@ -17,21 +12,13 @@ option(MLIAP_ENABLE_PYTHON "Build ML-IAP package with Python support" ${MLIAP_EN
|
|||||||
|
|
||||||
if(MLIAP_ENABLE_PYTHON)
|
if(MLIAP_ENABLE_PYTHON)
|
||||||
find_package(Cythonize REQUIRED)
|
find_package(Cythonize REQUIRED)
|
||||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.14)
|
|
||||||
find_package(Python COMPONENTS NumPy REQUIRED)
|
find_package(Python COMPONENTS NumPy REQUIRED)
|
||||||
endif()
|
|
||||||
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(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3.6)
|
|
||||||
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
if(Python_VERSION VERSION_LESS 3.6)
|
if(Python_VERSION VERSION_LESS 3.6)
|
||||||
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
|
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
|
||||||
endif()
|
endif()
|
||||||
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)
|
||||||
|
|||||||
@ -1,21 +1,4 @@
|
|||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
if(NOT PYTHON_VERSION_STRING)
|
|
||||||
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
|
|
||||||
# search for interpreter first, so we have a consistent library
|
|
||||||
find_package(PythonInterp) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
# search for the library matching the selected interpreter
|
|
||||||
set(Python_ADDITIONAL_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
|
|
||||||
find_package(PythonLibs REQUIRED) # Deprecated since version 3.12
|
|
||||||
if(NOT (PYTHON_VERSION_STRING STREQUAL PYTHONLIBS_VERSION_STRING))
|
|
||||||
message(FATAL_ERROR "Python Library version ${PYTHONLIBS_VERSION_STRING} does not match Interpreter version ${PYTHON_VERSION_STRING}")
|
|
||||||
endif()
|
|
||||||
target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARIES})
|
|
||||||
else()
|
|
||||||
if(NOT Python_INTERPRETER)
|
if(NOT Python_INTERPRETER)
|
||||||
# backward compatibility
|
# backward compatibility
|
||||||
if(PYTHON_EXECUTABLE)
|
if(PYTHON_EXECUTABLE)
|
||||||
@ -25,5 +8,4 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
find_package(Python REQUIRED COMPONENTS Interpreter Development)
|
find_package(Python REQUIRED COMPONENTS Interpreter Development)
|
||||||
target_link_libraries(lammps PRIVATE Python::Python)
|
target_link_libraries(lammps PRIVATE Python::Python)
|
||||||
endif()
|
|
||||||
target_compile_definitions(lammps PRIVATE -DLMP_PYTHON)
|
target_compile_definitions(lammps PRIVATE -DLMP_PYTHON)
|
||||||
|
|||||||
@ -19,7 +19,7 @@ if(ENABLE_TESTING)
|
|||||||
# we need to build and link a LOT of tester executables, so it is worth checking if
|
# we need to build and link a LOT of tester executables, so it is worth checking if
|
||||||
# a faster linker is available. requires GNU or Clang compiler, newer CMake.
|
# a faster linker is available. requires GNU or Clang compiler, newer CMake.
|
||||||
# also only verified with Fedora Linux > 30 and Ubuntu 18.04 or 22.04+(Ubuntu 20.04 fails)
|
# also only verified with Fedora Linux > 30 and Ubuntu 18.04 or 22.04+(Ubuntu 20.04 fails)
|
||||||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
|
if((CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
AND ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
|
AND ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
|
||||||
if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND
|
if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND
|
||||||
((CMAKE_DISTRO_VERSION VERSION_LESS_EQUAL 18.04) OR (CMAKE_DISTRO_VERSION VERSION_GREATER_EQUAL 22.04)))
|
((CMAKE_DISTRO_VERSION VERSION_LESS_EQUAL 18.04) OR (CMAKE_DISTRO_VERSION VERSION_GREATER_EQUAL 22.04)))
|
||||||
@ -66,18 +66,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF)
|
option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF)
|
||||||
mark_as_advanced(ENABLE_COVERAGE)
|
mark_as_advanced(ENABLE_COVERAGE)
|
||||||
if(ENABLE_COVERAGE)
|
if(ENABLE_COVERAGE)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
|
||||||
if(CMAKE_CXX_FLAGS)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} --coverage")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
target_compile_options(lammps PUBLIC --coverage)
|
target_compile_options(lammps PUBLIC --coverage)
|
||||||
target_link_options(lammps PUBLIC --coverage)
|
target_link_options(lammps PUBLIC --coverage)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# add custom target for IWYU analysis
|
# add custom target for IWYU analysis
|
||||||
@ -118,16 +110,8 @@ validate_option(ENABLE_SANITIZER ENABLE_SANITIZER_VALUES)
|
|||||||
string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER)
|
string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER)
|
||||||
if(NOT ENABLE_SANITIZER STREQUAL "none")
|
if(NOT ENABLE_SANITIZER STREQUAL "none")
|
||||||
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
|
||||||
if(CMAKE_CXX_FLAGS)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
target_compile_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
target_compile_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||||
target_link_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
target_link_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
message(WARNING "ENABLE_SANITIZER option not supported by ${CMAKE_CXX_COMPILER_ID} compilers. Ignoring.")
|
message(WARNING "ENABLE_SANITIZER option not supported by ${CMAKE_CXX_COMPILER_ID} compilers. Ignoring.")
|
||||||
set(ENABLE_SANITIZER "none")
|
set(ENABLE_SANITIZER "none")
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
# distributed independent from the LAMMPS package.
|
# distributed independent from the LAMMPS package.
|
||||||
##########################################
|
##########################################
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(kimplugin VERSION 1.0 LANGUAGES CXX)
|
project(kimplugin VERSION 1.0 LANGUAGES CXX)
|
||||||
|
|
||||||
@ -30,12 +30,7 @@ target_link_libraries(kimplugin PRIVATE KIM-API::kim-api)
|
|||||||
# need libcurl
|
# need libcurl
|
||||||
find_package(CURL)
|
find_package(CURL)
|
||||||
if(CURL_FOUND)
|
if(CURL_FOUND)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
target_include_directories(kimplugin PRIVATE ${CURL_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(kimplugin PRIVATE ${CURL_LIBRARIES})
|
|
||||||
else()
|
|
||||||
target_link_libraries(kimplugin PRIVATE CURL::libcurl)
|
target_link_libraries(kimplugin PRIVATE CURL::libcurl)
|
||||||
endif()
|
|
||||||
target_compile_definitions(kimplugin PRIVATE -DLMP_KIM_CURL)
|
target_compile_definitions(kimplugin PRIVATE -DLMP_KIM_CURL)
|
||||||
set(LMP_DEBUG_CURL OFF CACHE STRING "Set libcurl verbose mode on/off. If on, it displays a lot of verbose information about its operations.")
|
set(LMP_DEBUG_CURL OFF CACHE STRING "Set libcurl verbose mode on/off. If on, it displays a lot of verbose information about its operations.")
|
||||||
mark_as_advanced(LMP_DEBUG_CURL)
|
mark_as_advanced(LMP_DEBUG_CURL)
|
||||||
|
|||||||
@ -35,12 +35,8 @@ endforeach()
|
|||||||
|
|
||||||
# must repeat handling coverage for older CMake
|
# must repeat handling coverage for older CMake
|
||||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND ENABLE_COVERAGE)
|
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND ENABLE_COVERAGE)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} --coverage")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} --coverage")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
# General tests using the LAMMPS executable itself
|
# General tests using the LAMMPS executable itself
|
||||||
|
|||||||
@ -20,16 +20,7 @@ function(extract_tags out yaml_file)
|
|||||||
set(${out} "${TAGS}" PARENT_SCOPE)
|
set(${out} "${TAGS}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
# adjust so we find Python 3 versions before Python 2 on old systems with old CMake
|
|
||||||
set(Python_ADDITIONAL_VERSIONS 3.8 3.7 3.6 3.5)
|
|
||||||
find_package(PythonInterp) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
find_package(Python COMPONENTS Interpreter)
|
find_package(Python COMPONENTS Interpreter)
|
||||||
endif()
|
|
||||||
if(Python_EXECUTABLE)
|
if(Python_EXECUTABLE)
|
||||||
add_custom_target(check-tests
|
add_custom_target(check-tests
|
||||||
${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/check_tests.py
|
${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/check_tests.py
|
||||||
@ -54,11 +45,9 @@ target_link_libraries(style_tests PUBLIC GTest::GMock Yaml::Yaml lammps)
|
|||||||
|
|
||||||
# propagate sanitizer options to test tools
|
# propagate sanitizer options to test tools
|
||||||
if(ENABLE_SANITIZER AND (NOT (ENABLE_SANITIZER STREQUAL "none")))
|
if(ENABLE_SANITIZER AND (NOT (ENABLE_SANITIZER STREQUAL "none")))
|
||||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
|
|
||||||
target_compile_options(style_tests PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
target_compile_options(style_tests PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||||
target_link_options(style_tests PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
target_link_options(style_tests PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
# unit test for error stats class
|
# unit test for error stats class
|
||||||
add_executable(test_error_stats test_error_stats.cpp)
|
add_executable(test_error_stats test_error_stats.cpp)
|
||||||
|
|||||||
@ -12,20 +12,12 @@ if(NOT BUILD_SHARED_LIBS)
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
find_package(Python 3.6 COMPONENTS Interpreter Development)
|
||||||
find_package(PythonInterp 3.6) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
find_package(Python COMPONENTS Interpreter Development)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PKG_PYTHON)
|
if(PKG_PYTHON)
|
||||||
add_executable(test_python_package test_python_package.cpp)
|
add_executable(test_python_package test_python_package.cpp)
|
||||||
target_link_libraries(test_python_package PRIVATE lammps GTest::GMock)
|
target_link_libraries(test_python_package PRIVATE lammps GTest::GMock)
|
||||||
target_compile_definitions(test_python_package PRIVATE -DTEST_INPUT_FOLDER=${TEST_INPUT_FOLDER})
|
target_compile_definitions(test_python_package PRIVATE -DTEST_INPUT_FOLDER=${TEST_INPUT_FOLDER})
|
||||||
# this requires CMake 3.12. don't care to add backward compatibility for this.
|
|
||||||
if(Python_Development_FOUND)
|
if(Python_Development_FOUND)
|
||||||
target_compile_definitions(test_python_package PRIVATE -DTEST_HAVE_PYTHON_DEVELOPMENT=1)
|
target_compile_definitions(test_python_package PRIVATE -DTEST_HAVE_PYTHON_DEVELOPMENT=1)
|
||||||
target_link_libraries(test_python_package PRIVATE Python::Python)
|
target_link_libraries(test_python_package PRIVATE Python::Python)
|
||||||
|
|||||||
@ -1,14 +1,8 @@
|
|||||||
# -*- CMake -*- file for tests of utily functions and classes in LAMMPS
|
# -*- CMake -*- file for tests of utily functions and classes in LAMMPS
|
||||||
|
|
||||||
# we use python 3's subprocess module to run the tools and check the output
|
# we use python 3's subprocess module to run the tools and check the output
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
find_package(Python 3.6 COMPONENTS Interpreter)
|
||||||
find_package(PythonInterp 3.5) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
find_package(Python 3.5 COMPONENTS Interpreter)
|
|
||||||
endif()
|
|
||||||
get_property(BUILD_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
get_property(BUILD_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
if(BUILD_IS_MULTI_CONFIG)
|
if(BUILD_IS_MULTI_CONFIG)
|
||||||
set(LAMMPS_SHELL_EXE_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>)
|
set(LAMMPS_SHELL_EXE_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>)
|
||||||
|
|||||||
Reference in New Issue
Block a user