2 set(GMXPREPROCESS_SOURCES
37 gctio.c ionize.c runner.c
38 do_gct.c repl_ex.c xutils.c
39 md.c mdrun.c genalg.c membed.c
42 add_library(gmxpreprocess ${GMXPREPROCESS_SOURCES})
43 target_link_libraries(gmxpreprocess md)
44 set_target_properties(gmxpreprocess PROPERTIES OUTPUT_NAME "gmxpreprocess${GMX_LIBS_SUFFIX}" SOVERSION ${SOVERSION} INSTALL_NAME_DIR "${LIB_INSTALL_DIR}")
48 add_subdirectory(gmx_gpu_utils)
49 include_directories(./gmx_gpu_utils ${OpenMM_INCLUDE_DIR})
50 link_directories(${OpenMM_LIBRARY_DIR})
51 # with this define no evn.var. is needed with OPENMM_PLUGIN_DIR
52 # if the same OpenMM installation is used for running and building
53 add_definitions( -DOPENMM_PLUGIN_DIR="${OpenMM_PLUGIN_DIR}" )
54 file(TO_CMAKE_PATH ${OpenMM_PLUGIN_DIR} _path)
55 add_library(openmm_api_wrapper STATIC openmm_wrapper.cpp)
56 target_link_libraries(openmm_api_wrapper gmx_gpu_utils ${OpenMM_LIBRARIES})
57 set(GMX_OPENMM_LIBRARIES openmm_api_wrapper gmx_gpu_utils ${OpenMM_LIBRARIES})
61 add_library(fahcore ${MDRUN_SOURCES})
64 list(APPEND GMX_EXTRA_LIBRARIES gmxpreprocess md)
66 add_executable(grompp grompp.c)
67 target_link_libraries(grompp ${GMX_EXTRA_LIBRARIES})
68 set_target_properties(grompp PROPERTIES OUTPUT_NAME "grompp${GMX_BINARY_SUFFIX}")
70 add_executable(tpbconv tpbconv.c)
71 target_link_libraries(tpbconv ${GMX_EXTRA_LIBRARIES})
72 set_target_properties(tpbconv PROPERTIES OUTPUT_NAME "tpbconv${GMX_BINARY_SUFFIX}")
74 add_executable(pdb2gmx pdb2gmx.c)
75 target_link_libraries(pdb2gmx ${GMX_EXTRA_LIBRARIES})
76 set_target_properties(pdb2gmx PROPERTIES OUTPUT_NAME "pdb2gmx${GMX_BINARY_SUFFIX}")
78 add_executable(g_protonate g_protonate.c)
79 target_link_libraries(g_protonate ${GMX_EXTRA_LIBRARIES})
80 set_target_properties(g_protonate PROPERTIES OUTPUT_NAME "g_protonate${GMX_BINARY_SUFFIX}")
82 add_executable(g_luck g_luck.c)
83 target_link_libraries(g_luck ${GMX_EXTRA_LIBRARIES})
84 set_target_properties(g_luck PROPERTIES OUTPUT_NAME "g_luck${GMX_BINARY_SUFFIX}")
86 add_executable(gmxdump gmxdump.c)
87 target_link_libraries(gmxdump ${GMX_EXTRA_LIBRARIES})
88 set_target_properties(gmxdump PROPERTIES OUTPUT_NAME "gmxdump${GMX_BINARY_SUFFIX}")
90 add_executable(g_x2top g_x2top.c)
91 target_link_libraries(g_x2top ${GMX_EXTRA_LIBRARIES})
92 set_target_properties(g_x2top PROPERTIES OUTPUT_NAME "g_x2top${GMX_BINARY_SUFFIX}")
94 add_executable(gmxcheck gmxcheck.c)
95 target_link_libraries(gmxcheck ${GMX_EXTRA_LIBRARIES})
96 set_target_properties(gmxcheck PROPERTIES OUTPUT_NAME "gmxcheck${GMX_BINARY_SUFFIX}")
98 add_executable(mdrun ${MDRUN_SOURCES})
99 target_link_libraries(mdrun ${GMX_EXTRA_LIBRARIES} ${GMX_OPENMM_LIBRARIES})
100 set_target_properties(mdrun PROPERTIES OUTPUT_NAME "mdrun${GMX_BINARY_SUFFIX}")
102 # this is to circumvent the following MSVC error:
103 # warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs
104 # fatal error LNK1169: one or more multiply defined symbols found
105 if(GMX_OPENMM AND MSVC)
106 set_target_properties(mdrun PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT")
110 install(TARGETS gmxpreprocess DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries)
111 install(TARGETS mdrun DESTINATION ${BIN_INSTALL_DIR} COMPONENT mdrun)
122 RUNTIME DESTINATION ${BIN_INSTALL_DIR})
124 # Create the custom install-mdrun target
125 if (BUILD_SHARED_LIBS)
126 # If shared libraries are used, we need to install the libraries in
127 # addition to the mdrun binary.
128 add_custom_target(install-mdrun
129 COMMAND ${CMAKE_COMMAND} -DCOMPONENT=libraries
130 -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
131 COMMAND ${CMAKE_COMMAND} -DCOMPONENT=mdrun
132 -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
133 COMMENT "Installing mdrun")
134 else (BUILD_SHARED_LIBS)
135 add_custom_target(install-mdrun
136 COMMAND ${CMAKE_COMMAND} -DCOMPONENT=mdrun
137 -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
138 COMMENT "Installing mdrun")
139 endif (BUILD_SHARED_LIBS)
140 add_dependencies(install-mdrun mdrun)
144 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libgmxpreprocess.pc.cmakein ${CMAKE_CURRENT_BINARY_DIR}/libgmxpreprocess.pc @ONLY)
145 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgmxpreprocess.pc
146 DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
147 RENAME "libgmxpreprocess${GMX_LIBS_SUFFIX}.pc"
148 COMPONENT development)