OpenMesh: OpenMesh/Core/System/compiler.hh Source File

| OpenMesh

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