|
30 | 30 | *
|
31 | 31 | */
|
32 | 32 |
|
| 33 | +//---------------------------------------------------------------------------------- |
| 34 | +/*! |
| 35 | +// \file dPython.h - This file was copied from VTK and was originally named vtkPython.h |
| 36 | +// \author David Gobbi |
| 37 | +// \author Last changed by $Author: jcfr $ |
| 38 | +// \date 2012 |
| 39 | +*/ |
| 40 | +//---------------------------------------------------------------------------------- |
| 41 | + |
33 | 42 | #ifndef __PythonQtPythonInclude_h
|
34 | 43 | #define __PythonQtPythonInclude_h
|
35 | 44 |
|
|
38 | 47 | #undef _POSIX_THREADS
|
39 | 48 | #undef _XOPEN_SOURCE
|
40 | 49 |
|
| 50 | +// |
| 51 | +// Use the real python debugging library if it is provided. |
| 52 | +// Otherwise use the "documented" trick involving checking for _DEBUG |
| 53 | +// and undefined that symbol while we include Python headers. |
| 54 | +// Update: this method does not fool Microsoft Visual C++ 8 anymore; two |
| 55 | +// of its header files (crtdefs.h and use_ansi.h) check if _DEBUG was set |
| 56 | +// or not, and set flags accordingly (_CRT_MANIFEST_RETAIL, |
| 57 | +// _CRT_MANIFEST_DEBUG, _CRT_MANIFEST_INCONSISTENT). The next time the |
| 58 | +// check is performed in the same compilation unit, and the flags are found, |
| 59 | +// and error is triggered. Let's prevent that by setting _CRT_NOFORCE_MANIFEST. |
| 60 | +// |
| 61 | + |
41 | 62 | // If PYTHONQT_USE_RELEASE_PYTHON_FALLBACK is enabled, try to link
|
42 | 63 | // release Python DLL if it is available by undefining _DEBUG while
|
43 | 64 | // including Python.h
|
44 | 65 | #if defined(PYTHONQT_USE_RELEASE_PYTHON_FALLBACK) && defined(_DEBUG)
|
45 |
| -#undef _DEBUG |
46 |
| -#if defined(_MSC_VER) && _MSC_VER >= 1400 |
47 |
| -#define _CRT_NOFORCE_MANIFEST 1 |
48 |
| -#endif |
49 |
| -#include <Python.h> |
50 |
| -#define _DEBUG |
| 66 | +# undef _DEBUG |
| 67 | +// Include these low level headers before undefing _DEBUG. Otherwise when doing |
| 68 | +// a debug build against a release build of python the compiler will end up |
| 69 | +// including these low level headers without DEBUG enabled, causing it to try |
| 70 | +// and link release versions of this low level C api. |
| 71 | +# include <basetsd.h> |
| 72 | +# include <assert.h> |
| 73 | +# include <ctype.h> |
| 74 | +# include <errno.h> |
| 75 | +# include <io.h> |
| 76 | +# include <math.h> |
| 77 | +# include <sal.h> |
| 78 | +# include <stdarg.h> |
| 79 | +# include <stddef.h> |
| 80 | +# include <stdio.h> |
| 81 | +# include <stdlib.h> |
| 82 | +# include <string.h> |
| 83 | +# include <sys/stat.h> |
| 84 | +# include <time.h> |
| 85 | +# include <wchar.h> |
| 86 | +# if defined(_MSC_VER) && _MSC_VER >= 1400 |
| 87 | +# define _CRT_NOFORCE_MANIFEST 1 |
| 88 | +# endif |
| 89 | +# include <Python.h> |
| 90 | +# define _DEBUG |
51 | 91 | #else
|
52 |
| -#include <Python.h> |
| 92 | +# include <Python.h> |
53 | 93 | #endif
|
54 | 94 |
|
55 | 95 | #endif
|
0 commit comments