2 MESSAGE(STATUS "Update Compiler Settings")
4 IF(CMAKE_COMPILER_IS_GNUCC)
9 SET(OSG_GCC_FPMATHOPT "-mfpmath=sse")
11 SET(OSG_GCC_FPMATHOPT "")
14 IF(OSG_ENABLE_SSE2 AND NOT OSG_ENABLE_SSE4)
16 MESSAGE(STATUS "Apply sse2 settings")
19 STRING(REGEX MATCH "-msse2 ${OSG_GCC_FPMATHOPT}"
20 SSE2_CXX_RES ${CMAKE_CXX_FLAGS})
21 ENDIF(CMAKE_CXX_FLAGS)
24 STRING(REGEX MATCH "-msse2 ${OSG_GCC_FPMATHOPT}"
25 SSE2_C_RES ${CMAKE_C_FLAGS})
29 SET(TMP_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 ${OSG_GCC_FPMATHOPT}")
32 SET(CMAKE_CXX_FLAGS ${TMP_CXX_FLAGS}
33 CACHE STRING "OpenSG defaults" FORCE )
34 ENDIF(NOT SSE2_CXX_RES)
37 SET(TMP_C_FLAGS "${CMAKE_C_FLAGS} -msse2 ${OSG_GCC_FPMATHOPT}")
40 SET(CMAKE_C_FLAGS ${TMP_C_FLAGS}
41 CACHE STRING "OpenSG defaults" FORCE )
45 ELSE(OSG_ENABLE_SSE2 AND NOT OSG_ENABLE_SSE4)
47 MESSAGE(STATUS "Remove sse2 settings")
50 STRING(REPLACE " -msse2 ${OSG_GCC_FPMATHOPT}" ""
51 TMP_CXX_FLAGS ${CMAKE_CXX_FLAGS})
52 ENDIF(CMAKE_CXX_FLAGS)
55 STRING(REPLACE " -msse2 ${OSG_GCC_FPMATHOPT}" ""
56 TMP_C_FLAGS ${CMAKE_C_FLAGS})
59 SET(CMAKE_CXX_FLAGS ${TMP_CXX_FLAGS}
60 CACHE STRING "OpenSG defaults" FORCE )
61 SET(CMAKE_C_FLAGS ${TMP_C_FLAGS}
62 CACHE STRING "OpenSG defaults" FORCE )
64 ENDIF(OSG_ENABLE_SSE2 AND NOT OSG_ENABLE_SSE4)
68 MESSAGE(STATUS "Apply sse4 settings")
70 IF(NOT OSG_SSE4_VARIANT)
71 SET(OSG_SSE4_VARIANT "4.1" CACHE STRING "")
76 "-msse${OSG_SSE4_VARIANT} ${OSG_GCC_FPMATHOPT}"
77 SSE4_CXX_RES ${CMAKE_CXX_FLAGS} )
78 ENDIF(CMAKE_CXX_FLAGS)
82 "-msse${OSG_SSE4_VARIANT} ${OSG_GCC_FPMATHOPT}"
83 SSE4_C_RES ${CMAKE_C_FLAGS} )
88 "${CMAKE_CXX_FLAGS} -msse${OSG_SSE4_VARIANT} ${OSG_GCC_FPMATHOPT}")
91 SET(CMAKE_CXX_FLAGS ${TMP_CXX_FLAGS}
92 CACHE STRING "OpenSG defaults" FORCE )
93 ENDIF(NOT SSE4_CXX_RES)
97 "${CMAKE_C_FLAGS} -msse${OSG_SSE4_VARIANT} ${OSG_GCC_FPMATHOPT}")
100 SET(CMAKE_C_FLAGS ${TMP_C_FLAGS}
101 CACHE STRING "OpenSG defaults" FORCE )
102 ENDIF(NOT SSE4_C_RES)
105 ELSE(OSG_ENABLE_SSE4)
107 MESSAGE(STATUS "Remove sse4 settings")
111 "-msse${OSG_SSE4_VARIANT} ${OSG_GCC_FPMATHOPT}" ""
112 TMP_CXX_FLAGS ${CMAKE_CXX_FLAGS} )
113 ENDIF(CMAKE_CXX_FLAGS)
117 "-msse${OSG_SSE4_VARIANT} ${OSG_GCC_FPMATHOPT}" ""
118 TMP_C_FLAGS ${CMAKE_C_FLAGS} )
121 SET(CMAKE_CXX_FLAGS ${TMP_CXX_FLAGS}
122 CACHE STRING "OpenSG defaults" FORCE )
123 SET(CMAKE_C_FLAGS ${TMP_C_FLAGS}
124 CACHE STRING "OpenSG defaults" FORCE )
126 ENDIF(OSG_ENABLE_SSE4)
130 MESSAGE(STATUS "Apply avx settings")
132 IF(NOT OSG_AVX_VARIANT)
133 SET(OSG_AVX_VARIANT "" CACHE STRING "")
137 STRING(REGEX MATCH "-mavx${OSG_AVX_VARIANT}"
138 AVX_CXX_RES ${CMAKE_CXX_FLAGS})
139 ENDIF(CMAKE_CXX_FLAGS)
142 STRING(REGEX MATCH "-mavx${OSG_AVX_VARIANT}"
143 AVX_C_RES ${CMAKE_C_FLAGS} )
148 "${CMAKE_CXX_FLAGS} -mavx${OSG_AVX_VARIANT}")
151 SET(CMAKE_CXX_FLAGS ${TMP_CXX_FLAGS}
152 CACHE STRING "OpenSG defaults" FORCE )
153 ENDIF(NOT AVX_CXX_RES)
157 "${CMAKE_C_FLAGS} -mavx${OSG_AVX_VARIANT}")
160 SET(CMAKE_C_FLAGS ${TMP_C_FLAGS}
161 CACHE STRING "OpenSG defaults" FORCE )
167 MESSAGE(STATUS "Remove avx settings")
170 STRING(REPLACE " -mavx${OSG_AVX_VARIANT}" ""
171 TMP_CXX_FLAGS ${CMAKE_CXX_FLAGS})
172 ENDIF(CMAKE_CXX_FLAGS)
175 STRING(REPLACE " -mavx${OSG_AVX_VARIANT}" ""
176 TMP_C_FLAGS ${CMAKE_C_FLAGS})
179 SET(CMAKE_CXX_FLAGS ${TMP_CXX_FLAGS}
180 CACHE STRING "OpenSG defaults" FORCE )
181 SET(CMAKE_C_FLAGS ${TMP_C_FLAGS}
182 CACHE STRING "OpenSG defaults" FORCE )
184 ENDIF(OSG_ENABLE_AVX)
188 MESSAGE(STATUS "Apply fma settings")
191 STRING(REGEX MATCH "-mfma"
192 FMA_CXX_RES ${CMAKE_CXX_FLAGS})
193 ENDIF(CMAKE_CXX_FLAGS)
196 STRING(REGEX MATCH "-mfma"
197 FMA_C_RES ${CMAKE_C_FLAGS} )
202 "${CMAKE_CXX_FLAGS} -mfma")
205 SET(CMAKE_CXX_FLAGS ${TMP_CXX_FLAGS}
206 CACHE STRING "OpenSG defaults" FORCE )
207 ENDIF(NOT FMA_CXX_RES)
211 "${CMAKE_C_FLAGS} -mfma")
214 SET(CMAKE_C_FLAGS ${TMP_C_FLAGS}
215 CACHE STRING "OpenSG defaults" FORCE )
221 MESSAGE(STATUS "Remove fma settings")
224 STRING(REPLACE " -mfma" ""
225 TMP_CXX_FLAGS ${CMAKE_CXX_FLAGS})
226 ENDIF(CMAKE_CXX_FLAGS)
229 STRING(REPLACE " -mfma" ""
230 TMP_C_FLAGS ${CMAKE_C_FLAGS})
233 SET(CMAKE_CXX_FLAGS ${TMP_CXX_FLAGS}
234 CACHE STRING "OpenSG defaults" FORCE )
235 SET(CMAKE_C_FLAGS ${TMP_C_FLAGS}
236 CACHE STRING "OpenSG defaults" FORCE )
238 ENDIF(OSG_ENABLE_FMA)
242 MESSAGE(STATUS "Apply abi6 settings")
245 STRING(REGEX MATCH "-fabi-version=6"
246 ABI6_CXX_RES ${CMAKE_CXX_FLAGS})
247 ENDIF(CMAKE_CXX_FLAGS)
250 STRING(REGEX MATCH "-fabi-version=6"
251 ABI6_C_RES ${CMAKE_C_FLAGS})
255 SET(TMP_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fabi-version=6")
258 SET(CMAKE_CXX_FLAGS ${TMP_CXX_FLAGS}
259 CACHE STRING "OpenSG defaults" FORCE )
260 ENDIF(NOT ABI6_CXX_RES)
263 SET(TMP_C_FLAGS "${CMAKE_C_FLAGS} -fabi-version=6")
266 SET(CMAKE_C_FLAGS ${TMP_C_FLAGS}
267 CACHE STRING "OpenSG defaults" FORCE )
268 ENDIF(NOT ABI6_C_RES)
271 ELSE(OSG_ENABLE_ABI6)
273 MESSAGE(STATUS "Remove abi6 settings")
276 STRING(REPLACE " -fabi-version=6" ""
277 TMP_CXX_FLAGS ${CMAKE_CXX_FLAGS})
278 ENDIF(CMAKE_CXX_FLAGS)
281 STRING(REPLACE " -fabi-version=6" ""
282 TMP_C_FLAGS ${CMAKE_C_FLAGS})
285 SET(CMAKE_CXX_FLAGS ${TMP_CXX_FLAGS}
286 CACHE STRING "OpenSG defaults" FORCE )
287 SET(CMAKE_C_FLAGS ${TMP_C_FLAGS}
288 CACHE STRING "OpenSG defaults" FORCE )
290 ENDIF(OSG_ENABLE_ABI6)
292 ENDIF(LINUX OR APPLE)
295 STRING(REGEX MATCH "__STDC_FORMAT_MACROS"
296 STDFORMAT_CXX_RES ${CMAKE_CXX_FLAGS})
297 ENDIF(CMAKE_CXX_FLAGS)
300 STRING(REGEX MATCH "__STDC_FORMAT_MACROS"
301 STDFORMAT_C_RES ${CMAKE_C_FLAGS})
304 IF(NOT STDFORMAT_CXX_RES)
305 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS"
306 CACHE STRING "OpenSG defaults" FORCE )
307 ENDIF(NOT STDFORMAT_CXX_RES)
309 IF(NOT STDFORMAT_C_RES)
310 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__STDC_FORMAT_MACROS"
311 CACHE STRING "OpenSG defaults" FORCE )
312 ENDIF(NOT STDFORMAT_C_RES)
318 IF(CMAKE_BUILD_TYPE STREQUAL "DebugGV" OR CMAKE_BUILD_TYPE STREQUAL "ReleaseGV")
319 SET(OSG_ADD_CXX_FLAGS " -Wall -Wextra -Wno-unused-parameter")
320 SET(OSG_ADD_C_FLAGS " -Wall -Wextra -Wno-unused-parameter")
322 IF(CMAKE_BUILD_TYPE STREQUAL "ReleaseGV")
323 SET(OSG_ADD_CXX_FLAGS " ${OSG_ADD_CXX_FLAGS} -Wno-strict-aliasing")
324 ENDIF(CMAKE_BUILD_TYPE STREQUAL "ReleaseGV")
326 SET(OSG_ADD_CXX_FLAGS )
327 SET(OSG_ADD_C_FLAGS )
330 ENDIF(CMAKE_COMPILER_IS_GNUCC)
333 IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
334 ADD_DEFINITIONS("-D_CRT_SECURE_NO_DEPRECATE")
335 ADD_DEFINITIONS("-D_CRT_SECURE_NO_WARNINGS")
336 ADD_DEFINITIONS("-D_CRT_NONSTDC_NO_DEPRECATE")
337 ADD_DEFINITIONS("-D_SECURE_SCL=0")
338 ADD_DEFINITIONS("-D_SCL_SECURE_NO_WARNINGS")
339 ADD_DEFINITIONS("-D_SCL_SECURE_NO_DEPRECATE")
341 IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX_DEBUG)
343 IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX_RELEASE)
347 IF(OSG_DISABLE_MS_ITERATOR_DEBUGGING)
348 ADD_DEFINITIONS("-D_HAS_ITERATOR_DEBUGGING=0")
349 ENDIF(OSG_DISABLE_MS_ITERATOR_DEBUGGING)