From e8381af0a1961b5f1111a21873fe334890034e18 Mon Sep 17 00:00:00 2001 From: Peter Eastman Date: Thu, 12 Aug 2021 15:56:27 -0700 Subject: [PATCH] Minor cleanup to CMake scripts --- CMakeLists.txt | 6 ++++-- platforms/cuda/EncodeCUDAFiles.cmake | 27 --------------------------- 2 files changed, 4 insertions(+), 29 deletions(-) delete mode 100644 platforms/cuda/EncodeCUDAFiles.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e435cce..55ef2d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,9 @@ # OpenMM Example Plugin #---------------------------------------------------- -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +CMAKE_MINIMUM_REQUIRED(VERSION 3.17) + +PROJECT(OpenMMExamplePlugin) # We need to know where OpenMM is installed so we can access the headers and libraries. SET(OPENMM_DIR "/usr/local/openmm" CACHE PATH "Where OpenMM is installed") @@ -85,7 +87,7 @@ ADD_SUBDIRECTORY(platforms/reference) ADD_SUBDIRECTORY(platforms/common) SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}") -FIND_PACKAGE(OpenCL QUIET) +FIND_PACKAGE(OPENCL QUIET) IF(OPENCL_FOUND) SET(EXAMPLE_BUILD_OPENCL_LIB ON CACHE BOOL "Build implementation for OpenCL") ELSE(OPENCL_FOUND) diff --git a/platforms/cuda/EncodeCUDAFiles.cmake b/platforms/cuda/EncodeCUDAFiles.cmake deleted file mode 100644 index 58285b0..0000000 --- a/platforms/cuda/EncodeCUDAFiles.cmake +++ /dev/null @@ -1,27 +0,0 @@ -FILE(GLOB CUDA_KERNELS ${CUDA_SOURCE_DIR}/kernels/*.cu) -SET(CUDA_FILE_DECLARATIONS) -SET(CUDA_FILE_DEFINITIONS) -CONFIGURE_FILE(${CUDA_SOURCE_DIR}/${CUDA_SOURCE_CLASS}.cpp.in ${CUDA_KERNELS_CPP}) -FOREACH(file ${CUDA_KERNELS}) - # Load the file contents and process it. - FILE(STRINGS ${file} file_content NEWLINE_CONSUME) - # Replace all backslashes by double backslashes as they are being put in a C string. - # Be careful not to replace the backslash before a semicolon as that is the CMAKE - # internal escaping of a semicolon to prevent it from acting as a list seperator. - STRING(REGEX REPLACE "\\\\([^;])" "\\\\\\\\\\1" file_content "${file_content}") - # Escape double quotes as being put in a C string. - STRING(REPLACE "\"" "\\\"" file_content "${file_content}") - # Split in separate C strings for each line. - STRING(REPLACE "\n" "\\n\"\n\"" file_content "${file_content}") - - # Determine a name for the variable that will contain this file's contents - FILE(RELATIVE_PATH filename ${CUDA_SOURCE_DIR}/kernels ${file}) - STRING(LENGTH ${filename} filename_length) - MATH(EXPR filename_length ${filename_length}-3) - STRING(SUBSTRING ${filename} 0 ${filename_length} variable_name) - - # Record the variable declaration and definition. - SET(CUDA_FILE_DECLARATIONS ${CUDA_FILE_DECLARATIONS}static\ const\ std::string\ ${variable_name};\n) - FILE(APPEND ${CUDA_KERNELS_CPP} const\ string\ ${CUDA_SOURCE_CLASS}::${variable_name}\ =\ \"${file_content}\"\;\n) -ENDFOREACH(file) -CONFIGURE_FILE(${CUDA_SOURCE_DIR}/${CUDA_SOURCE_CLASS}.h.in ${CUDA_KERNELS_H})