This repository has been archived by the owner on Nov 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
126 lines (94 loc) · 4.23 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#---------------------------------------------------
# OpenMM HIP Platform
#----------------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 3.17)
PROJECT(OpenMMHIPPlugin)
INCLUDE(Dart)
MARK_AS_ADVANCED(DART_ROOT)
ENABLE_TESTING()
SET(X86 ON)
# 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")
# We need to know where OpenMM source code is located so we can access required files.
SET(OPENMM_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../openmm" CACHE PATH "Where OpenMM source code is located")
INCLUDE_DIRECTORIES(${OPENMM_DIR}/include)
INCLUDE_DIRECTORIES(${OPENMM_DIR}/include/openmm/reference)
LINK_DIRECTORIES("${OPENMM_DIR}/lib" "${OPENMM_DIR}/lib/plugins")
SET(PTHREADS_LIB pthread)
# Specify the C++ version we are building for.
SET(CMAKE_CXX_STANDARD 11)
IF(MSVC)
SET(EXTRA_COMPILE_FLAGS)
# Use warning level 2, not whatever warning level CMake picked.
STRING(REGEX REPLACE "/W[0-4]" "/W2" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# Explicitly suppress warnings 4305 and 4244.
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4305 /wd4244")
ELSEIF(X86)
SET(EXTRA_COMPILE_FLAGS "-msse2")
ELSE()
SET(EXTRA_COMPILE_FLAGS)
ENDIF()
# Make sure that Lepton::CompiledExpression class has the same structure as in the main library
IF(X86 AND NOT (WIN32 AND OPENMM_BUILD_STATIC_LIB))
INCLUDE_DIRECTORIES(BEFORE ${OPENMM_SOURCE_DIR}/libraries/asmjit)
SET(EXTRA_COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DLEPTON_USE_JIT")
ENDIF()
IF(UNIX AND NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Debug or Release build" FORCE)
ENDIF (UNIX AND NOT CMAKE_BUILD_TYPE)
IF (NOT CMAKE_CXX_FLAGS_DEBUG)
SET(CMAKE_CXX_FLAGS_DEBUG "-g" CACHE STRING "To use when CMAKE_BUILD_TYPE=Debug" FORCE)
ENDIF (NOT CMAKE_CXX_FLAGS_DEBUG)
IF (NOT CMAKE_CXX_FLAGS_RELEASE)
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "To use when CMAKE_BUILD_TYPE=Release" FORCE)
ENDIF (NOT CMAKE_CXX_FLAGS_RELEASE)
# Select where to install
IF(${CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT})
IF(WIN32)
SET(CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}/OpenMM" CACHE PATH "Where to install the plugin" FORCE)
ELSE(WIN32)
SET(CMAKE_INSTALL_PREFIX "/usr/local/openmm" CACHE PATH "Where to install the plugin" FORCE)
ENDIF(WIN32)
ENDIF(${CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT})
# What type of libraries to build
SET(OPENMM_BUILD_SHARED_LIB ON CACHE BOOL "Whether to build shared OpenMM libraries")
SET(OPENMM_BUILD_STATIC_LIB OFF CACHE BOOL "Whether to build static OpenMM libraries")
SET(OPENMM_LIBRARY_NAME OpenMM)
IF(NOT EXECUTABLE_OUTPUT_PATH)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}
CACHE INTERNAL "Single output directory for building all executables.")
ENDIF(NOT EXECUTABLE_OUTPUT_PATH)
# Include OpenMM utiliity libraries
SET(OPENMM_LIB_SUBDIRS libraries/jama libraries/quern libraries/hilbert libraries/csha1 libraries/lbfgs libraries/pocketfft)
FOREACH(subdir ${OPENMM_LIB_SUBDIRS})
INCLUDE_DIRECTORIES(BEFORE ${OPENMM_SOURCE_DIR}/${subdir}/include)
ENDFOREACH(subdir)
LIST(APPEND CMAKE_PREFIX_PATH $ENV{ROCM_PATH} /opt/rocm)
FIND_PACKAGE(HIP CONFIG REQUIRED)
FIND_PACKAGE(HIPFFT CONFIG REQUIRED)
IF(${HIP_COMPILER} STREQUAL "clang")
MESSAGE(STATUS "Using HIP-Clang compiler")
ELSE()
MESSAGE(FATAL_ERROR "HIP compiler ${HIP_COMPILER} not recognized!")
ENDIF()
ADD_SUBDIRECTORY(platforms/hip)
# Amoeba plugin
SET(OPENMM_BUILD_AMOEBA_PLUGIN ON CACHE BOOL "Build Amoeba plugin")
IF(OPENMM_BUILD_AMOEBA_PLUGIN)
ADD_SUBDIRECTORY(plugins/amoeba/platforms/hip)
ENDIF(OPENMM_BUILD_AMOEBA_PLUGIN)
# RPMD plugin
SET(OPENMM_BUILD_RPMD_PLUGIN ON CACHE BOOL "Build RPMD plugin")
IF(OPENMM_BUILD_RPMD_PLUGIN)
ADD_SUBDIRECTORY(plugins/rpmd/platforms/hip)
ENDIF(OPENMM_BUILD_RPMD_PLUGIN)
# Drude plugin
SET(OPENMM_BUILD_DRUDE_PLUGIN ON CACHE BOOL "Build Drude plugin")
IF(OPENMM_BUILD_DRUDE_PLUGIN)
ADD_SUBDIRECTORY(plugins/drude/platforms/hip)
ENDIF(OPENMM_BUILD_DRUDE_PLUGIN)
# HIP compiler plugin
SET(OPENMM_BUILD_HIP_COMPILER_PLUGIN ON CACHE BOOL "Build HIP runtime compiler plugin")
IF(OPENMM_BUILD_HIP_COMPILER_PLUGIN)
ADD_SUBDIRECTORY(plugins/hipcompiler)
ENDIF(OPENMM_BUILD_HIP_COMPILER_PLUGIN)