Fix Cycles gtests build on macOS.
[blender.git] / build_files / cmake / platform / platform_apple.cmake
index b28b74804d3601980c4359f63a3b2c6d1e36e0ca..fcdebbb74adb24a5d136043898c1a57287f4339f 100644 (file)
 
 # Libraries configuration for Apple.
 
+macro(find_package_wrapper)
+# do nothing, just satisfy the macro
+endmacro()
+
 if(NOT DEFINED LIBDIR)
-       set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
+       set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
 else()
        message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
 endif()
@@ -48,17 +52,17 @@ if(WITH_ALEMBIC)
        set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
        set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
        set(ALEMBIC_LIBRARIES Alembic)
+       set(ALEMBIC_FOUND ON)
 endif()
 
-if(WITH_OPENSUBDIV)
+if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
        set(OPENSUBDIV ${LIBDIR}/opensubdiv)
        set(OPENSUBDIV_LIBPATH ${OPENSUBDIV}/lib)
-       find_library(OSL_LIB_UTIL NAMES osdutil PATHS ${OPENSUBDIV_LIBPATH})
-       find_library(OSL_LIB_CPU NAMES osdCPU PATHS ${OPENSUBDIV_LIBPATH})
-       find_library(OSL_LIB_GPU NAMES osdGPU PATHS ${OPENSUBDIV_LIBPATH})
+       find_library(OSD_LIB_CPU NAMES osdCPU PATHS ${OPENSUBDIV_LIBPATH})
+       find_library(OSD_LIB_GPU NAMES osdGPU PATHS ${OPENSUBDIV_LIBPATH})
        set(OPENSUBDIV_INCLUDE_DIR ${OPENSUBDIV}/include)
        set(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
-       list(APPEND OPENSUBDIV_LIBRARIES ${OSL_LIB_UTIL} ${OSL_LIB_CPU} ${OSL_LIB_GPU})
+       list(APPEND OPENSUBDIV_LIBRARIES ${OSD_LIB_CPU} ${OSD_LIB_GPU})
 endif()
 
 if(WITH_JACK)
@@ -75,17 +79,17 @@ if(WITH_CODEC_SNDFILE)
        set(SNDFILE ${LIBDIR}/sndfile)
        set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
        set(SNDFILE_LIBRARIES sndfile FLAC ogg vorbis vorbisenc)
-       set(SNDFILE_LIBPATH ${SNDFILE}/lib ${FFMPEG}/lib)  # TODO, deprecate
+       set(SNDFILE_LIBPATH ${SNDFILE}/lib ${LIBDIR}/ffmpeg/lib)  # TODO, deprecate
 endif()
 
 if(WITH_PYTHON)
        # we use precompiled libraries for py 3.5 and up by default
-       set(PYTHON_VERSION 3.5)
+       set(PYTHON_VERSION 3.6)
        if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
                # normally cached but not since we include them with blender
                set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
                set(PYTHON_EXECUTABLE "${LIBDIR}/python/bin/python${PYTHON_VERSION}m")
-               set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
+               set(PYTHON_LIBRARY ${LIBDIR}/python/lib/libpython${PYTHON_VERSION}m.a)
                set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
                # set(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
        else()
@@ -105,6 +109,9 @@ if(WITH_PYTHON)
        set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
        set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
 
+       # needed for Audaspace, numpy is installed into python site-packages
+       set(NUMPY_INCLUDE_DIRS "${PYTHON_LIBPATH}/site-packages/numpy/core/include")
+
        if(NOT EXISTS "${PYTHON_EXECUTABLE}")
                message(FATAL_ERROR "Python executable missing: ${PYTHON_EXECUTABLE}")
        endif()
@@ -133,7 +140,13 @@ if(WITH_IMAGE_OPENEXR)
        set(OPENEXR ${LIBDIR}/openexr)
        set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
        set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR}/include/OpenEXR)
-       set(OPENEXR_LIBRARIES Iex Half IlmImf Imath IlmThread)
+       set(OPENEXR_POSTFIX -2_2)
+       set(OPENEXR_LIBRARIES
+               Iex${OPENEXR_POSTFIX}
+               Half
+               IlmImf${OPENEXR_POSTFIX}
+               Imath${OPENEXR_POSTFIX}
+               IlmThread${OPENEXR_POSTFIX})
        set(OPENEXR_LIBPATH ${OPENEXR}/lib)
 endif()
 
@@ -144,9 +157,18 @@ if(WITH_CODEC_FFMPEG)
                avcodec avdevice avformat avutil
                mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg
        )
+       set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} schroedinger orc vpx webp swresample)
        set(FFMPEG_LIBPATH ${FFMPEG}/lib)
 endif()
 
+if(WITH_IMAGE_OPENJPEG OR WITH_CODEC_FFMPEG)
+       # use openjpeg from libdir that is linked into ffmpeg
+       set(OPENJPEG ${LIBDIR}/openjpeg)
+       set(WITH_SYSTEM_OPENJPEG ON)
+       set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG}/include)
+       set(OPENJPEG_LIBRARIES ${OPENJPEG}/lib/libopenjpeg.a)
+endif()
+
 find_library(SYSTEMSTUBS_LIBRARY
        NAMES
        SystemStubs
@@ -161,19 +183,8 @@ set(PLATFORM_CFLAGS "-pipe -funsigned-char")
 set(PLATFORM_LINKFLAGS
        "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio"
 )
-if(WITH_CODEC_QUICKTIME)
-       set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QTKit")
-       if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
-               set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
-               # libSDL still needs 32bit carbon quicktime
-       endif()
-endif()
 
-if(WITH_CXX11)
-       list(APPEND PLATFORM_LINKLIBS c++)
-else()
-       list(APPEND PLATFORM_LINKLIBS stdc++)
-endif()
+list(APPEND PLATFORM_LINKLIBS c++)
 
 if(WITH_JACK)
        set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework jackmp")
@@ -224,7 +235,7 @@ if(WITH_SDL)
        set(SDL_INCLUDE_DIR ${SDL}/include)
        set(SDL_LIBRARY SDL2)
        set(SDL_LIBPATH ${SDL}/lib)
-       set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lazy_framework ForceFeedback")
+       set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework ForceFeedback")
 endif()
 
 set(PNG "${LIBDIR}/png")
@@ -245,22 +256,23 @@ endif()
 if(WITH_BOOST)
        set(BOOST ${LIBDIR}/boost)
        set(BOOST_INCLUDE_DIR ${BOOST}/include)
+       set(BOOST_POSTFIX)
        set(BOOST_LIBRARIES
-               boost_date_time-mt
-               boost_filesystem-mt
-               boost_regex-mt
-               boost_system-mt
-               boost_thread-mt
-               boost_wave-mt
+               boost_date_time${BOOST_POSTFIX}
+               boost_filesystem${BOOST_POSTFIX}
+               boost_regex${BOOST_POSTFIX}
+               boost_system${BOOST_POSTFIX}
+               boost_thread${BOOST_POSTFIX}
+               boost_wave${BOOST_POSTFIX}
        )
        if(WITH_INTERNATIONAL)
-               list(APPEND BOOST_LIBRARIES boost_locale-mt)
+               list(APPEND BOOST_LIBRARIES boost_locale${BOOST_POSTFIX})
        endif()
        if(WITH_CYCLES_NETWORK)
-               list(APPEND BOOST_LIBRARIES boost_serialization-mt)
+               list(APPEND BOOST_LIBRARIES boost_serialization${BOOST_POSTFIX})
        endif()
        if(WITH_OPENVDB)
-               list(APPEND BOOST_LIBRARIES boost_iostreams-mt)
+               list(APPEND BOOST_LIBRARIES boost_iostreams${BOOST_POSTFIX})
        endif()
        set(BOOST_LIBPATH ${BOOST}/lib)
        set(BOOST_DEFINITIONS)
@@ -279,8 +291,10 @@ if(WITH_OPENIMAGEIO)
                ${JPEG_LIBRARIES}
                ${TIFF_LIBRARY}
                ${OPENEXR_LIBRARIES}
+               ${OPENJPEG_LIBRARIES}
                ${ZLIB_LIBRARIES}
        )
+       set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${LIBDIR}/ffmpeg/lib/libwebp.a)
        set(OPENIMAGEIO_LIBPATH
                ${OPENIMAGEIO}/lib
                ${JPEG_LIBPATH}
@@ -418,10 +432,8 @@ set(PLATFORM_LINKFLAGS
        "${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker ${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map"
 )
 
-if(WITH_CXX11)
-       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
-       set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -stdlib=libc++")
-endif()
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
+set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -stdlib=libc++")
 
 # Suppress ranlib "has no symbols" warnings (workaround for T48250)
 set(CMAKE_C_ARCHIVE_CREATE   "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")