MFEM  v4.6.0
Finite element discretization library
config.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2023, Lawrence Livermore National Security, LLC. Produced
2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 // LICENSE and NOTICE for details. LLNL-CODE-806117.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability visit https://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11 
12 
13 // Support out-of-source builds: if MFEM_CONFIG_FILE is defined, include it.
14 //
15 // Otherwise, use the local file: _config.hpp.
16 
17 #ifndef MFEM_CONFIG_HPP
18 #define MFEM_CONFIG_HPP
19 
20 #ifdef MFEM_CONFIG_FILE
21 #include MFEM_CONFIG_FILE
22 #else
23 #include "_config.hpp"
24 #endif
25 
26 // Common configuration macros
27 
28 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) || defined(__clang__)
29 #define MFEM_HAVE_GCC_PRAGMA_DIAGNOSTIC
30 #endif
31 
32 // Windows specific options
33 #if defined(_WIN32) && !defined(_USE_MATH_DEFINES)
34 // Macro needed to get defines like M_PI from <cmath>. (Visual Studio C++ only?)
35 #define _USE_MATH_DEFINES
36 #endif
37 // Macro MFEM_EXPORT: this macro is used when declaring exported global
38 // variables and static class variables in public header files, e.g.:
39 // extern MFEM_EXPORT Geometry Geometries;
40 // static MFEM_EXPORT Device device_singleton;
41 // In cases where a class contains multiple static variables, instead of marking
42 // all such variables with MFEM_EXPORT, one can mark the class with MFEM_EXPORT,
43 // e.g.:
44 // class MFEM_EXPORT MemoryManager ...
45 // Note: MFEM's GitHub CI includes a shared MSVC build that will fail if a
46 // variable that needs MFEM_EXPORT does not have it. However, builds with
47 // optional external libraries are not tested and may require separate checks to
48 // determine the necessity of MFEM_EXPORT.
49 #if defined(_MSC_VER) && defined(MFEM_SHARED_BUILD)
50 #ifdef mfem_EXPORTS
51 #define MFEM_EXPORT __declspec(dllexport)
52 #else
53 #define MFEM_EXPORT __declspec(dllimport)
54 #endif
55 #else
56 #define MFEM_EXPORT
57 #endif
58 // On Cygwin the option -std=c++11 prevents the definition of M_PI. Defining
59 // the following macro allows us to get M_PI and some needed functions, e.g.
60 // posix_memalign(), strdup(), strerror_r().
61 #ifdef __CYGWIN__
62 #define _XOPEN_SOURCE 600
63 #endif
64 
65 // Check dependencies:
66 
67 // Options that require MPI
68 #ifndef MFEM_USE_MPI
69 #ifdef MFEM_USE_SUPERLU
70 #error Building with SuperLU_DIST (MFEM_USE_SUPERLU=YES) requires MPI (MFEM_USE_MPI=YES)
71 #endif
72 #ifdef MFEM_USE_MUMPS
73 #error Building with MUMPS (MFEM_USE_MUMPS=YES) requires MPI (MFEM_USE_MPI=YES)
74 #endif
75 #ifdef MFEM_USE_STRUMPACK
76 #error Building with STRUMPACK (MFEM_USE_STRUMPACK=YES) requires MPI (MFEM_USE_MPI=YES)
77 #endif
78 #ifdef MFEM_USE_MKL_CPARDISO
79 #error Building with MKL CPARDISO (MFEM_USE_MKL_CPARDISO=YES) requires MPI (MFEM_USE_MPI=YES)
80 #endif
81 #ifdef MFEM_USE_PETSC
82 #error Building with PETSc (MFEM_USE_PETSC=YES) requires MPI (MFEM_USE_MPI=YES)
83 #endif
84 #ifdef MFEM_USE_SLEPC
85 #error Building with SLEPc (MFEM_USE_SLEPC=YES) requires MPI (MFEM_USE_MPI=YES)
86 #endif
87 #ifdef MFEM_USE_PUMI
88 #error Building with PUMI (MFEM_USE_PUMI=YES) requires MPI (MFEM_USE_MPI=YES)
89 #endif
90 #endif // MFEM_USE_MPI not defined
91 
92 #endif // MFEM_CONFIG_HPP