2 # This file is part of the GROMACS molecular simulation package.
4 # Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by
5 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 # and including many others, as listed in the AUTHORS file in the
7 # top-level source directory and at http://www.gromacs.org.
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.
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.
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.
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.
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.
35 # Helper functions to encapsulate and modularize usage of CPack
37 # This file is intended to be the only place that directly sets CPack variables
38 # (in gmx_cpack_write_config()), and other parts of the build system should
39 # only call the functions declared here to set up the packaging.
41 # Initialize the machinery that collects CPack information during other
42 # build system generation
44 # This function should be called before other functions from this file.
45 function (gmx_cpack_init)
46 # Add the source tree to the source package.
47 # If we would not set CPACK_SOURCE_INSTALLED_DIRECTORIES, this is what
48 # CPack would set as default.
49 set_property(GLOBAL PROPERTY GMX_CPACK_SOURCE_INSTALLED_DIRECTORIES
50 ${PROJECT_SOURCE_DIR} /)
53 # Add a generated directory to be included in the source package.
56 # gmx_cpack_add_generated_source_directory(<dir> [DESTINATION <dest>])
58 # <dir> Name of directory to include.
59 # Relative paths are interpreted relative to current build dir.
60 # <dest> Path in the source package where files from <dir> will be put.
61 # If not set, the files are put in the corresponding location in
64 # By default, CPack source archives includes all files from the source tree.
65 # This function adds a directory from the build tree to be packaged into the
66 # source archive. These are used for content GROMACS generates as part of the
67 # configuration or build.
68 # The values end up in CPACK_SOURCE_INSTALLED_DIRECTORIES, which is a list of
69 # pairs of names of source and destination directories.
70 function (gmx_cpack_add_generated_source_directory DIR)
71 include(CMakeParseArguments)
72 set(_one_value_args DESTINATION)
73 cmake_parse_arguments(ARG "" "${_one_value_args}" "" ${ARGN})
74 if (ARG_UNPARSED_ARGUMENTS)
75 message(FATAL_ERROR "Unknown arguments: ${ARG_UNPARSED_ARGUMENTS}")
78 if (NOT IS_ABSOLUTE ${_dir})
79 set(_dir ${CMAKE_CURRENT_BINARY_DIR}/${_dir})
82 set(_dest ${ARG_DESTINATION})
84 file(RELATIVE_PATH _dest ${PROJECT_BINARY_DIR} ${_dir})
86 set_property(GLOBAL APPEND PROPERTY GMX_CPACK_SOURCE_INSTALLED_DIRECTORIES
90 # Write CPack configuration files
92 # This function should be called at the end of the main CMakeLists.txt, after
93 # all other calls to functions in this file.
94 # CPack also automatically populates the list of components based on components
95 # used in installation rules, so it should come after all install() commands.
96 function (gmx_cpack_write_config)
97 # Set basic package information.
98 set(CPACK_PACKAGE_NAME "gromacs")
99 set(CPACK_PACKAGE_VENDOR "gromacs.org")
100 set(CPACK_PACKAGE_CONTACT "gmx-users@gromacs.org")
101 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
102 "GROMACS - a toolkit for high-performance molecular simulation")
104 set(CPACK_PACKAGE_VERSION_MAJOR ${GMX_VERSION_MAJOR})
105 set(CPACK_PACKAGE_VERSION_PATCH ${GMX_VERSION_PATCH})
106 set(CPACK_PACKAGE_VERSION ${GMX_VERSION_STRING})
107 # Add various text resources for some installers.
108 set(CPACK_RESOURCE_FILE_WELCOME "${PROJECT_SOURCE_DIR}/admin/InstallWelcome.txt")
109 # Its GPL/LGPL, so they do not have to agree to a license for mere usage,
110 # but some installers require this...
111 set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
112 set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/admin/InstallInfo.txt")
114 # Our custom config file that is run by CPack for each generator, used to
115 # check for prerequisites of the packaging.
116 set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_SOURCE_DIR}/CPackInit.cmake")
118 # Settings specific to source packages.
119 set(CPACK_SOURCE_GENERATOR TGZ)
120 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
121 list(APPEND FILES_NOT_INCLUDED_IN_SOURCE_PACKAGE
127 cmake/FindCUDA\\\\.cmake
129 set(CPACK_SOURCE_IGNORE_FILES ${FILES_NOT_INCLUDED_IN_SOURCE_PACKAGE})
131 # Get the list of directories added with gmx_cpack_add_generated_source_directory()
132 get_property(CPACK_SOURCE_INSTALLED_DIRECTORIES
133 GLOBAL PROPERTY GMX_CPACK_SOURCE_INSTALLED_DIRECTORIES)
135 # Propagate additional values for CPackInit.cmake to use.
136 # CPack includes all variables starting with CPACK_ into the generated
137 # config files that are included by CPack.
138 set(CPACK_GMX_BUILD_HELP "${GMX_BUILD_HELP}")
140 # Generate the CPack configuration files.