2 set(GMXPREPROCESS_SOURCES
39 gctio.c ionize.c runner.c
40 do_gct.c repl_ex.c xutils.c pme_switch.c
41 md.c mdrun.c genalg.c membed.c
44 add_library(gmxpreprocess ${GMXPREPROCESS_SOURCES})
45 target_link_libraries(gmxpreprocess md)
46 set_target_properties(gmxpreprocess PROPERTIES OUTPUT_NAME "gmxpreprocess${GMX_LIBS_SUFFIX}" SOVERSION ${SOVERSION} INSTALL_NAME_DIR "${LIB_INSTALL_DIR}"
47 COMPILE_FLAGS "${OpenMP_C_FLAGS}")
50 if(GMX_GPU OR GMX_OPENMM)
51 include_directories(${CMAKE_SOURCE_DIR}/src/gmxlib/gpu_utils)
55 include_directories(${OpenMM_INCLUDE_DIR})
56 link_directories(${OpenMM_LIBRARY_DIR})
57 # with this define no evn.var. is needed with OPENMM_PLUGIN_DIR
58 # if the same OpenMM installation is used for running and building
59 add_definitions( -DOPENMM_PLUGIN_DIR="${OpenMM_PLUGIN_DIR}" )
60 file(TO_CMAKE_PATH ${OpenMM_PLUGIN_DIR} _path)
61 add_library(openmm_api_wrapper STATIC openmm_wrapper.cpp)
62 target_link_libraries(openmm_api_wrapper ${OpenMM_LIBRARIES})
63 set(GMX_OPENMM_LIBRARIES openmm_api_wrapper ${OpenMM_LIBRARIES})
67 add_library(fahcore ${MDRUN_SOURCES})
70 list(APPEND GMX_EXTRA_LIBRARIES gmxpreprocess md ${OpenMP_LINKER_FLAGS})
72 set(GMX_KERNEL_PROGRAMS
73 grompp tpbconv pdb2gmx g_protonate g_luck gmxdump g_x2top gmxcheck)
75 foreach(PROGRAM ${GMX_KERNEL_PROGRAMS})
76 add_executable(${PROGRAM} ${PROGRAM}.c)
77 if (NOT ${PROGRAM} STREQUAL "g_luck")
78 gmx_add_man_page(${PROGRAM})
80 target_link_libraries(${PROGRAM} ${GMX_EXTRA_LIBRARIES})
81 set_target_properties(${PROGRAM} PROPERTIES OUTPUT_NAME "${PROGRAM}${GMX_BINARY_SUFFIX}")
84 add_executable(mdrun ${MDRUN_SOURCES})
85 gmx_add_man_page(mdrun)
86 target_link_libraries(mdrun ${GMX_EXTRA_LIBRARIES} ${GMX_OPENMM_LIBRARIES})
87 set_target_properties(mdrun PROPERTIES OUTPUT_NAME "mdrun${GMX_BINARY_SUFFIX}" COMPILE_FLAGS "${OpenMP_C_FLAGS}")
89 # this is to circumvent the following MSVC error:
90 # warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs
91 # fatal error LNK1169: one or more multiply defined symbols found
92 if(GMX_OPENMM AND MSVC)
93 set_target_properties(mdrun PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT")
96 # Construct component groups for installation
97 foreach(PROGRAM ${GMX_KERNEL_PROGRAMS} mdrun)
98 set(CPACK_COMPONENT_${PROGRAM}_GROUP tools)
100 set(CPACK_COMPONENT_MDRUN_GROUP mdrun)
102 # Create custom install-xxxx targets, component dependences,
103 # and trigger the installation
104 foreach(PROGRAM ${GMX_KERNEL_PROGRAMS} mdrun)
105 set(CPACK_COMPONENT_${PROGRAM}_DEPENDS libraries)
106 if (BUILD_SHARED_LIBS)
107 # If shared libraries are used, we need to install the libraries in
108 # addition to the mdrun binary.
109 add_custom_target(install-${PROGRAM}
110 COMMAND ${CMAKE_COMMAND} -DCOMPONENT=libraries
111 -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
112 COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${PROGRAM}
113 -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
114 COMMENT "Installing ${PROGRAM}")
116 add_custom_target(install-${PROGRAM}
117 COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${PROGRAM}
118 -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
119 COMMENT "Installing ${PROGRAM}")
121 add_dependencies(install-${PROGRAM} ${PROGRAM})
125 DESTINATION ${BIN_INSTALL_DIR}
129 install(TARGETS gmxpreprocess DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries)
133 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libgmxpreprocess.pc.cmakein ${CMAKE_CURRENT_BINARY_DIR}/libgmxpreprocess.pc @ONLY)
134 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgmxpreprocess.pc
135 DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
136 RENAME "libgmxpreprocess${GMX_LIBS_SUFFIX}.pc"
137 COMPONENT development)