root/juggler/branches/2.2/modules/gadgeteer/gadget/gadgetConfig.h

Revision 20363, 5.8 kB (checked in by patrick, 1 year ago)

Merges from the trunk:

r20345: Change the preprocessor symbols that we use for identifying debug

and optimized builds. Instead of using _DEBUG and _OPT, we now look
for JUGGLER_DEBUG and JUGGLER_OPT or module-specific identifiers
such as GADGET_DEBUG and GADGET_OPT. Using _DEBUG was a bad idea
because it is used by Visual C++ to identify when the debug runtime
is to be linked. This caused us a lot of problems over the years.

On Windows, we now support three types of builds:

  1. Optimized and linked against the release runtime
  2. Debug-enabled and linked against the release runtime (the
    "_g" variant)
  3. Debug-enabled and linked against the debug runtime (the "_d"
    variant)

Automatic linking takes care of choosing the correct .lib file as
long as _DEBUG is not defined explicitly. Instead, it should only
be defined implicitly as a result of using /MDd when compiling.
User-level code on any platform should define JUGGLER_DEBUG or the
module-specific …_DEBUG symbol to indicate that debugging
capabilities are desired.

r20357: Using /DEBUG when linking causes problems with Visual C++ 7.1 and

automatic linking when the desired outcome is to link against the
"_g" DLL variant. For some reason, /DEBUG causes linking against
both the "_g" variant and the "_d" variant, and that makes
application execution go quite poorly. Visual C++ 8.0 does not
seem to exhibit this behavior, but I have changed those .vcproj
files, too.

This change includes incidental modifications made by Visual Studio
as a result of editing the linker settings in the project files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
2  *
3  * VR Juggler is (C) Copyright 1998-2007 by Iowa State University
4  *
5  * Original Authors:
6  *   Allen Bierbaum, Christopher Just,
7  *   Patrick Hartling, Kevin Meinert,
8  *   Carolina Cruz-Neira, Albert Baker
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public
21  * License along with this library; if not, write to the
22  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23  * Boston, MA 02111-1307, USA.
24  *
25  *************** <auto-copyright.pl END do not edit this line> ***************/
26
27 #ifndef _GADGET_CONFIG_H_
28 #define _GADGET_CONFIG_H_
29 /* #pragma once */
30
31 /*
32  * ----------------------------------------------------------------------------
33  * This file (gadgetConfig.h) includes header files common to most, if not
34  * all, files in the Gadgeteer source tree.  It must be included at the top of
35  * every .h and .cpp file before any other headers because it includes system
36  * headers.
37  * ----------------------------------------------------------------------------
38  */
39
40 /* This should always be included first. */
41 #include <gadget/gadgetDefines.h>
42
43 /* Get rid of symbols added by Autoconf 2.5x. */
44 #undef PACKAGE_BUGREPORT
45 #undef PACKAGE_NAME
46 #undef PACKAGE_STRING
47 #undef PACKAGE_TARNAME
48 #undef PACKAGE_VERSION
49
50 /*
51  * If either JUGGLER_DEBUG or _DEBUG is defined, that implies the need for
52  * GADGET_DEBUG.
53  */
54 #if ! defined(GADGET_DEBUG) && (defined(JUGGLER_DEBUG) || defined(_DEBUG))
55 #   define GADGET_DEBUG
56 /* If JUGGLER_OPT is defined, make sure that GADGET_OPT is also defined. */
57 #elif defined(JUGGLER_OPT) && ! defined(GADGET_OPT)
58 #   define GADGET_OPT
59 #endif
60
61 #if defined(WIN32) || defined(WIN64)
62 /* Exclude rarely-used stuff from Windows headers */
63 #define WIN32_LEAN_AND_MEAN
64
65 /* identifier truncated to 255 characters in the debug information */
66 #pragma warning(disable:4786)
67
68 #include <windows.h>
69
70 #endif   /* WIN32 || WIN64 */
71
72 #if !defined(WIN32) && !defined(WIN64)          \
73       && defined(__GNUC__) && __GNUC__ >= 4     \
74       && !defined(GADGET_HAVE_GCC_VISIBILITY)
75 define GADGET_HAVE_GCC_VISIBILITY
76 #endif
77
78 /*
79  * ----------------------------------------------------------------------------
80  * DLL-related macros.  These are based on the macros used by NSPR.  Use
81  * GADGET_EXTERN for the prototype and GADGET_IMPLEMENT for the
82  * implementation.
83  * ----------------------------------------------------------------------------
84  */
85 #if defined(WIN32) || defined(WIN64)
86
87 #   if defined(__GNUC__)
88 #       undef _declspec
89 #       define _declspec(x) __declspec(x)
90 #   endif
91
92 #   define GADGET_EXPORT(__type)      _declspec(dllexport) __type
93 #   define GADGET_EXPORT_CLASS        _declspec(dllexport)
94 #   define GADGET_EXPORT_DATA(__type) _declspec(dllexport) __type
95 #   define GADGET_IMPORT(__type)      _declspec(dllimport) __type
96 #   define GADGET_IMPORT_DATA(__type) _declspec(dllimport) __type
97 #   define GADGET_IMPORT_CLASS        _declspec(dllimport)
98
99 #   define GADGET_EXTERN(__type)         extern _declspec(dllexport) __type
100 #   define GADGET_IMPLEMENT(__type)      _declspec(dllexport) __type
101 #   define GADGET_EXTERN_DATA(__type)    extern _declspec(dllexport) __type
102 #   define GADGET_IMPLEMENT_DATA(__type) _declspec(dllexport) __type
103
104 #   define GADGET_CALLBACK
105 #   define GADGET_CALLBACK_DECL
106 #   define GADGET_STATIC_CALLBACK(__x) static __x
107
108 #elif defined(GADGET_HAVE_GCC_VISIBILITY)
109
110 #   define GADGET_EXPORT(__type)      __attribute__ ((visibility("default"))) __type
111 #   define GADGET_EXPORT_CLASS        __attribute__ ((visibility("default")))
112 #   define GADGET_EXPORT_DATA(__type) __attribute__ ((visibility("default"))) __type
113 #   define GADGET_IMPORT(__type)      __type
114 #   define GADGET_IMPORT_DATA(__type) __type
115 #   define GADGET_IMPORT_CLASS       
116
117 #   define GADGET_EXTERN(__type)         extern __attribute__ ((visibility("default"))) __type
118 #   define GADGET_IMPLEMENT(__type)      __attribute__ ((visibility("default"))) __type
119 #   define GADGET_EXTERN_DATA(__type)    extern __attribute__ ((visibility("default"))) __type
120 #   define GADGET_IMPLEMENT_DATA(__type) __attribute__ ((visibility("default"))) __type
121
122 #   define GADGET_CALLBACK
123 #   define GADGET_CALLBACK_DECL
124 #   define GADGET_STATIC_CALLBACK(__x) static __x
125
126 #else   /* UNIX (where this stuff is simple!) */
127
128 #   define GADGET_EXPORT(__type)      __type
129 #   define GADGET_EXPORT_CLASS
130 #   define GADGET_EXPORT_DATA(__type) __type
131 #   define GADGET_IMPORT(__type)      __type
132 #   define GADGET_IMPORT_CLASS
133 #   define GADGET_IMPORT_DATA(__type) __type
134
135 #   define GADGET_EXTERN(__type)         extern __type
136 #   define GADGET_IMPLEMENT(__type)      __type
137 #   define GADGET_EXTERN_DATA(__type)    extern __type
138 #   define GADGET_IMPLEMENT_DATA(__type) __type
139
140 #   define GADGET_CALLBACK
141 #   define GADGET_CALLBACK_DECL
142 #   define GADGET_STATIC_CALLBACK(__x) static __x
143
144 #endif  /* WIN32 || WIN64 */
145
146 #ifdef _GADGET_BUILD_
147 #   define GADGET_API(__type)   GADGET_EXPORT(__type)
148 #   define GADGET_CLASS_API     GADGET_EXPORT_CLASS
149 #   define GADGET_DATA_API(__type)      GADGET_EXPORT_DATA(__type)
150 #else
151 #   define GADGET_API(__type)   GADGET_IMPORT(__type)
152 #   define GADGET_CLASS_API     GADGET_IMPORT_CLASS
153 #   define GADGET_DATA_API(__type)      GADGET_IMPORT_DATA(__type)
154
155 #   include <gadget/AutoLink.h>
156 #endif
157
158 // #define GADGET_USING_RIM_SYNC
159
160 #endif   /* _GADGET_CONFIG_H_ */
Note: See TracBrowser for help on using the browser.