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
45 #ifndef OPENMESH_COMPILER_H
46 #define OPENMESH_COMPILER_H
47
48 //=============================================================================
49
50 #if defined(ACGMAKE_STATIC_BUILD)
51 # define OM_STATIC_BUILD 1
52 #endif
53
54 //=============================================================================
55
56 #if defined(_DEBUG) || defined(DEBUG)
57 # define OM_DEBUG
58 #endif
59
60 //=============================================================================
61
62 // Workaround for Intel Compiler with MS VC++ 6
63 #if defined(_MSC_VER) && \
64 ( defined(__ICL) || defined(__INTEL_COMPILER) || defined(__ICC) )
65 # if !defined(__INTEL_COMPILER)
66 # define __INTEL_COMPILER __ICL
67 # endif
68 # define OM_USE_INTEL_COMPILER 1
69 #endif
70
71 // --------------------------------------------------------- MS Visual C++ ----
72 // Compiler _MSC_VER
73 // .NET 2002 1300
74 // .NET 2003 1310
75 // .NET 2005 1400
76 #if defined(_MSC_VER) && !defined(OM_USE_INTEL_COMPILER)
77 # if (_MSC_VER == 1300)
78 # define OM_CC_MSVC
79 # define OM_TYPENAME
80 # define OM_OUT_OF_CLASS_TEMPLATE 0
81 # define OM_PARTIAL_SPECIALIZATION 0
82 # define OM_INCLUDE_TEMPLATES 1
83 # elif (_MSC_VER == 1310)
84 # define OM_CC_MSVC
85 # define OM_TYPENAME
86 # define OM_OUT_OF_CLASS_TEMPLATE 1
87 # define OM_PARTIAL_SPECIALIZATION 1
88 # define OM_INCLUDE_TEMPLATES 1
89 # elif (_MSC_VER >= 1400) // settings for .NET 2005 (NOTE: not fully tested)
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 # else
95 # error "Version 7 (.NET 2002) or higher of the MS VC++ is required!"
96 # endif
97 // currently no windows dll supported
98 # define OM_STATIC_BUILD 1
99 # if defined(_MT)
100 # define OM_REENTRANT 1
101 # endif
102 # define OM_CC "MSVC++"
103 # define OM_CC_VERSION _MSC_VER
104 // Does not work stable because the define _CPPRTTI sometimes does not exist,
105 // though the option /GR is set!?
106 # if defined(__cplusplus) && !defined(_CPPRTTI)
107 # error "Enable Runtime Type Information (Compiler Option /GR)!"
108 # endif
109 # if !defined(_USE_MATH_DEFINES)
110 # error "You have to define _USE_MATH_DEFINES in the compiler settings!"
111 # endif
112 // ------------------------------------------------------------- Borland C ----
113 #elif defined(__BORLANDC__)
114 # error "Borland Compiler are not supported yet!"
115 // ------------------------------------------------------------- GNU C/C++ ----
116 #elif defined(__GNUC__) && !defined(__ICC)
117 # define OM_CC_GCC
118 # define OM_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 )
119 # define OM_GCC_MAJOR __GNUC__
120 # define OM_GCC_MINOR __GNUC_MINOR__
121 # if (OM_GCC_VERSION >= 30200)
122 # define OM_TYPENAME typename
123 # define OM_OUT_OF_CLASS_TEMPLATE 1
124 # define OM_PARTIAL_SPECIALIZATION 1
125 # define OM_INCLUDE_TEMPLATES 1
126 # else
127 # error "Version 3.2.0 or better of the GNU Compiler is required!"
128 # endif
129 # if defined(_REENTRANT)
130 # define OM_REENTRANT 1
131 # endif
132 # define OM_CC "GCC"
133 # define OM_CC_VERSION OM_GCC_VERSION
134 // ------------------------------------------------------------- Intel icc ----
135 #elif defined(__ICC) || defined(__INTEL_COMPILER)
136 # define OM_CC_ICC
137 # define OM_TYPENAME typename
138 # define OM_OUT_OF_CLASS_TEMPLATE 1
139 # define OM_PARTIAL_SPECIALIZATION 1
140 # define OM_INCLUDE_TEMPLATES 1
141 # if defined(_REENTRANT) || defined(_MT)
142 # define OM_REENTRANT 1
143 # endif
144 # define OM_CC "ICC"
145 # define OM_CC_VERSION __INTEL_COMPILER
146 // currently no windows dll supported
147 # if defined(_MSC_VER) || defined(WIN32)
148 # define OM_STATIC_BUILD 1
149 # endif
150 // ------------------------------------------------------ MIPSpro Compiler ----
151 #elif defined(__MIPS_ISA) || defined(__mips)
152 // _MIPS_ISA
153 // _COMPILER_VERSION e.g. 730, 7 major, 3 minor
154 // _MIPS_FPSET 32|64
155 // _MIPS_SZINT 32|64
156 // _MIPS_SZLONG 32|64
157 // _MIPS_SZPTR 32|64
158 # define OM_CC_MIPS
159 # define OM_TYPENAME typename
160 # define OM_OUT_OF_CLASS_TEMPLATE 1
161 # define OM_PARTIAL_SPECIALIZATION 1
162 # define OM_INCLUDE_TEMPLATES 0
163 # define OM_CC "MIPS"
164 # define OM_CC_VERSION _COMPILER_VERSION
165 // ------------------------------------------------------------------ ???? ----
166 #else
167 # error "You're using an unsupported compiler!"
168 #endif
169
170 //=============================================================================
171 #endif // OPENMESH_COMPILER_H defined
172 //=============================================================================
173