3f79876a1fc15e3ed7bbe02fc3d576f6d0bc75fb
[alexxy/gromacs.git] / src / tools / CMakeLists.txt
1 #
2 # This file is part of the GROMACS molecular simulation package.
3 #
4 # Copyright (c) 2012,2013, by the GROMACS development team, led by
5 # David van der Spoel, Berk Hess, Erik Lindahl, and including many
6 # others, as listed in the AUTHORS file in the top-level source
7 # directory and at http://www.gromacs.org.
8 #
9 # GROMACS is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public License
11 # as published by the Free Software Foundation; either version 2.1
12 # of the License, or (at your option) any later version.
13 #
14 # GROMACS is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # Lesser General Public License for more details.
18 #
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with GROMACS; if not, see
21 # http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23 #
24 # If you want to redistribute modifications to GROMACS, please
25 # consider that scientific software is very special. Version
26 # control is crucial - bugs must be traceable. We will be happy to
27 # consider code for inclusion in the official distribution, but
28 # derived work must not be called official GROMACS. Details are found
29 # in the README & COPYING files - if they are missing, get the
30 # official version at http://www.gromacs.org.
31 #
32 # To help us fund GROMACS development, we humbly ask that you cite
33 # the research papers on the package. Check out http://www.gromacs.org.
34 #
35
36 add_library(gmxana 
37             autocorr.c      expfit.c        polynomials.c   levenmar.c      
38             anadih.c        pp2shift.c      dlist.c         
39             eigio.c         cmat.c          
40             eigensolver.c   nsc.c           
41             hxprops.c       fitahx.c        
42             geminate.c      nsfactor.c
43             gmx_analyze.c   gmx_anaeig.c    gmx_angle.c     gmx_bond.c      
44             gmx_bundle.c    gmx_chi.c       gmx_cluster.c   gmx_confrms.c   
45             gmx_covar.c     gmx_current.c   
46             gmx_density.c   gmx_densmap.c       
47             gmx_dielectric.c        
48             gmx_kinetics.c  gmx_spatial.c   gmx_tune_pme.c
49             gmx_dipoles.c   gmx_disre.c     gmx_dist.c      gmx_dyndom.c    
50             gmx_enemat.c    gmx_energy.c    gmx_lie.c       gmx_filter.c    
51             gmx_gyrate.c    gmx_h2order.c   gmx_hbond.c     gmx_helix.c     
52             gmx_mindist.c   gmx_msd.c       gmx_morph.c     gmx_nmeig.c     
53             gmx_nmens.c     gmx_order.c     gmx_principal.c 
54             gmx_polystat.c  gmx_potential.c gmx_rama.c      
55             gmx_rdf.c       gmx_rms.c       gmx_rmsf.c      
56             gmx_rotacf.c    gmx_saltbr.c    gmx_sas.c       gmx_sans.c
57             gmx_select.c    gmx_rmsdist.c   gmx_rotmat.c
58             gmx_sgangle.c   gmx_sorient.c   gmx_spol.c      gmx_tcaf.c      
59             gmx_traj.c      gmx_velacc.c    gmx_helixorient.c 
60             gmx_clustsize.c gmx_mdmat.c     gmx_wham.c      
61             correl.c        gmx_sham.c      gmx_nmtraj.c    
62             gmx_trjconv.c   gmx_trjcat.c    gmx_trjorder.c  gmx_xpm2ps.c    
63             gmx_editconf.c  gmx_genbox.c    gmx_genion.c    gmx_genconf.c   
64             gmx_genpr.c     gmx_eneconv.c   gmx_vanhove.c   gmx_wheel.c     
65             addconf.c                       edittop.c       gmx_bar.c
66             gmx_membed.c    gmx_pme_error.c gmx_options.c   gmx_dos.c
67             gmx_hydorder.c  gmx_densorder.c powerspect.c    dens_filter.c
68             binsearch.c     gmx_dyecoupl.c  gmx_make_edi.c  gmx_sigeps.c
69             gmx_do_dssp.c   gmx_anadock.c   gmx_make_ndx.c  gmx_mk_angndx.c
70             )
71
72
73 target_link_libraries(gmxana md ${GSL_LIBRARIES})
74 set_target_properties(gmxana PROPERTIES OUTPUT_NAME "gmxana${GMX_LIBS_SUFFIX}" SOVERSION ${SOVERSION} INSTALL_NAME_DIR "${LIB_INSTALL_DIR}"
75     COMPILE_FLAGS "${OpenMP_C_FLAGS}")
76
77 # List of programs with single corresponding .c source file,
78 # used to create build rules automatically.
79 #
80 set(GMX_TOOLS_PROGRAMS
81     do_dssp editconf eneconv genbox genconf genrestr g_nmtraj 
82     make_ndx mk_angndx trjcat trjconv trjorder g_wheel 
83     xpm2ps genion g_anadock make_edi g_analyze g_anaeig
84     g_angle g_bond g_bundle g_chi g_cluster g_confrms g_covar
85     g_current g_density g_densmap g_dielectric
86     g_helixorient g_principal g_dipoles g_disre g_dist
87     g_dyndom g_enemat g_energy g_lie g_filter g_gyrate
88     g_h2order g_hbond g_helix g_mindist g_msd g_morph g_nmeig
89     g_nmens g_order g_kinetics g_polystat g_potential g_rama g_rdf g_rms
90     g_rmsf g_rotacf g_saltbr g_sas g_select g_sgangle g_sham g_sorient
91     g_spol g_spatial g_tcaf g_traj g_tune_pme g_vanhove
92     g_velacc g_clustsize g_mdmat g_wham g_sigeps g_bar
93     g_membed g_pme_error g_rmsdist g_rotmat g_options
94     g_dos    g_hydorder  g_densorder g_dyecoupl g_sans
95     )
96
97 set(GMX_TOOLS_PROGRAMS_NOT_FOR_INSTALLATION
98   # names of any executables that should be built but not installed can go here
99     )
100
101
102 foreach(TOOL ${GMX_TOOLS_PROGRAMS} ${GMX_TOOLS_PROGRAMS_NOT_FOR_INSTALLATION})
103     if(GMX_GPU OR GMX_FORCE_CXX)
104         set_source_files_properties(${TOOL}.c PROPERTIES LANGUAGE CXX)
105         if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
106             set_source_files_properties(${TOOL}.c PROPERTIES COMPILE_FLAGS "-x c++")
107         endif()
108     endif()
109     add_executable(${TOOL} ${TOOL}.c)
110     target_link_libraries(${TOOL} gmxana md gmx ${OpenMP_LINKER_FLAGS})
111     set_target_properties(${TOOL} PROPERTIES OUTPUT_NAME "${TOOL}${GMX_BINARY_SUFFIX}")
112 endforeach()
113
114 foreach(TOOL ${GMX_TOOLS_PROGRAMS})
115     if (NOT ${TOOL} STREQUAL "g_options")
116         gmx_add_man_page(${TOOL})
117     endif()
118
119     # Manage CPack component dependencies, and group membership; note that
120     # a component may belong to only one group
121     set(CPACK_COMPONENT_${TOOL}_DEPENDS libraries libraries-gmxana)
122     set(CPACK_COMPONENT_${TOOL}_GROUP tools)
123
124     # Create custom install-xxxx target
125     if (BUILD_SHARED_LIBS)
126     # If shared libraries are used, we need to install the libraries in
127     # addition to the tool binary.
128        add_custom_target(install-${TOOL}
129            COMMAND ${CMAKE_COMMAND} -DCOMPONENT=libraries
130                    -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
131            COMMAND ${CMAKE_COMMAND} -DCOMPONENT=libraries-gmxana
132                    -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
133            COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${TOOL}
134                    -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
135            COMMENT "Installing ${TOOL}")
136     else()
137        add_custom_target(install-${TOOL}
138            COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${TOOL}
139                    -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
140            COMMENT "Installing ${TOOL}")
141     endif()
142     add_dependencies(install-${TOOL} ${TOOL})
143
144     # Finally, trigger installation
145     install(
146       TARGETS ${TOOL}
147       COMPONENT ${TOOL}
148       DESTINATION ${BIN_INSTALL_DIR}
149       )
150 endforeach()
151
152 install(TARGETS gmxana DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries-gmxana)
153
154 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libgmxana.pc.cmakein ${CMAKE_CURRENT_BINARY_DIR}/libgmxana.pc @ONLY)
155 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgmxana.pc
156         DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
157         RENAME "libgmxana${GMX_LIBS_SUFFIX}.pc"
158         COMPONENT development)