-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathCMakeLists.txt
148 lines (131 loc) · 3.92 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
project(mpmc)
cmake_minimum_required(VERSION 2.8)
option(MPI "Use MPI to parallelize the calculations (requires MPI)" OFF)
option(CUDA "Use CUDA to offload polarization calculations to a GPU (requires CUDA)" OFF)
option(QM_ROTATION "Enable Quantum Mechanics Rigid Rotator calculations (requires LAPACK)" OFF)
option(VDW "Enable Coupled-Dipole Van der Waals (requires LAPACK)" OFF)
execute_process(COMMAND bash "-c" "git rev-list HEAD| wc -l |sed 's: ::g'" VERBATIM OUTPUT_VARIABLE REV)
add_definitions(-DVERSION=${REV})
configure_file (
"${PROJECT_SOURCE_DIR}/src/include/cmake_config.h.in"
"${PROJECT_BINARY_DIR}/src/include/cmake_config.h"
)
message("Compiling For ${CMAKE_BUILD_TYPE}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -Wall")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -g -Wall")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -Wall")
set(LIB m)
set(INCLUDE src/include ${PROJECT_BINARY_DIR}/src/include)
set(SRC
src/mc/mc_moves.c
src/mc/surface_fit_arbitrary.c
src/mc/surface_multi_fit.c
src/mc/qshift.c
src/mc/single_point.c
src/mc/mc.c
src/mc/replay.c
src/mc/pimc.c
src/mc/surface.c
src/mc/surf_fit.c
src/mc/fugacity.cpp
src/mc/cavity.c
src/mc/checkpoint.c
src/io/histogram.c
src/energy/lj_buffered_14_7.c
src/energy/bessel.c
src/energy/dreiding.c
src/energy/energy.c
src/energy/polar.c
src/energy/pbc.c
src/energy/disp_expansion.c
src/energy/vdw.c
src/energy/pairs.c
src/energy/bond.c
src/energy/coulombic_gwp.c
src/energy/exp_repulsion.c
src/energy/coulombic.c
src/energy/sg.c
src/energy/lj.c
src/energy/axilrod_teller.cpp
src/main/quaternion.c
src/main/memnullcheck.c
src/main/main.c
src/main/cleanup.c
src/main/usefulmath.c
src/main/rand.c
src/io/dxwrite.c
src/io/simulation_box.c
src/io/average.c
src/io/output.c
src/io/check_input.c
src/io/input.c
src/io/mpi.c
src/io/read_pqr.c
src/polarization/thole_field.c
src/polarization/polar_wolf_lookup.c
src/polarization/thole_polarizability.c
src/polarization/thole_matrix.c
src/polarization/polar_ewald.c
src/polarization/thole_iterative.c
)
if(MPI)
message("-- MPI Enabled")
find_package(MPI REQUIRED)
if(NOT MPI_C_FOUND)
message(FATAL_ERROR "-- MPI not found! Exiting ...")
endif()
set(INCLUDE ${INCLUDE} ${MPI_C_INCLUDE_PATH})
set(LIB ${LIB} ${MPI_C_LIBRARIES})
else()
message("-- MPI Disabled")
endif()
if(CUDA)
message("-- CUDA Enabled")
find_package(CUDA REQUIRED)
set(SRC ${SRC} src/polarization/polar_cuda_pcg.cu src/energy/vdw.cu)
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
find_package(Threads REQUIRED)
else()
message("-- CUDA Disabled")
endif()
if(QM_ROTATION)
message("-- QM Rotation Enabled")
set(SRC ${SRC}
src/quantum_rotation/rotational_basis.c
src/quantum_rotation/rotational_eigenspectrum.c
src/quantum_rotation/rotational_integrate.c
src/quantum_rotation/rotational_potential.c)
else()
message("-- QM Rotation Disabled")
endif()
if(VDW)
message("-- CDVDW Enabled")
else()
message("-- CDVDW Disabled")
endif()
if(VDW OR QM_ROTATION)
link_directories(${CMAKE_SOURCE_DIR}/lapack/install_dir)
set(LIB ${LIB} liblapack.a libblas.a gfortran)
endif()
include_directories(${INCLUDE})
if(CUDA)
cuda_add_executable(${PROJECT_NAME} ${SRC})
cuda_add_cublas_to_target(${PROJECT_NAME})
find_library(CUSOLVER_LIBRARY cusolver HINTS ${CUDA_TOOLKIT_ROOT_DIR}/lib64)
target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT} ${CUSOLVER_LIBRARY})
link_directories(${CUDA_TOOLKIT_ROOT_DIR}/lib64)
else()
add_executable(${PROJECT_NAME} ${SRC})
endif()
target_link_libraries(${PROJECT_NAME} ${LIB})
if(MPI)
if(MPI_C_COMPILE_FLAGS)
set_target_properties(${PROJECT_NAME} PROPERTIES
COMPILE_FLAGS "${MPI_C_COMPILE_FLAGS}")
endif()
if(MPI_C_LINK_FLAGS)
set_target_properties(${PROJECT_NAME} PROPERTIES
LINK_FLAGS "${MPI_C_LINK_FLAGS}")
endif()
endif()