SYCL: Avoid using no_init read accessor in rocFFT
[alexxy/gromacs.git] / cmake / gmxCPackUtilities.cmake
1 #
2 # This file is part of the GROMACS molecular simulation package.
3 #
4 # Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
5 # Copyright (c) 2019,2020, by the GROMACS development team, led by
6 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
7 # and including many others, as listed in the AUTHORS file in the
8 # top-level source directory and at http://www.gromacs.org.
9 #
10 # GROMACS is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Lesser General Public License
12 # as published by the Free Software Foundation; either version 2.1
13 # of the License, or (at your option) any later version.
14 #
15 # GROMACS is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 # Lesser General Public License for more details.
19 #
20 # You should have received a copy of the GNU Lesser General Public
21 # License along with GROMACS; if not, see
22 # http://www.gnu.org/licenses, or write to the Free Software Foundation,
23 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
24 #
25 # If you want to redistribute modifications to GROMACS, please
26 # consider that scientific software is very special. Version
27 # control is crucial - bugs must be traceable. We will be happy to
28 # consider code for inclusion in the official distribution, but
29 # derived work must not be called official GROMACS. Details are found
30 # in the README & COPYING files - if they are missing, get the
31 # official version at http://www.gromacs.org.
32 #
33 # To help us fund GROMACS development, we humbly ask that you cite
34 # the research papers on the package. Check out http://www.gromacs.org.
35
36 # Helper functions to encapsulate and modularize usage of CPack
37 #
38 # This file is intended to be the only place that directly sets CPack variables
39 # (in gmx_cpack_write_config()), and other parts of the build system should
40 # only call the functions declared here to set up the packaging.
41
42 # Initialize the machinery that collects CPack information during other
43 # build system generation
44 #
45 # This function should be called before other functions from this file.
46 function (gmx_cpack_init)
47     # Add the source tree to the source package.
48     # If we would not set CPACK_SOURCE_INSTALLED_DIRECTORIES, this is what
49     # CPack would set as default.
50     set_property(GLOBAL PROPERTY GMX_CPACK_SOURCE_INSTALLED_DIRECTORIES
51         ${PROJECT_SOURCE_DIR} /)
52 endfunction()
53
54 # Add a generated directory to be included in the source package.
55 #
56 # Usage:
57 #   gmx_cpack_add_generated_source_directory(<dir> [DESTINATION <dest>])
58 #
59 #   <dir>   Name of directory to include.
60 #           Relative paths are interpreted relative to current build dir.
61 #   <dest>  Path in the source package where files from <dir> will be put.
62 #           If not set, the files are put in the corresponding location in
63 #           the source tree.
64 #
65 # By default, CPack source archives includes all files from the source tree.
66 # This function adds a directory from the build tree to be packaged into the
67 # source archive.  These are used for content GROMACS generates as part of the
68 # configuration or build.
69 # The values end up in CPACK_SOURCE_INSTALLED_DIRECTORIES, which is a list of
70 # pairs of names of source and destination directories.
71 function (gmx_cpack_add_generated_source_directory DIR)
72     include(CMakeParseArguments)
73     set(_one_value_args DESTINATION)
74     cmake_parse_arguments(ARG "" "${_one_value_args}" "" ${ARGN})
75     if (ARG_UNPARSED_ARGUMENTS)
76         message(FATAL_ERROR "Unknown arguments: ${ARG_UNPARSED_ARGUMENTS}")
77     endif()
78     set(_dir ${DIR})
79     if (NOT IS_ABSOLUTE ${_dir})
80         set(_dir ${CMAKE_CURRENT_BINARY_DIR}/${_dir})
81     endif()
82     if (ARG_DESTINATION)
83         set(_dest ${ARG_DESTINATION})
84     else()
85         file(RELATIVE_PATH _dest ${PROJECT_BINARY_DIR} ${_dir})
86     endif()
87     set_property(GLOBAL APPEND PROPERTY GMX_CPACK_SOURCE_INSTALLED_DIRECTORIES
88         ${_dir} ${_dest})
89 endfunction()
90
91 # Write CPack configuration files
92 #
93 # This function should be called at the end of the main CMakeLists.txt, after
94 # all other calls to functions in this file.
95 # CPack also automatically populates the list of components based on components
96 # used in installation rules, so it should come after all install() commands.
97 function (gmx_cpack_write_config)
98     # Set basic package information.
99     set(CPACK_PACKAGE_NAME    "gromacs")
100     set(CPACK_PACKAGE_VENDOR  "gromacs.org")
101     set(CPACK_PACKAGE_CONTACT "gmx-users@gromacs.org")
102     set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
103         "GROMACS - a toolkit for high-performance molecular simulation")
104     # Set version info.
105     set(CPACK_PACKAGE_VERSION_MAJOR ${GMX_VERSION_MAJOR})
106     set(CPACK_PACKAGE_VERSION_PATCH ${GMX_VERSION_PATCH})
107     set(CPACK_PACKAGE_VERSION       ${GMX_VERSION_STRING})
108     # Add various text resources for some installers.
109     set(CPACK_RESOURCE_FILE_WELCOME "${PROJECT_SOURCE_DIR}/admin/InstallWelcome.txt")
110     # Its GPL/LGPL, so they do not have to agree to a license for mere usage,
111     # but some installers require this...
112     set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
113     set(CPACK_RESOURCE_FILE_README  "${PROJECT_SOURCE_DIR}/admin/InstallInfo.txt")
114
115     # Our custom config file that is run by CPack for each generator, used to
116     # check for prerequisites of the packaging.
117     set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_SOURCE_DIR}/CPackInit.cmake")
118
119     # Settings specific to source packages.
120     set(CPACK_SOURCE_GENERATOR TGZ)
121     set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
122     list(APPEND FILES_NOT_INCLUDED_IN_SOURCE_PACKAGE
123         \\\\.isreposource
124         \\\\.git
125         \\\\.gitignore
126         \\\\.gitattributes
127         INSTALL-dev
128         # entry below is needed for CI not to include the cache directory
129         ccache)
130     set(CPACK_SOURCE_IGNORE_FILES ${FILES_NOT_INCLUDED_IN_SOURCE_PACKAGE})
131
132     # Get the list of directories added with gmx_cpack_add_generated_source_directory()
133     get_property(CPACK_SOURCE_INSTALLED_DIRECTORIES
134         GLOBAL PROPERTY GMX_CPACK_SOURCE_INSTALLED_DIRECTORIES)
135
136     # Propagate additional values for CPackInit.cmake to use.
137     # CPack includes all variables starting with CPACK_ into the generated
138     # config files that are included by CPack.
139     set(CPACK_GMX_BUILD_HELP "${GMX_BUILD_HELP}")
140
141     # Generate the CPack configuration files.
142     include(CPack)
143 endfunction()