platform_apple.cmake 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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. # ***** END GPL LICENSE BLOCK *****
  20. # Libraries configuration for Apple.
  21. set(MACOSX_DEPLOYMENT_TARGET "10.11")
  22. macro(find_package_wrapper)
  23. # do nothing, just satisfy the macro
  24. endmacro()
  25. if(NOT DEFINED LIBDIR)
  26. set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
  27. # Prefer lib directory paths
  28. file(GLOB LIB_SUBDIRS ${LIBDIR}/*)
  29. set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS})
  30. else()
  31. message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
  32. endif()
  33. if(NOT EXISTS "${LIBDIR}/")
  34. message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'")
  35. endif()
  36. if(WITH_OPENAL)
  37. find_package(OpenAL)
  38. if(OPENAL_FOUND)
  39. set(WITH_OPENAL ON)
  40. else()
  41. set(WITH_OPENAL OFF)
  42. endif()
  43. endif()
  44. if(WITH_ALEMBIC)
  45. set(ALEMBIC ${LIBDIR}/alembic)
  46. set(ALEMBIC_INCLUDE_DIR ${ALEMBIC}/include)
  47. set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
  48. set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
  49. set(ALEMBIC_LIBRARIES Alembic)
  50. set(ALEMBIC_FOUND ON)
  51. endif()
  52. if(WITH_OPENSUBDIV)
  53. set(OPENSUBDIV ${LIBDIR}/opensubdiv)
  54. set(OPENSUBDIV_LIBPATH ${OPENSUBDIV}/lib)
  55. find_library(OSD_LIB_CPU NAMES osdCPU PATHS ${OPENSUBDIV_LIBPATH})
  56. find_library(OSD_LIB_GPU NAMES osdGPU PATHS ${OPENSUBDIV_LIBPATH})
  57. set(OPENSUBDIV_INCLUDE_DIR ${OPENSUBDIV}/include)
  58. set(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
  59. list(APPEND OPENSUBDIV_LIBRARIES ${OSD_LIB_CPU} ${OSD_LIB_GPU})
  60. endif()
  61. if(WITH_JACK)
  62. find_library(JACK_FRAMEWORK
  63. NAMES jackmp
  64. )
  65. set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
  66. if(NOT JACK_FRAMEWORK)
  67. set(WITH_JACK OFF)
  68. endif()
  69. endif()
  70. if(WITH_CODEC_SNDFILE)
  71. set(LIBSNDFILE ${LIBDIR}/sndfile)
  72. set(LIBSNDFILE_INCLUDE_DIRS ${LIBSNDFILE}/include)
  73. set(LIBSNDFILE_LIBRARIES sndfile FLAC ogg vorbis vorbisenc)
  74. set(LIBSNDFILE_LIBPATH ${LIBSNDFILE}/lib ${LIBDIR}/ffmpeg/lib) # TODO, deprecate
  75. endif()
  76. if(WITH_PYTHON)
  77. # we use precompiled libraries for py 3.7 and up by default
  78. set(PYTHON_VERSION 3.7)
  79. if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
  80. # normally cached but not since we include them with blender
  81. set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
  82. set(PYTHON_EXECUTABLE "${LIBDIR}/python/bin/python${PYTHON_VERSION}m")
  83. set(PYTHON_LIBRARY ${LIBDIR}/python/lib/libpython${PYTHON_VERSION}m.a)
  84. set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
  85. # set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
  86. else()
  87. # module must be compiled against Python framework
  88. set(_py_framework "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}")
  89. set(PYTHON_INCLUDE_DIR "${_py_framework}/include/python${PYTHON_VERSION}m")
  90. set(PYTHON_EXECUTABLE "${_py_framework}/bin/python${PYTHON_VERSION}m")
  91. set(PYTHON_LIBPATH "${_py_framework}/lib/python${PYTHON_VERSION}/config-${PYTHON_VERSION}m")
  92. #set(PYTHON_LIBRARY python${PYTHON_VERSION})
  93. #set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework Python") # won't build with this enabled
  94. unset(_py_framework)
  95. endif()
  96. # uncached vars
  97. set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
  98. set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
  99. # needed for Audaspace, numpy is installed into python site-packages
  100. set(PYTHON_NUMPY_INCLUDE_DIRS "${PYTHON_LIBPATH}/site-packages/numpy/core/include")
  101. if(NOT EXISTS "${PYTHON_EXECUTABLE}")
  102. message(FATAL_ERROR "Python executable missing: ${PYTHON_EXECUTABLE}")
  103. endif()
  104. endif()
  105. if(WITH_FFTW3)
  106. set(FFTW3 ${LIBDIR}/fftw3)
  107. set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
  108. set(FFTW3_LIBRARIES fftw3)
  109. set(FFTW3_LIBPATH ${FFTW3}/lib)
  110. endif()
  111. set(PNG_LIBRARIES png)
  112. set(JPEG_LIBRARIES jpeg)
  113. set(ZLIB /usr)
  114. set(ZLIB_INCLUDE_DIRS "${ZLIB}/include")
  115. set(ZLIB_LIBRARIES z bz2)
  116. set(FREETYPE ${LIBDIR}/freetype)
  117. set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
  118. set(FREETYPE_LIBPATH ${FREETYPE}/lib)
  119. set(FREETYPE_LIBRARY freetype)
  120. if(WITH_IMAGE_OPENEXR)
  121. set(OPENEXR ${LIBDIR}/openexr)
  122. set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
  123. set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR}/include/OpenEXR)
  124. set(OPENEXR_LIBRARIES
  125. Iex
  126. Half
  127. IlmImf
  128. Imath
  129. IlmThread)
  130. set(OPENEXR_LIBPATH ${OPENEXR}/lib)
  131. endif()
  132. if(WITH_CODEC_FFMPEG)
  133. set(FFMPEG ${LIBDIR}/ffmpeg)
  134. set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
  135. set(FFMPEG_LIBRARIES
  136. avcodec avdevice avformat avutil
  137. mp3lame swscale x264 xvidcore
  138. theora theoradec theoraenc
  139. vorbis vorbisenc vorbisfile ogg
  140. vpx swresample)
  141. set(FFMPEG_LIBPATH ${FFMPEG}/lib)
  142. endif()
  143. if(WITH_IMAGE_OPENJPEG OR WITH_CODEC_FFMPEG)
  144. # use openjpeg from libdir that is linked into ffmpeg
  145. set(OPENJPEG ${LIBDIR}/openjpeg)
  146. set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG}/include)
  147. set(OPENJPEG_LIBRARIES ${OPENJPEG}/lib/libopenjp2.a)
  148. endif()
  149. find_library(SYSTEMSTUBS_LIBRARY
  150. NAMES
  151. SystemStubs
  152. PATHS
  153. )
  154. mark_as_advanced(SYSTEMSTUBS_LIBRARY)
  155. if(SYSTEMSTUBS_LIBRARY)
  156. list(APPEND PLATFORM_LINKLIBS SystemStubs)
  157. endif()
  158. set(PLATFORM_CFLAGS "-pipe -funsigned-char")
  159. set(PLATFORM_LINKFLAGS
  160. "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework Metal -framework QuartzCore"
  161. )
  162. list(APPEND PLATFORM_LINKLIBS c++)
  163. if(WITH_JACK)
  164. set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework jackmp")
  165. endif()
  166. if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
  167. # force cmake to link right framework
  168. set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")
  169. endif()
  170. if(WITH_OPENCOLLADA)
  171. set(OPENCOLLADA ${LIBDIR}/opencollada)
  172. set(OPENCOLLADA_INCLUDE_DIRS
  173. ${LIBDIR}/opencollada/include/COLLADAStreamWriter
  174. ${LIBDIR}/opencollada/include/COLLADABaseUtils
  175. ${LIBDIR}/opencollada/include/COLLADAFramework
  176. ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader
  177. ${LIBDIR}/opencollada/include/GeneratedSaxParser
  178. )
  179. set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
  180. set(OPENCOLLADA_LIBRARIES
  181. OpenCOLLADASaxFrameworkLoader
  182. -lOpenCOLLADAFramework
  183. -lOpenCOLLADABaseUtils
  184. -lOpenCOLLADAStreamWriter
  185. -lMathMLSolver
  186. -lGeneratedSaxParser
  187. -lbuffer -lftoa -lUTF
  188. ${OPENCOLLADA_LIBPATH}/libxml2.a
  189. )
  190. # PCRE is bundled with openCollada
  191. #set(PCRE ${LIBDIR}/pcre)
  192. #set(PCRE_LIBPATH ${PCRE}/lib)
  193. set(PCRE_LIBRARIES pcre)
  194. # libxml2 is used
  195. #set(EXPAT ${LIBDIR}/expat)
  196. #set(EXPAT_LIBPATH ${EXPAT}/lib)
  197. set(EXPAT_LIB)
  198. endif()
  199. if(WITH_SDL)
  200. set(SDL ${LIBDIR}/sdl)
  201. set(SDL_INCLUDE_DIR ${SDL}/include)
  202. set(SDL_LIBRARY SDL2)
  203. set(SDL_LIBPATH ${SDL}/lib)
  204. set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework ForceFeedback")
  205. endif()
  206. set(PNG "${LIBDIR}/png")
  207. set(PNG_INCLUDE_DIRS "${PNG}/include")
  208. set(PNG_LIBPATH ${PNG}/lib)
  209. set(JPEG "${LIBDIR}/jpeg")
  210. set(JPEG_INCLUDE_DIR "${JPEG}/include")
  211. set(JPEG_LIBPATH ${JPEG}/lib)
  212. if(WITH_IMAGE_TIFF)
  213. set(TIFF ${LIBDIR}/tiff)
  214. set(TIFF_INCLUDE_DIR ${TIFF}/include)
  215. set(TIFF_LIBRARY tiff)
  216. set(TIFF_LIBPATH ${TIFF}/lib)
  217. endif()
  218. if(WITH_BOOST)
  219. set(BOOST ${LIBDIR}/boost)
  220. set(BOOST_INCLUDE_DIR ${BOOST}/include)
  221. set(BOOST_POSTFIX)
  222. set(BOOST_LIBRARIES
  223. boost_date_time${BOOST_POSTFIX}
  224. boost_filesystem${BOOST_POSTFIX}
  225. boost_regex${BOOST_POSTFIX}
  226. boost_system${BOOST_POSTFIX}
  227. boost_thread${BOOST_POSTFIX}
  228. boost_wave${BOOST_POSTFIX}
  229. )
  230. if(WITH_INTERNATIONAL)
  231. list(APPEND BOOST_LIBRARIES boost_locale${BOOST_POSTFIX})
  232. endif()
  233. if(WITH_CYCLES_NETWORK)
  234. list(APPEND BOOST_LIBRARIES boost_serialization${BOOST_POSTFIX})
  235. endif()
  236. if(WITH_OPENVDB)
  237. list(APPEND BOOST_LIBRARIES boost_iostreams${BOOST_POSTFIX})
  238. endif()
  239. set(BOOST_LIBPATH ${BOOST}/lib)
  240. set(BOOST_DEFINITIONS)
  241. endif()
  242. if(WITH_INTERNATIONAL OR WITH_CODEC_FFMPEG)
  243. set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -liconv") # boost_locale and ffmpeg needs it !
  244. endif()
  245. if(WITH_OPENIMAGEIO)
  246. set(OPENIMAGEIO ${LIBDIR}/openimageio)
  247. set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
  248. set(OPENIMAGEIO_LIBRARIES
  249. ${OPENIMAGEIO}/lib/libOpenImageIO.a
  250. ${PNG_LIBRARIES}
  251. ${JPEG_LIBRARIES}
  252. ${TIFF_LIBRARY}
  253. ${OPENEXR_LIBRARIES}
  254. ${OPENJPEG_LIBRARIES}
  255. ${ZLIB_LIBRARIES}
  256. )
  257. set(OPENIMAGEIO_LIBPATH
  258. ${OPENIMAGEIO}/lib
  259. ${JPEG_LIBPATH}
  260. ${PNG_LIBPATH}
  261. ${TIFF_LIBPATH}
  262. ${OPENEXR_LIBPATH}
  263. ${ZLIB_LIBPATH}
  264. )
  265. set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
  266. set(OPENIMAGEIO_IDIFF "${LIBDIR}/openimageio/bin/idiff")
  267. endif()
  268. if(WITH_OPENCOLORIO)
  269. set(OPENCOLORIO ${LIBDIR}/opencolorio)
  270. set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
  271. set(OPENCOLORIO_LIBRARIES OpenColorIO tinyxml yaml-cpp)
  272. set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
  273. endif()
  274. if(WITH_OPENVDB)
  275. set(OPENVDB ${LIBDIR}/openvdb)
  276. set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
  277. set(TBB_INCLUDE_DIRS ${LIBDIR}/tbb/include)
  278. set(TBB_LIBRARIES ${LIBDIR}/tbb/lib/libtbb.a)
  279. set(OPENVDB_LIBRARIES openvdb blosc ${TBB_LIBRARIES})
  280. set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
  281. set(OPENVDB_DEFINITIONS)
  282. endif()
  283. if(WITH_LLVM)
  284. set(LLVM_ROOT_DIR ${LIBDIR}/llvm)
  285. set(LLVM_VERSION 3.4)
  286. if(EXISTS "${LLVM_ROOT_DIR}/bin/llvm-config")
  287. set(LLVM_CONFIG "${LLVM_ROOT_DIR}/bin/llvm-config")
  288. else()
  289. set(LLVM_CONFIG llvm-config)
  290. endif()
  291. execute_process(COMMAND ${LLVM_CONFIG} --version
  292. OUTPUT_VARIABLE LLVM_VERSION
  293. OUTPUT_STRIP_TRAILING_WHITESPACE)
  294. execute_process(COMMAND ${LLVM_CONFIG} --prefix
  295. OUTPUT_VARIABLE LLVM_ROOT_DIR
  296. OUTPUT_STRIP_TRAILING_WHITESPACE)
  297. execute_process(COMMAND ${LLVM_CONFIG} --libdir
  298. OUTPUT_VARIABLE LLVM_LIBPATH
  299. OUTPUT_STRIP_TRAILING_WHITESPACE)
  300. find_library(LLVM_LIBRARY
  301. NAMES LLVMAnalysis # first of a whole bunch of libs to get
  302. PATHS ${LLVM_LIBPATH})
  303. if(LLVM_LIBRARY AND LLVM_ROOT_DIR AND LLVM_LIBPATH)
  304. if(LLVM_STATIC)
  305. # if static LLVM libraries were requested, use llvm-config to generate
  306. # the list of what libraries we need, and substitute that in the right
  307. # way for LLVM_LIBRARY.
  308. execute_process(COMMAND ${LLVM_CONFIG} --libfiles
  309. OUTPUT_VARIABLE LLVM_LIBRARY
  310. OUTPUT_STRIP_TRAILING_WHITESPACE)
  311. string(REPLACE ".a /" ".a;/" LLVM_LIBRARY ${LLVM_LIBRARY})
  312. else()
  313. set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lLLVM-3.4")
  314. endif()
  315. else()
  316. message(FATAL_ERROR "LLVM not found.")
  317. endif()
  318. endif()
  319. if(WITH_CYCLES_OSL)
  320. set(CYCLES_OSL ${LIBDIR}/osl)
  321. find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
  322. find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
  323. find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
  324. # WARNING! depends on correct order of OSL libs linking
  325. list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -force_load ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
  326. find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
  327. find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
  328. if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER)
  329. set(OSL_FOUND TRUE)
  330. else()
  331. message(STATUS "OSL not found")
  332. set(WITH_CYCLES_OSL OFF)
  333. endif()
  334. endif()
  335. if(WITH_CYCLES_EMBREE)
  336. find_package(Embree 3.2.4 REQUIRED)
  337. set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Xlinker -stack_size -Xlinker 0x100000")
  338. endif()
  339. # CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide custom flags.
  340. if(WITH_OPENMP)
  341. if(CMAKE_C_COMPILER_ID MATCHES "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0")
  342. # Use OpenMP from our precompiled libraries.
  343. message(STATUS "Using ${LIBDIR}/openmp for OpenMP")
  344. set(OPENMP_CUSTOM ON)
  345. set(OPENMP_FOUND ON)
  346. set(OpenMP_C_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
  347. set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
  348. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L'${LIBDIR}/openmp/lib' -lomp")
  349. # Copy libomp.dylib to allow executables like datatoc and tests to work.
  350. execute_process(
  351. COMMAND mkdir -p ${CMAKE_BINARY_DIR}/Resources/lib
  352. COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/Resources/lib/libomp.dylib)
  353. execute_process(
  354. COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/Resources/lib
  355. COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/Resources/lib/libomp.dylib)
  356. endif()
  357. endif()
  358. set(EXETYPE MACOSX_BUNDLE)
  359. set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
  360. set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
  361. if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "i386")
  362. set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
  363. set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
  364. if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
  365. set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
  366. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
  367. endif()
  368. else()
  369. set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
  370. set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
  371. endif()
  372. if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
  373. # Xcode 5 is always using CLANG, which has too low template depth of 128 for libmv
  374. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024")
  375. endif()
  376. # Get rid of eventually clashes, we export some symbols explicitly as local
  377. set(PLATFORM_LINKFLAGS
  378. "${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker '${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map'"
  379. )
  380. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
  381. set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -stdlib=libc++")
  382. # Suppress ranlib "has no symbols" warnings (workaround for T48250)
  383. set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
  384. set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
  385. set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
  386. set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")