~ubuntu-branches/ubuntu/trusty/psychtoolbox-3/trusty-proposed

« back to all changes in this revision

Viewing changes to .pc/deb_use_system_GLEW/PsychSourceGL/Source/Common/Base/PsychIncludes.h

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-11-19 23:34:50 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20131119233450-f7nf92vb8qavjmk8
Tags: 3.0.11.20131017.dfsg1-3
Upload to unsable since fresh glew has arrived to sid!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
  Psychtoolbox2/Source/Common/PsychIncludes.h           
 
2
  Psychtoolbox3/Source/Common/PsychIncludes.h           
3
3
  
4
4
  AUTHORS:
5
 
  Allen.Ingling@nyu.edu         awi 
6
 
  
 
5
 
 
6
  Allen.Ingling@nyu.edu                 awi
 
7
  mario.kleiner@tuebingen.mpg.de        mk
 
8
 
7
9
  PLATFORMS: All 
8
10
  
9
11
  PROJECTS:
21
23
  
22
24
  This file should ONLY be included by PsychConstants.h 
23
25
 
24
 
  T0 DO: 
25
 
          
26
 
 
27
26
*/
28
27
 
29
28
#ifndef PSYCH_IS_INCLUDED_PsychIncludes
31
30
 
32
31
#include "PsychPlatform.h"
33
32
 
34
 
//Includes dependent on runtime environment:
 
33
// This is needed for compiling with gcc 4.6+ if -std=gnu99
 
34
// is set, which we need to set for OML_sync_control support
 
35
// and other features. Fixes compile failure on Ubuntu 12.10:
 
36
#if defined(__STDC_UTF_16__) && !defined(CHAR16_T)
 
37
typedef __CHAR16_TYPE__ char16_t;
 
38
#endif
 
39
 
 
40
// Includes dependent on runtime environment:
35
41
#if PSYCH_LANGUAGE == PSYCH_MATLAB
36
42
    // Include File with Matlab interface API definitions:
37
43
    #include "mex.h"
40
46
// Platform independent include for glew: This is a catch-all
41
47
// for all OpenGL definitions and functions, currently up to
42
48
// OpenGL 2.1:
 
49
#if defined(PTBMODULE_Screen) || defined(PTBMODULE_FontInfo)
43
50
#include "../Screen/glew.h"
 
51
#endif
44
52
 
45
53
//platform dependent includes stage 1
46
54
#if PSYCH_SYSTEM == PSYCH_LINUX
47
 
        // We need __USE_UNIX98, so pthread.h defines/supports the mutex policy
48
 
        // attribute for mutex priority inheritance for our realtime threads.
49
 
        // For some reason this gets undefined in mex.h at least when building
50
 
        // on Octave 3.2.4. Scary scary...
51
 
        #ifndef __USE_UNIX98
52
 
        #define __USE_UNIX98
53
 
        // For testing only: #warning __USE_UNIX98 undefined. Redefining it.
54
 
        #endif
55
 
 
56
 
        #include <stdint.h>
57
 
        // This is the new glew include for GLX extension support:
58
 
        #include "../Screen/glxew.h"
59
 
        
60
 
        #include <X11/Xlib.h>
61
 
        #include <X11/keysym.h>
62
 
        #include <sys/time.h>
63
 
        #include <unistd.h>
64
 
        #include <stdarg.h>
65
 
        #include <pthread.h>
66
 
 
67
 
        #ifndef _POSIX_THREAD_PRIO_INHERIT
68
 
        #error This build system does not support pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT); Fix your build system!
69
 
        #endif
 
55
    // We need __USE_UNIX98, so pthread.h defines/supports the mutex policy
 
56
    // attribute for mutex priority inheritance for our realtime threads.
 
57
    // For some reason this gets undefined in mex.h at least when building
 
58
    // on Octave 3.2.4. Scary scary...
 
59
    #ifndef __USE_UNIX98
 
60
    #define __USE_UNIX98
 
61
    // For testing only: #warning __USE_UNIX98 undefined. Redefining it.
 
62
    #endif
 
63
 
 
64
    // This is the new glew include for GLX extension support:
 
65
#if defined(PTBMODULE_Screen)
 
66
    #include "../Screen/glxew.h"
 
67
#endif
 
68
 
 
69
    #include <X11/Xlib.h>
 
70
    #include <X11/keysym.h>
 
71
    #include <sys/time.h>
 
72
    #include <unistd.h>
 
73
    #include <stdarg.h>
 
74
    #include <pthread.h>
 
75
 
 
76
    #ifndef _POSIX_THREAD_PRIO_INHERIT
 
77
    #error This build system does not support pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT); Fix your build system!
 
78
    #endif
70
79
#endif
71
80
 
72
81
#if PSYCH_SYSTEM == PSYCH_WINDOWS
73
 
        // Need to define #define _WIN32_WINNT as 0x0400 so we can use TryEnterCriticalSection() call for PsychTryLockMutex() implementation.
 
82
        // Need to define #define _WIN32_WINNT as >= 0x0400 so we can use TryEnterCriticalSection() call for PsychTryLockMutex() implementation.
74
83
    // We set WINVER and _WIN32_WINNT to 0x0500, which requires Windows 2000 or later as target system:
75
 
        #define _WIN32_WINNT 0x0500
76
 
    #define WINVER       0x0500
77
 
        #include <windows.h>
78
 
        #include "../Screen/wglew.h"
79
 
 
80
 
    #ifndef INT64_MAX
81
 
    #define INT64_MAX _I64_MAX
82
 
    #endif
83
 
    
84
 
    #ifndef INT32_MAX
85
 
    #define INT32_MAX _I32_MAX
86
 
    #endif
87
 
 
88
 
#elif PSYCH_SYSTEM == PSYCH_OS9
89
 
        #include <Types.h>
90
 
        #include <MacTypes.h>
91
 
        #include <Events.h>
92
 
        #include <stdarg.h>
93
 
        #include <string.h>
94
 
        #include <ctype.h>
95
 
        #include "gl.h"
96
 
        #include "glu.h"
 
84
    // Ok, actually we don't. When building on a modern build system like the new Win-7 build
 
85
    // system -- or pretty much against any SDK since WindowsXP -- the MSVC compiler / platform SDK
 
86
    // already defines WINVER et al. to 0x0500 or later, e.g., to Win-7 on the Win-7 system.
 
87
    // That means we'd only need these defines on pre-WinXP build systems, which we no longer
 
88
    // support. We now just have to be careful to not use post-WinXP functionality.
 
89
    // We comment these defines out and trust the platform SDK / compiler,
 
90
    // but leave them here for quick WinXP backwards compatibility testing.
 
91
    #if 0   
 
92
        #define _WIN32_WINNT 0x0500
 
93
        #define WINVER       0x0500
 
94
    #endif // Conditional enable.
 
95
 
 
96
    // Master include for windows header file:
 
97
    #include <windows.h>
 
98
 
 
99
    // For building Screen, include wglew.h - Windows specific GLEW header files:
 
100
    #if defined(PTBMODULE_Screen)
 
101
    #include "../Screen/wglew.h"
 
102
    #endif
 
103
 
97
104
#elif PSYCH_SYSTEM == PSYCH_OSX
98
105
        //includes for Apple OpenGL
99
 
    #include <stdint.h>
100
106
    #include <sys/time.h>
101
107
        #include <pthread.h>
102
108
 
103
 
        // If we are included from PsychScriptingGlue.cc, which
104
 
        // is indicated by PTBINSCRIPTINGGLUE, then we must only
105
 
        // include MacTypes.h, not the rest of Carbon, ApplicationServices
106
 
        // et al. -> Some of the Octave header files conflict with Apple
107
 
        // system header files --> do not include the Apple headers when
108
 
        // building Scriptingglue - they are not needed but would prevent
109
 
        // the build.
110
 
        #ifndef PTBINSCRIPTINGGLUE
111
 
        // File included during compile of some PTB file other than ScriptingGlue...
112
 
        #include <Carbon/Carbon.h>
113
 
        #include <CoreServices/CoreServices.h>
114
 
        #include <ApplicationServices/ApplicationServices.h>
115
 
        #include <CoreAudio/HostTime.h>
116
 
        #else
117
 
        // File included from ScriptingGlue - only import minimal amount of headers...
118
 
        #include <CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h>
119
 
        #endif
 
109
    // If we are included from PsychScriptingGlue.cc, which
 
110
    // is indicated by PTBINSCRIPTINGGLUE, then we must only
 
111
    // include MacTypes.h, not the rest of Carbon, ApplicationServices
 
112
    // et al. -> Some of the Octave header files conflict with Apple
 
113
    // system header files --> do not include the Apple headers when
 
114
    // building Scriptingglue - they are not needed but would prevent
 
115
    // the build.
 
116
    #ifndef PTBINSCRIPTINGGLUE
 
117
    // File included during compile of some PTB file other than ScriptingGlue...
 
118
    #include <Carbon/Carbon.h>
 
119
    #include <CoreServices/CoreServices.h>
 
120
    #include <ApplicationServices/ApplicationServices.h>
 
121
    #include <CoreAudio/HostTime.h>
 
122
    #include <CoreVideo/CoreVideo.h>
 
123
    #else
 
124
    // File included from ScriptingGlue - only import minimal amount of headers...
 
125
    // MK TODO FIXME! OCTAVE!
 
126
    #include <CoreServices/CoreServices.h>
 
127
    // Does not work: #include <CarbonCore.framework/MacTypes.h>
 
128
    // Used to work on Tiger/32-Bit, but does not work now: #include <CoreServices/Frameworks/CarbonCore.framework/Headers/MacTypes.h>
 
129
    #endif
120
130
 
121
 
        #include <OpenGL/OpenGL.h>
122
 
        //#include <OpenGL/gl.h>
123
 
        //#include <OpenGL/glext.h>
124
 
        //#include <OpenGL/glu.h>
 
131
    #if defined(PTBMODULE_Screen) || defined(PTBMODULE_FontInfo)
 
132
    #include <OpenGL/OpenGL.h>
 
133
    #endif
125
134
#endif 
126
135
 
127
 
//C standard library headers
 
136
// C standard library headers:
 
137
 
 
138
// We can't include stdint.h on Windows if we build against the
 
139
// MSCRT Windows common C Runtime instead of the MSVC 2010 runtime:
 
140
#if PSYCH_SYSTEM != PSYCH_WINDOWS
 
141
#include <stdint.h>
 
142
#else
 
143
// Add defines which would be part of stdint.h on Windows:
 
144
#ifndef INT64_MAX
 
145
#define INT64_MAX       0x7fffffffffffffff
 
146
#endif
 
147
#ifndef INT32_MAX
 
148
#define INT32_MAX       0x7fffffff
 
149
#endif
 
150
#endif
 
151
 
128
152
#include <math.h>
129
153
#include <stdio.h>
130
154
#include <limits.h>
131
155
#include <string.h>
132
156
#include <float.h>
133
157
 
134
 
#if PSYCH_LANGUAGE == PSYCH_OCTAVE
135
 
// File with pseudo MATLAB interface API definitions:
136
 
// Emulates missing Matlab functions and structures...
137
 
// Stored in the Source/Octave subfolder...
138
 
    #include <octavemex.h>
139
 
#endif
140
 
 
141
 
//SDL_getenv.h includes a macro which redefines getenv() to be
142
 
//SDL getenv().   This then conflicts with the statement "using 
143
 
//std::getenv" within stdlib.h.  To avoid the conflict, include 
144
 
//SDL.h only after the standard includes above. 
145
 
//platform dependent includes stage 2
146
 
#if PSYCH_SYSTEM == PSYCH_WINDOWS
147
 
 
148
 
#elif PSYCH_SYSTEM == PSYCH_OS9
149
 
        #include "SDL.h"
150
 
#endif
151
 
 
152
158
//end include once
153
159
#endif