added Verlet scheme and NxN non-bonded functionality
[gromacs.git] / src / kernel / CMakeLists.txt
blobcb5d998dee7fd5c162bda5c04aaf15d2698e7cbd
2 set(GMXPREPROCESS_SOURCES 
3     add_par.c       
4     calc_verletbuf.c
5     compute_io.c    
6     convparm.c      
7     gen_ad.c        
8     gen_vsite.c     
9     genhydro.c   
10     gpp_atomtype.c  
11     gpp_bond_atomtype.c     
12     h_db.c          
13     hackblock.c             
14     hizzie.c        
15     nm2type.c
16     pdb2top.c       
17     pgutil.c        
18     readir.c        
19     readpull.c      
20     readadress.c      
21     readrot.c
22     resall.c        
23     sorting.c       
24     specbond.c      
25     ter_db.c        
26     tomorse.c       
27     topdirs.c       
28     topexcl.c       
29     topio.c         
30     toppush.c       
31     topshake.c      
32     toputil.c       
33     tpbcmp.c        
34     vsite_parm.c    
35     fflibutil.c
36     xlate.c)
38 set(MDRUN_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
42     md_openmm.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)
52 endif()
54 if(GMX_OPENMM) 
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})   
64 endif(GMX_OPENMM)
66 if(GMX_FAHCORE)
67   add_library(fahcore ${MDRUN_SOURCES})
68 else(GMX_FAHCORE)
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})
79     endif()
80     target_link_libraries(${PROGRAM} ${GMX_EXTRA_LIBRARIES})
81     set_target_properties(${PROGRAM} PROPERTIES OUTPUT_NAME "${PROGRAM}${GMX_BINARY_SUFFIX}")
82 endforeach()
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")
94 endif()
96 # Construct component groups for installation
97 foreach(PROGRAM ${GMX_KERNEL_PROGRAMS} mdrun)
98     set(CPACK_COMPONENT_${PROGRAM}_GROUP tools)
99 endforeach()
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}")
115     else()
116        add_custom_target(install-${PROGRAM}
117            COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${PROGRAM}
118                    -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
119            COMMENT "Installing ${PROGRAM}")
120     endif()
121     add_dependencies(install-${PROGRAM} ${PROGRAM})
122     install(
123       TARGETS ${PROGRAM}
124       COMPONENT ${PROGRAM}
125       DESTINATION ${BIN_INSTALL_DIR}
126       )
127 endforeach()
129 install(TARGETS gmxpreprocess DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries)
131 endif(GMX_FAHCORE)
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)