Essentia  2.1-beta6-dev
config.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra
3  *
4  * This file is part of Essentia
5  *
6  * Essentia is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License as published by the Free
8  * Software Foundation (FSF), either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the Affero GNU General Public License
17  * version 3 along with this program. If not, see http://www.gnu.org/licenses/
18  */
19 
20 #ifndef ESSENTIA_CONFIG_H
21 #define ESSENTIA_CONFIG_H
22 
23 #include "version.h"
24 
28 #ifndef ESSENTIA_VERSION
29 #define ESSENTIA_VERSION "Undefined"
30 #endif
31 
32 
37 #ifndef ESSENTIA_GIT_SHA
38 #define ESSENTIA_GIT_SHA "Undefined"
39 #endif
40 
41 
49 #ifndef DEBUGGING_ENABLED
50 #define DEBUGGING_ENABLED 1
51 #endif
52 
53 
59 #ifndef ESSENTIA_EXPORTS
60 #define ESSENTIA_EXPORTS 1
61 #endif
62 
63 
68 #ifndef STRIP_DOCUMENTATION
69 #define STRIP_DOCUMENTATION 0
70 #endif
71 
72 
77 #ifndef CASE_SENSITIVE
78 #define CASE_SENSITIVE 1
79 #endif
80 
81 
88 #ifndef SAFE_TYPE_COMPARISONS
89 #define SAFE_TYPE_COMPARISONS 0
90 #endif
91 
92 
100 #ifndef ALLOW_DEFAULT_PARAMETERS
101 #define ALLOW_DEFAULT_PARAMETERS 1
102 #endif
103 
107 #if __cplusplus >= 201103L
108 # define CPP_11
109 #endif
110 
114 #if defined(__MINGW__) || defined(__MINGW32__)
115 # define OS_MINGW
116 #endif
117 
118 #if (defined(_MSC_VER) || defined(_WIN32))
119 # define OS_WIN32
120 #else
121 # if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
122 # define OS_MAC
123 # elif defined(__FreeBSD__)
124 # define OS_FREEBSD
125 # else
126 # define OS_LINUX
127 # endif
128 #endif
129 
130 
131 #ifndef DOXYGEN_SHOULD_SKIP_THIS
132 
133 // some Windows peculiarities that need to be fixed
134 #ifdef OS_WIN32
135 
136  #pragma warning (disable : 4251 4275) // disable the DLL warnings...
137  #pragma warning (disable : 4244 4305 4267) // disable float<=>double conversion warnings
138  #pragma warning (disable : 4996) // XYZ was declared deprecated
139  #pragma warning (disable : 4146) // MersenneTwister.h:273 unary minus operator applied to unsigned type, result still unsigned
140  #pragma warning (disable : 4355) // this used in class initialization, but we do it in a safe way
141 
142  // tell microsoft we would like to use std::min and std::max
143  #if !defined(OS_WIN32)
144  #define NOMINMAX
145  #endif
146 
147  typedef unsigned int uint;
148 
149  #define strcasecmp _stricmp
150 
151  #include <float.h>
152 
153  // don't need this for MINGW // TODO test
154  /*
155  namespace std {
156  template <typename T>
157  inline bool isnan(T x) {
158  return _isnan(x) != 0;
159  }
160  template <typename T>
161  inline bool isinf(T x) {
162  return _finite(x) == 0;
163  }
164  } */
165 #endif // OS_WIN32
166 
167 
168 #ifdef OS_MAC
169 typedef unsigned int uint;
170 #endif // OS_MAC
171 
172 
173 // returns GCC version as a single constant, valid for both linux & mac
174 #ifndef OS_WIN32
175 # define GCC_VERSION (__GNUC__ * 10000 \
176  + __GNUC_MINOR__ * 100 \
177  + __GNUC_PATCHLEVEL__)
178 #endif // OS_WIN32
179 
180 
181 // Visibility options.
182 // Functions will not appear as part of a DSO exported objects by default
183 // unless they have been marked with an ESSENTIA_API qualifier.
184 // See http://gcc.gnu.org/wiki/Visibility for more information on the subject.
185 #ifdef OS_WIN32
186 # define ESSENTIA_DLLEXPORT __declspec(dllexport)
187 # define ESSENTIA_DLLIMPORT __declspec(dllimport)
188 #else
189 # if (GCC_VERSION >= 40000)
190 # define ESSENTIA_DLLEXPORT __attribute__ ((visibility("default")))
191 # define ESSENTIA_DLLIMPORT __attribute__ ((visibility("default")))
192 # else
193 # define ESSENTIA_DLLEXPORT
194 # define ESSENTIA_DLLIMPORT
195 # endif
196 #endif
197 
198 
199 // define ESSENTIA_EXPORTS when building the DLL, don't when importing it
200 // into your application.
201 #if ESSENTIA_EXPORTS
202 # define ESSENTIA_API ESSENTIA_DLLEXPORT
203 #else
204 # define ESSENTIA_API ESSENTIA_DLLIMPORT
205 #endif
206 
207 
208 // do we strip algorithm documentation from the resulting binary or not?
209 #if STRIP_DOCUMENTATION
210 # define DOC(x) "Unavailable"
211 #else
212 # define DOC(x) x
213 #endif
214 
215 
216 // case-insensitive or not?
217 #if CASE_SENSITIVE
218 # define string_cmp std::less<std::string>
219 # define charptr_cmp strcmp
220 #else
221 # define string_cmp case_insensitive_str_cmp
222 # define charptr_cmp strcasecmp
223 #endif
224 
225 
226 #endif // DOXYGEN_SHOULD_SKIP_THIS
227 
228 
229 #endif // ESSENTIA_CONFIG_H
unsigned int uint
Definition: types.h:49