macOS build: simplify python install for new 10.9 libraries.
[blender-staging.git] / build_files / cmake / platform / platform_apple.cmake
1 # ***** BEGIN GPL LICENSE BLOCK *****
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # The Original Code is Copyright (C) 2016, Blender Foundation
18 # All rights reserved.
19 #
20 # Contributor(s): Sergey Sharybin.
21 #
22 # ***** END GPL LICENSE BLOCK *****
23
24 # Libraries configuration for Apple.
25
26 macro(find_package_wrapper)
27 # do nothing, just satisfy the macro
28 endmacro()
29
30 if(NOT DEFINED LIBDIR)
31         if(WITH_CXX11)
32                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
33         else()
34                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
35         endif()
36 else()
37         message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
38 endif()
39 if(NOT EXISTS "${LIBDIR}/")
40         message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'")
41 endif()
42
43 if(WITH_OPENAL)
44         find_package(OpenAL)
45         if(OPENAL_FOUND)
46                 set(WITH_OPENAL ON)
47                 set(OPENAL_INCLUDE_DIR "${LIBDIR}/openal/include")
48         else()
49                 set(WITH_OPENAL OFF)
50         endif()
51 endif()
52
53 if(WITH_ALEMBIC)
54         set(ALEMBIC ${LIBDIR}/alembic)
55         set(ALEMBIC_INCLUDE_DIR ${ALEMBIC}/include)
56         set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
57         set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
58         set(ALEMBIC_LIBRARIES Alembic)
59         set(ALEMBIC_FOUND ON)
60 endif()
61
62 if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
63         set(OPENSUBDIV ${LIBDIR}/opensubdiv)
64         set(OPENSUBDIV_LIBPATH ${OPENSUBDIV}/lib)
65         find_library(OSD_LIB_CPU NAMES osdCPU PATHS ${OPENSUBDIV_LIBPATH})
66         find_library(OSD_LIB_GPU NAMES osdGPU PATHS ${OPENSUBDIV_LIBPATH})
67         set(OPENSUBDIV_INCLUDE_DIR ${OPENSUBDIV}/include)
68         set(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
69         list(APPEND OPENSUBDIV_LIBRARIES ${OSD_LIB_CPU} ${OSD_LIB_GPU})
70 endif()
71
72 if(WITH_JACK)
73         find_library(JACK_FRAMEWORK
74                 NAMES jackmp
75         )
76         set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
77         if(NOT JACK_FRAMEWORK)
78                 set(WITH_JACK OFF)
79         endif()
80 endif()
81
82 if(WITH_CODEC_SNDFILE)
83         set(SNDFILE ${LIBDIR}/sndfile)
84         set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
85         set(SNDFILE_LIBRARIES sndfile FLAC ogg vorbis vorbisenc)
86         set(SNDFILE_LIBPATH ${SNDFILE}/lib ${LIBDIR}/ffmpeg/lib)  # TODO, deprecate
87 endif()
88
89 if(WITH_PYTHON)
90         # we use precompiled libraries for py 3.5 and up by default
91         set(PYTHON_VERSION 3.5)
92         if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
93                 # normally cached but not since we include them with blender
94                 set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
95                 set(PYTHON_EXECUTABLE "${LIBDIR}/python/bin/python${PYTHON_VERSION}m")
96                 if(WITH_CXX11)
97                         set(PYTHON_LIBRARY ${LIBDIR}/python/lib/libpython${PYTHON_VERSION}m.a)
98                 else()
99                         set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
100                 endif()
101                 set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
102                 # set(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
103         else()
104                 # module must be compiled against Python framework
105                 set(_py_framework "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}")
106
107                 set(PYTHON_INCLUDE_DIR "${_py_framework}/include/python${PYTHON_VERSION}m")
108                 set(PYTHON_EXECUTABLE "${_py_framework}/bin/python${PYTHON_VERSION}m")
109                 set(PYTHON_LIBPATH "${_py_framework}/lib/python${PYTHON_VERSION}/config-${PYTHON_VERSION}m")
110                 #set(PYTHON_LIBRARY python${PYTHON_VERSION})
111                 #set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework Python")  # won't  build with this enabled
112
113                 unset(_py_framework)
114         endif()
115
116         # uncached vars
117         set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
118         set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
119
120         # needed for Audaspace, numpy is installed into python site-packages
121         set(NUMPY_INCLUDE_DIRS "${PYTHON_LIBPATH}/site-packages/numpy/core/include")
122
123         if(NOT EXISTS "${PYTHON_EXECUTABLE}")
124                 message(FATAL_ERROR "Python executable missing: ${PYTHON_EXECUTABLE}")
125         endif()
126 endif()
127
128 if(WITH_FFTW3)
129         set(FFTW3 ${LIBDIR}/fftw3)
130         set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
131         set(FFTW3_LIBRARIES fftw3)
132         set(FFTW3_LIBPATH ${FFTW3}/lib)
133 endif()
134
135 set(PNG_LIBRARIES png)
136 set(JPEG_LIBRARIES jpeg)
137
138 set(ZLIB /usr)
139 set(ZLIB_INCLUDE_DIRS "${ZLIB}/include")
140 set(ZLIB_LIBRARIES z bz2)
141
142 set(FREETYPE ${LIBDIR}/freetype)
143 set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
144 set(FREETYPE_LIBPATH ${FREETYPE}/lib)
145 set(FREETYPE_LIBRARY freetype)
146
147 if(WITH_IMAGE_OPENEXR)
148         set(OPENEXR ${LIBDIR}/openexr)
149         set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
150         set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR}/include/OpenEXR)
151         if(WITH_CXX11)
152                 set(OPENEXR_POSTFIX -2_2)
153         else()
154                 set(OPENEXR_POSTFIX)
155         endif()
156         set(OPENEXR_LIBRARIES
157                 Iex${OPENEXR_POSTFIX}
158                 Half
159                 IlmImf${OPENEXR_POSTFIX}
160                 Imath${OPENEXR_POSTFIX}
161                 IlmThread${OPENEXR_POSTFIX})
162         set(OPENEXR_LIBPATH ${OPENEXR}/lib)
163 endif()
164
165 if(WITH_CODEC_FFMPEG)
166         set(FFMPEG ${LIBDIR}/ffmpeg)
167         set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
168         set(FFMPEG_LIBRARIES
169                 avcodec avdevice avformat avutil
170                 mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg
171         )
172         if(WITH_CXX11)
173                 set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} schroedinger orc vpx webp swresample)
174         endif()
175         set(FFMPEG_LIBPATH ${FFMPEG}/lib)
176 endif()
177
178 if(WITH_OPENJPEG OR WITH_CODEC_FFMPEG)
179         # use openjpeg from libdir that is linked into ffmpeg
180         if(WITH_CXX11)
181                 set(OPENJPEG ${LIBDIR}/openjpeg)
182                 set(WITH_SYSTEM_OPENJPEG ON)
183                 set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG}/include)
184                 set(OPENJPEG_LIBRARIES ${OPENJPEG}/lib/libopenjpeg.a)
185         endif()
186 endif()
187
188 find_library(SYSTEMSTUBS_LIBRARY
189         NAMES
190         SystemStubs
191         PATHS
192 )
193 mark_as_advanced(SYSTEMSTUBS_LIBRARY)
194 if(SYSTEMSTUBS_LIBRARY)
195         list(APPEND PLATFORM_LINKLIBS SystemStubs)
196 endif()
197
198 set(PLATFORM_CFLAGS "-pipe -funsigned-char")
199 set(PLATFORM_LINKFLAGS
200         "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio"
201 )
202 if(WITH_CODEC_QUICKTIME)
203         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QTKit")
204         if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
205                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
206                 # libSDL still needs 32bit carbon quicktime
207         endif()
208 endif()
209
210 if(WITH_CXX11)
211         list(APPEND PLATFORM_LINKLIBS c++)
212 else()
213         list(APPEND PLATFORM_LINKLIBS stdc++)
214 endif()
215
216 if(WITH_JACK)
217         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework jackmp")
218 endif()
219
220 if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
221         # force cmake to link right framework
222         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")
223 endif()
224
225 if(WITH_OPENCOLLADA)
226         set(OPENCOLLADA ${LIBDIR}/opencollada)
227
228         set(OPENCOLLADA_INCLUDE_DIRS
229                 ${LIBDIR}/opencollada/include/COLLADAStreamWriter
230                 ${LIBDIR}/opencollada/include/COLLADABaseUtils
231                 ${LIBDIR}/opencollada/include/COLLADAFramework
232                 ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader
233                 ${LIBDIR}/opencollada/include/GeneratedSaxParser
234         )
235
236         set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
237         set(OPENCOLLADA_LIBRARIES
238                 OpenCOLLADASaxFrameworkLoader
239                 -lOpenCOLLADAFramework
240                 -lOpenCOLLADABaseUtils
241                 -lOpenCOLLADAStreamWriter
242                 -lMathMLSolver
243                 -lGeneratedSaxParser
244                 -lxml2 -lbuffer -lftoa
245         )
246         # Use UTF functions from collada if LLVM is not enabled
247         if(NOT WITH_LLVM)
248                 list(APPEND OPENCOLLADA_LIBRARIES -lUTF)
249         endif()
250         # pcre is bundled with openCollada
251         #set(PCRE ${LIBDIR}/pcre)
252         #set(PCRE_LIBPATH ${PCRE}/lib)
253         set(PCRE_LIBRARIES pcre)
254         #libxml2 is used
255         #set(EXPAT ${LIBDIR}/expat)
256         #set(EXPAT_LIBPATH ${EXPAT}/lib)
257         set(EXPAT_LIB)
258 endif()
259
260 if(WITH_SDL)
261         set(SDL ${LIBDIR}/sdl)
262         set(SDL_INCLUDE_DIR ${SDL}/include)
263         set(SDL_LIBRARY SDL2)
264         set(SDL_LIBPATH ${SDL}/lib)
265         if(WITH_CXX11)
266                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework ForceFeedback")
267         else()
268                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lazy_framework ForceFeedback")
269         endif()
270 endif()
271
272 set(PNG "${LIBDIR}/png")
273 set(PNG_INCLUDE_DIRS "${PNG}/include")
274 set(PNG_LIBPATH ${PNG}/lib)
275
276 set(JPEG "${LIBDIR}/jpeg")
277 set(JPEG_INCLUDE_DIR "${JPEG}/include")
278 set(JPEG_LIBPATH ${JPEG}/lib)
279
280 if(WITH_IMAGE_TIFF)
281         set(TIFF ${LIBDIR}/tiff)
282         set(TIFF_INCLUDE_DIR ${TIFF}/include)
283         set(TIFF_LIBRARY tiff)
284         set(TIFF_LIBPATH ${TIFF}/lib)
285 endif()
286
287 if(WITH_BOOST)
288         set(BOOST ${LIBDIR}/boost)
289         set(BOOST_INCLUDE_DIR ${BOOST}/include)
290         if(WITH_CXX11)
291                 set(BOOST_POSTFIX)
292         else()
293                 set(BOOST_POSTFIX -mt)
294         endif()
295         set(BOOST_LIBRARIES
296                 boost_date_time${BOOST_POSTFIX}
297                 boost_filesystem${BOOST_POSTFIX}
298                 boost_regex${BOOST_POSTFIX}
299                 boost_system${BOOST_POSTFIX}
300                 boost_thread${BOOST_POSTFIX}
301                 boost_wave${BOOST_POSTFIX}
302         )
303         if(WITH_INTERNATIONAL)
304                 list(APPEND BOOST_LIBRARIES boost_locale${BOOST_POSTFIX})
305         endif()
306         if(WITH_CYCLES_NETWORK)
307                 list(APPEND BOOST_LIBRARIES boost_serialization${BOOST_POSTFIX})
308         endif()
309         if(WITH_OPENVDB)
310                 list(APPEND BOOST_LIBRARIES boost_iostreams${BOOST_POSTFIX})
311         endif()
312         set(BOOST_LIBPATH ${BOOST}/lib)
313         set(BOOST_DEFINITIONS)
314 endif()
315
316 if(WITH_INTERNATIONAL OR WITH_CODEC_FFMPEG)
317         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -liconv") # boost_locale and ffmpeg needs it !
318 endif()
319
320 if(WITH_OPENIMAGEIO)
321         set(OPENIMAGEIO ${LIBDIR}/openimageio)
322         set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
323         set(OPENIMAGEIO_LIBRARIES
324                 ${OPENIMAGEIO}/lib/libOpenImageIO.a
325                 ${PNG_LIBRARIES}
326                 ${JPEG_LIBRARIES}
327                 ${TIFF_LIBRARY}
328                 ${OPENEXR_LIBRARIES}
329                 ${ZLIB_LIBRARIES}
330         )
331         if(WITH_CXX11)
332                 set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${LIBDIR}/ffmpeg/lib/libwebp.a)
333         endif()
334         set(OPENIMAGEIO_LIBPATH
335                 ${OPENIMAGEIO}/lib
336                 ${JPEG_LIBPATH}
337                 ${PNG_LIBPATH}
338                 ${TIFF_LIBPATH}
339                 ${OPENEXR_LIBPATH}
340                 ${ZLIB_LIBPATH}
341         )
342         set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
343         set(OPENIMAGEIO_IDIFF "${LIBDIR}/openimageio/bin/idiff")
344 endif()
345
346 if(WITH_OPENCOLORIO)
347         set(OPENCOLORIO ${LIBDIR}/opencolorio)
348         set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
349         set(OPENCOLORIO_LIBRARIES OpenColorIO tinyxml yaml-cpp)
350         set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
351 endif()
352
353 if(WITH_OPENVDB)
354         set(OPENVDB ${LIBDIR}/openvdb)
355         set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
356         set(TBB_INCLUDE_DIRS ${LIBDIR}/tbb/include)
357         set(TBB_LIBRARIES ${LIBDIR}/tbb/lib/libtbb.a)
358         set(OPENVDB_LIBRARIES openvdb blosc ${TBB_LIBRARIES})
359         set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
360         set(OPENVDB_DEFINITIONS)
361 endif()
362
363 if(WITH_LLVM)
364         set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH     "Path to the LLVM installation")
365         set(LLVM_VERSION "3.4" CACHE STRING     "Version of LLVM to use")
366         if(EXISTS "${LLVM_ROOT_DIR}/bin/llvm-config")
367                 set(LLVM_CONFIG "${LLVM_ROOT_DIR}/bin/llvm-config")
368         else()
369                 set(LLVM_CONFIG llvm-config)
370         endif()
371         execute_process(COMMAND ${LLVM_CONFIG} --version
372                         OUTPUT_VARIABLE LLVM_VERSION
373                         OUTPUT_STRIP_TRAILING_WHITESPACE)
374         execute_process(COMMAND ${LLVM_CONFIG} --prefix
375                         OUTPUT_VARIABLE LLVM_ROOT_DIR
376                         OUTPUT_STRIP_TRAILING_WHITESPACE)
377         execute_process(COMMAND ${LLVM_CONFIG} --libdir
378                         OUTPUT_VARIABLE LLVM_LIBPATH
379                         OUTPUT_STRIP_TRAILING_WHITESPACE)
380         find_library(LLVM_LIBRARY
381                       NAMES LLVMAnalysis # first of a whole bunch of libs to get
382                       PATHS ${LLVM_LIBPATH})
383
384         if(LLVM_LIBRARY AND LLVM_ROOT_DIR AND LLVM_LIBPATH)
385                 if(LLVM_STATIC)
386                         # if static LLVM libraries were requested, use llvm-config to generate
387                         # the list of what libraries we need, and substitute that in the right
388                         # way for LLVM_LIBRARY.
389                         execute_process(COMMAND ${LLVM_CONFIG} --libfiles
390                                         OUTPUT_VARIABLE LLVM_LIBRARY
391                                         OUTPUT_STRIP_TRAILING_WHITESPACE)
392                         string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
393                 else()
394                         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lLLVM-3.4")
395                 endif()
396         else()
397                 message(FATAL_ERROR "LLVM not found.")
398         endif()
399 endif()
400
401 if(WITH_CYCLES_OSL)
402         set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
403
404         find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
405         find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
406         find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
407         # WARNING! depends on correct order of OSL libs linking
408         list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -force_load ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
409         find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
410         find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
411
412         if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER)
413                 set(OSL_FOUND TRUE)
414         else()
415                 message(STATUS "OSL not found")
416                 set(WITH_CYCLES_OSL OFF)
417         endif()
418 endif()
419
420 if(WITH_OPENMP)
421         execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE COMPILER_VENDOR)
422         string(SUBSTRING "${COMPILER_VENDOR}" 0 5 VENDOR_NAME) # truncate output
423         if(${VENDOR_NAME} MATCHES "Apple") # Apple does not support OpenMP reliable with gcc and not with clang
424                 set(WITH_OPENMP OFF)
425         else() # vanilla gcc or clang_omp support OpenMP
426                 message(STATUS "Using special OpenMP enabled compiler !") # letting find_package(OpenMP) module work for gcc
427                 if(CMAKE_C_COMPILER_ID MATCHES "Clang") # clang-omp in darwin libs
428                         set(OPENMP_FOUND ON)
429                         set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "C compiler flags for OpenMP parallization" FORCE)
430                         set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "C++ compiler flags for OpenMP parallization" FORCE)
431                         include_directories(${LIBDIR}/openmp/include)
432                         link_directories(${LIBDIR}/openmp/lib)
433                         # This is a workaround for our helperbinaries ( datatoc, masgfmt, ... ),
434                         # They are linked also to omp lib, so we need it in builddir for runtime exexcution,
435                         # TODO: remove all unneeded dependencies from these
436
437                         # for intermediate binaries, in respect to lib ID
438                         execute_process(
439                                 COMMAND ditto -arch ${CMAKE_OSX_ARCHITECTURES}
440                                 ${LIBDIR}/openmp/lib/libiomp5.dylib
441                                 ${CMAKE_BINARY_DIR}/Resources/lib/libiomp5.dylib)
442                 endif()
443         endif()
444 endif()
445
446 set(EXETYPE MACOSX_BUNDLE)
447
448 set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
449 set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
450 if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "i386")
451         set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
452         set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic  -msse -msse2 -msse3 -mssse3")
453         if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
454                 set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ftree-vectorize  -fvariable-expansion-in-unroller")
455                 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize  -fvariable-expansion-in-unroller")
456         endif()
457 else()
458         set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
459         set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
460 endif()
461
462 if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
463         # Xcode 5 is always using CLANG, which has too low template depth of 128 for libmv
464         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024")
465 endif()
466 # Get rid of eventually clashes, we export some symbols explicite as local
467 set(PLATFORM_LINKFLAGS
468         "${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker ${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map"
469 )
470
471 if(WITH_CXX11)
472         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
473         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -stdlib=libc++")
474 endif()
475
476 # Suppress ranlib "has no symbols" warnings (workaround for T48250)
477 set(CMAKE_C_ARCHIVE_CREATE   "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
478 set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
479 set(CMAKE_C_ARCHIVE_FINISH   "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
480 set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")