CMake SYCL & Intel OpenMP handling
[gromacs.git] / src / gmxpre.h
blob10353266f1ab3413e1dc930ef242265c41bb334e
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2014,2018,2019, 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 /*! \libinternal \file
36 * \brief
37 * Prerequisite header file for \Gromacs build.
39 * This header should be included as the first header in all source files, but
40 * not in header files. It is intended to contain definitions that must appear
41 * before any other code to work properly (e.g., macro definitions that
42 * influence behavior of system headers). This frees other code from include
43 * order dependencies that may raise from requirements of getting these
44 * definitions from some header.
46 * The definitions here should be kept to a minimum, and should be as static as
47 * possible (typically not change as a result of user choices in the build
48 * system), as any change will trigger a full rebuild. Avoid including any
49 * actual headers to not hide problems with include-what-you-use, and to keep
50 * build times to a minimum. Also, installer headers should avoid relying on
51 * the definitions from here (if possible), as this header will not be
52 * available to the user.
54 * \inlibraryapi
56 //! \cond
57 #ifdef HAVE_CONFIG_H
58 # include "gmxpre-config.h"
59 #endif
61 /* We use a few GNU functions for thread affinity and other low-level stuff.
62 * However, all such uses should be accompanied by #ifdefs and a feature test
63 * at CMake level, so that the actual uses will be compiled only when available.
64 * But since the define affects system headers, it should be defined before
65 * including any system headers, and this is a robust location to do that.
66 * If this were defined only in source files that needed it, it would clutter
67 * the list of includes somewhere close to the beginning and make automatic
68 * sorting of the includes more difficult.
70 #ifndef _GNU_SOURCE
71 # define _GNU_SOURCE 1
72 #endif
74 /* Some C++(?) compilers require these to be defined to get the integer limits
75 * and format specifier macros from stdint.h and inttypes.h, respectively.
76 * The macros are in C99 and C++11, but not in C++98...
77 * As with _GNU_SOURCE, these need to be defined before these headers get first
78 * included. Unlike _GNU_SOURCE, these headers are included indirectly in most
79 * header and source files (even though the macros are not used that often), so
80 * there is no easy alternative to defining them here, either.
81 * If someone happens to use such a compiler to compile against the installed
82 * Gromacs headers, they need for now take care to define the macros themselves
83 * (as there is no way Gromacs can do that consistently).
85 #define __STDC_LIMIT_MACROS
86 #define __STDC_FORMAT_MACROS
88 #if GMX_FAHCORE
89 # define FULLINDIRECT 1
90 # define USE_FAH_XDR 1
91 # include "swindirect.h"
92 #endif
93 //! \endcond