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