Developer Documentation
compiler.hh
1 /* ========================================================================= *
2  * *
3  * OpenMesh *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openmesh.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenMesh. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39  * *
40  * ========================================================================= */
41 
42 /*===========================================================================*\
43  * *
44  * $Revision$ *
45  * $Date$ *
46  * *
47 \*===========================================================================*/
48 
49 
50 #ifndef OPENMESH_COMPILER_H
51 #define OPENMESH_COMPILER_H
52 
53 //=============================================================================
54 
55 #if defined(ACGMAKE_STATIC_BUILD)
56 # define OM_STATIC_BUILD 1
57 #endif
58 
59 //=============================================================================
60 
61 #if defined(_DEBUG) || defined(DEBUG)
62 # define OM_DEBUG
63 #endif
64 
65 //=============================================================================
66 
67 // Workaround for Intel Compiler with MS VC++ 6
68 #if defined(_MSC_VER) && \
69  ( defined(__ICL) || defined(__INTEL_COMPILER) || defined(__ICC) )
70 # if !defined(__INTEL_COMPILER)
71 # define __INTEL_COMPILER __ICL
72 # endif
73 # define OM_USE_INTEL_COMPILER 1
74 #endif
75 
76 // --------------------------------------------------------- MS Visual C++ ----
77 // Compiler _MSC_VER
78 // .NET 2002 1300
79 // .NET 2003 1310
80 // .NET 2005 1400
81 #if defined(_MSC_VER) && !defined(OM_USE_INTEL_COMPILER)
82 # if (_MSC_VER == 1300)
83 # define OM_CC_MSVC
84 # define OM_TYPENAME
85 # define OM_OUT_OF_CLASS_TEMPLATE 0
86 # define OM_PARTIAL_SPECIALIZATION 0
87 # define OM_INCLUDE_TEMPLATES 1
88 # elif (_MSC_VER == 1310)
89 # define OM_CC_MSVC
90 # define OM_TYPENAME
91 # define OM_OUT_OF_CLASS_TEMPLATE 1
92 # define OM_PARTIAL_SPECIALIZATION 1
93 # define OM_INCLUDE_TEMPLATES 1
94 # elif (_MSC_VER >= 1400) // settings for .NET 2005 (NOTE: not fully tested)
95 # define OM_TYPENAME
96 # define OM_OUT_OF_CLASS_TEMPLATE 1
97 # define OM_PARTIAL_SPECIALIZATION 1
98 # define OM_INCLUDE_TEMPLATES 1
99 # else
100 # error "Version 7 (.NET 2002) or higher of the MS VC++ is required!"
101 # endif
102 // currently no windows dll supported
103 # define OM_STATIC_BUILD 1
104 # if defined(_MT)
105 # define OM_REENTRANT 1
106 # endif
107 # define OM_CC "MSVC++"
108 # define OM_CC_VERSION _MSC_VER
109 // Does not work stable because the define _CPPRTTI sometimes does not exist,
110 // though the option /GR is set!?
111 # if defined(__cplusplus) && !defined(_CPPRTTI)
112 # error "Enable Runtime Type Information (Compiler Option /GR)!"
113 # endif
114 # if !defined(_USE_MATH_DEFINES)
115 # error "You have to define _USE_MATH_DEFINES in the compiler settings!"
116 # endif
117 // ------------------------------------------------------------- Borland C ----
118 #elif defined(__BORLANDC__)
119 # error "Borland Compiler are not supported yet!"
120 // ------------------------------------------------------------- GNU C/C++ ----
121 #elif defined(__GNUC__) && !defined(__ICC)
122 # define OM_CC_GCC
123 # define OM_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 )
124 # define OM_GCC_MAJOR __GNUC__
125 # define OM_GCC_MINOR __GNUC_MINOR__
126 # if (OM_GCC_VERSION >= 30200)
127 # define OM_TYPENAME typename
128 # define OM_OUT_OF_CLASS_TEMPLATE 1
129 # define OM_PARTIAL_SPECIALIZATION 1
130 # define OM_INCLUDE_TEMPLATES 1
131 # else
132 # error "Version 3.2.0 or better of the GNU Compiler is required!"
133 # endif
134 # if defined(_REENTRANT)
135 # define OM_REENTRANT 1
136 # endif
137 # define OM_CC "GCC"
138 # define OM_CC_VERSION OM_GCC_VERSION
139 // ------------------------------------------------------------- Intel icc ----
140 #elif defined(__ICC) || defined(__INTEL_COMPILER)
141 # define OM_CC_ICC
142 # define OM_TYPENAME typename
143 # define OM_OUT_OF_CLASS_TEMPLATE 1
144 # define OM_PARTIAL_SPECIALIZATION 1
145 # define OM_INCLUDE_TEMPLATES 1
146 # if defined(_REENTRANT) || defined(_MT)
147 # define OM_REENTRANT 1
148 # endif
149 # define OM_CC "ICC"
150 # define OM_CC_VERSION __INTEL_COMPILER
151 // currently no windows dll supported
152 # if defined(_MSC_VER) || defined(WIN32)
153 # define OM_STATIC_BUILD 1
154 # endif
155 // ------------------------------------------------------ MIPSpro Compiler ----
156 #elif defined(__MIPS_ISA) || defined(__mips)
157 // _MIPS_ISA
158 // _COMPILER_VERSION e.g. 730, 7 major, 3 minor
159 // _MIPS_FPSET 32|64
160 // _MIPS_SZINT 32|64
161 // _MIPS_SZLONG 32|64
162 // _MIPS_SZPTR 32|64
163 # define OM_CC_MIPS
164 # define OM_TYPENAME typename
165 # define OM_OUT_OF_CLASS_TEMPLATE 1
166 # define OM_PARTIAL_SPECIALIZATION 1
167 # define OM_INCLUDE_TEMPLATES 0
168 # define OM_CC "MIPS"
169 # define OM_CC_VERSION _COMPILER_VERSION
170 // ------------------------------------------------------------------ ???? ----
171 #else
172 # error "You're using an unsupported compiler!"
173 #endif
174 
175 //=============================================================================
176 #endif // OPENMESH_COMPILER_H defined
177 //=============================================================================
178