Fix blenderplayer build after OpenMP changes.
[blender.git] / source / creator / CMakeLists.txt
index 469ec2dd1040dbd31e82a5aa520530ada5cbbdb5..1ce8a8d1c4cba3279295d8bb10003bb97c7700e2 100644 (file)
@@ -26,6 +26,7 @@
 setup_libdirs()
 
 blender_include_dirs(
+       ../../intern/clog
        ../../intern/guardedalloc
        ../../intern/glew-mx
        ../blender/blenlib
@@ -264,15 +265,30 @@ endif()
 set(BLENDER_TEXT_FILES
        ${CMAKE_SOURCE_DIR}/release/text/GPL-license.txt
        ${CMAKE_SOURCE_DIR}/release/text/GPL3-license.txt
-       ${CMAKE_SOURCE_DIR}/release/text/Python-license.txt
        ${CMAKE_SOURCE_DIR}/release/text/copyright.txt
-       ${CMAKE_SOURCE_DIR}/release/text/jemalloc-license.txt
-       ${CMAKE_SOURCE_DIR}/release/text/ocio-license.txt
        # generate this file
        # ${CMAKE_SOURCE_DIR}/release/text/readme.html
        ${CMAKE_SOURCE_DIR}/release/datafiles/LICENSE-bfont.ttf.txt
 )
 
+if(WITH_PYTHON)
+       list(APPEND BLENDER_TEXT_FILES
+               ${CMAKE_SOURCE_DIR}/release/text/Python-license.txt
+       )
+endif()
+
+if(WITH_OPENCOLORIO)
+       list(APPEND BLENDER_TEXT_FILES
+               ${CMAKE_SOURCE_DIR}/release/text/ocio-license.txt
+       )
+endif()
+
+if(WITH_MEM_JEMALLOC)
+       list(APPEND BLENDER_TEXT_FILES
+               ${CMAKE_SOURCE_DIR}/release/text/jemalloc-license.txt
+       )
+endif()
+
 if(WITH_INTERNATIONAL)
        list(APPEND BLENDER_TEXT_FILES
                ${CMAKE_SOURCE_DIR}/release/datafiles/LICENSE-droidsans.ttf.txt
@@ -325,7 +341,7 @@ install(
 
 if(WITH_PYTHON)
        # install(CODE "message(\"copying blender scripts...\")")
-       
+
        # exclude addons_contrib if release
        if("${BLENDER_VERSION_CYCLE}" STREQUAL "release" OR
           "${BLENDER_VERSION_CYCLE}" STREQUAL "rc")
@@ -351,7 +367,7 @@ if(WITH_PYTHON)
                PATTERN "${ADDON_EXCLUDE_CONDITIONAL}" EXCLUDE
                PATTERN "${FREESTYLE_EXCLUDE_CONDITIONAL}" EXCLUDE
        )
-       
+
        unset(ADDON_EXCLUDE_CONDITIONAL)
        unset(FREESTYLE_EXCLUDE_CONDITIONAL)
 endif()
@@ -631,7 +647,7 @@ if(UNIX AND NOT APPLE)
                                unset(_suffix)
                        endif()
                        unset(_target_LIB)
-                       
+
                endif()
        endif()
 elseif(WIN32)
@@ -701,7 +717,7 @@ elseif(WIN32)
                        )
 
                        if(WITH_PYTHON_INSTALL_NUMPY)
-                               set(PYTHON_NUMPY_VERSION 1.13)
+                               set(PYTHON_NUMPY_VERSION 1.15)
                                add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages
                                        COMMAND ${CMAKE_COMMAND} -E
                                                make_directory ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages)
@@ -737,6 +753,19 @@ elseif(WIN32)
                                DESTINATION ${BLENDER_VERSION}/python/bin
                                CONFIGURATIONS Debug
                        )
+                       if(WINDOWS_PYTHON_DEBUG)
+                               install(
+                                       FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.pdb
+                                       DESTINATION "."
+                                       CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
+                               )
+
+                               install(
+                                       FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}_d.pdb
+                                       DESTINATION "."
+                                       CONFIGURATIONS Debug
+                               )
+                       endif()
                endif()
 
                unset(_PYTHON_VERSION_NO_DOTS)
@@ -756,7 +785,7 @@ elseif(WIN32)
 
        if(MSVC)
                install(
-                       FILES ${LIBDIR}/pthreads/lib/pthreadVC2.dll
+                       FILES ${LIBDIR}/pthreads/lib/pthreadVC3.dll
                        DESTINATION "."
                )
        endif()
@@ -764,12 +793,12 @@ elseif(WIN32)
        if(WITH_CODEC_FFMPEG)
                install(
                        FILES
-                               ${LIBDIR}/ffmpeg/lib/avcodec-57.dll
-                               ${LIBDIR}/ffmpeg/lib/avformat-57.dll
-                               ${LIBDIR}/ffmpeg/lib/avdevice-57.dll
-                               ${LIBDIR}/ffmpeg/lib/avutil-55.dll
-                               ${LIBDIR}/ffmpeg/lib/swscale-4.dll
-                               ${LIBDIR}/ffmpeg/lib/swresample-2.dll
+                               ${LIBDIR}/ffmpeg/lib/avcodec-58.dll
+                               ${LIBDIR}/ffmpeg/lib/avformat-58.dll
+                               ${LIBDIR}/ffmpeg/lib/avdevice-58.dll
+                               ${LIBDIR}/ffmpeg/lib/avutil-56.dll
+                               ${LIBDIR}/ffmpeg/lib/swscale-5.dll
+                               ${LIBDIR}/ffmpeg/lib/swresample-3.dll
                        DESTINATION "."
                )
        endif()
@@ -795,7 +824,7 @@ elseif(WIN32)
                        DESTINATION "."
                )
        endif()
-       
+
        if(WITH_SYSTEM_AUDASPACE)
                install(
                        FILES
@@ -812,21 +841,12 @@ elseif(WIN32)
                        DESTINATION "."
                )
        endif()
-               
+
        install( # x86 builds can run on x64 Windows, so this is required at all times
                FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll
                DESTINATION "."
        )
 
-       if(WITH_OPENCOLORIO)
-               set(OCIOBIN ${LIBDIR}/opencolorio/bin)
-                       install(
-                               FILES
-                                       ${OCIOBIN}/OpenColorIO.dll
-                               DESTINATION "."
-                       )
-       endif()
-
 elseif(APPLE)
 
        # handy install macro to exclude files, we use \$ escape for the "to"
@@ -864,8 +884,8 @@ elseif(APPLE)
 
        set_target_properties(blender PROPERTIES
                MACOSX_BUNDLE_INFO_PLIST ${OSX_APP_SOURCEDIR}/Contents/Info.plist
-               MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION}
-               MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}")
+               MACOSX_BUNDLE_SHORT_VERSION_STRING "${BLENDER_VERSION}${BLENDER_VERSION_CHAR}"
+               MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION}${BLENDER_VERSION_CHAR} ${BLENDER_DATE}")
 
        # Gather the date in finder-style
        execute_process(COMMAND date "+%m/%d/%Y/%H:%M"
@@ -894,15 +914,10 @@ elseif(APPLE)
                blender.app/Contents/
        )
 
-       if(WITH_OPENMP AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS '3.4')
+       if(WITH_OPENMP AND OPENMP_CUSTOM)
                install(
-                       FILES ${LIBDIR}/openmp/lib/libiomp5.dylib
-                       DESTINATION blender.app/Contents/Resources/lib/
-               )
-               install(
-                       FILES ${LIBDIR}/openmp/LICENSE.txt
-                       DESTINATION "."
-                       RENAME LICENSE-libiomp5.txt
+                       FILES ${LIBDIR}/openmp/lib/libomp.dylib
+                       DESTINATION blender.app/Contents/Resources/lib
                )
        endif()
 
@@ -915,49 +930,11 @@ elseif(APPLE)
 
        # python
        if(WITH_PYTHON AND NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
-               if(WITH_CXX11)
-                       # Copy the python libs into the install directory
-                       install_dir(
-                               ${PYTHON_LIBPATH}
-                               ${TARGETDIR_VER}/python/lib
-                       )
-               else()
-                       # the python zip is first extracted as part of the build process,
-                       # and then later installed as part of make install. this is much
-                       # quicker, and means we can easily exclude files on copy
-                       # Not needed for PYTHON_MODULE or WEB_PLUGIN due uses Pyhon framework
-                       # use a hash of the .zip path to handle switching between different
-                       # lib directories without needing a clean build
-                       string(SHA1 PYTHON_ZIP_HASH ${LIBDIR}/release/${PYTHON_ZIP})
-                       set(PYTHON_EXTRACT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${PYTHON_ZIP_HASH}/python)
-
-                       add_custom_target(
-                               extractpyzip
-                               DEPENDS ${PYTHON_EXTRACT_DIR})
-
-                       set(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
-
-                       add_custom_command(
-                               OUTPUT ${PYTHON_EXTRACT_DIR}
-                               COMMAND ${CMAKE_COMMAND} -E remove_directory "${PYTHON_EXTRACT_DIR}/"
-                               COMMAND ${CMAKE_COMMAND} -E make_directory "${PYTHON_EXTRACT_DIR}/"
-                               COMMAND ${CMAKE_COMMAND} -E chdir "${PYTHON_EXTRACT_DIR}/"
-                                               ${CMAKE_COMMAND} -E tar xzfv "${LIBDIR}/release/${PYTHON_ZIP}"
-                               DEPENDS ${LIBDIR}/release/${PYTHON_ZIP})
-
-                       add_dependencies(blender extractpyzip)
-
-                       # copy extracted python files
-                       install_dir(
-                               ${PYTHON_EXTRACT_DIR}
-                               \${TARGETDIR_VER}
-                       )
-                       # copy site-packages files
-                       install_dir(
-                               ${LIBDIR}/release/site-packages
-                               \${TARGETDIR_VER}/python/lib/python${PYTHON_VERSION}
-                       )
-               endif()
+               # Copy the python libs into the install directory
+               install_dir(
+                       ${PYTHON_LIBPATH}
+                       ${TARGETDIR_VER}/python/lib
+               )
 
                install(DIRECTORY ${LIBDIR}/python/bin
                        DESTINATION ${TARGETDIR_VER}/python
@@ -973,7 +950,7 @@ elseif(APPLE)
                )
                unset(_py_inc_suffix)
        endif()
-       
+
        # install blenderplayer bundle - copy of blender.app above. re-using macros et al
        # note we are using OSX Bundle as base and copying Blender dummy bundle on top of it
        if(WITH_GAMEENGINE AND WITH_PLAYER)
@@ -1002,37 +979,20 @@ elseif(APPLE)
                        blenderplayer.app/Contents/
                )
 
-               if(WITH_OPENMP AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS '3.4')
+               if(WITH_OPENMP AND OPENMP_CUSTOM)
                        install(
-                               FILES ${LIBDIR}/openmp/lib/libiomp5.dylib
-                               DESTINATION blenderplayer.app/Contents/Resources/lib/
+                               FILES ${LIBDIR}/openmp/lib/libomp.dylib
+                               DESTINATION blenderplayer.app/Contents/Resources/lib
                        )
                endif()
 
-
                # python
                if(WITH_PYTHON AND NOT WITH_PYTHON_FRAMEWORK)
-                       if(WITH_CXX11)
-                               # Copy the python libs into the install directory
-                               install_dir(
-                                       ${PYTHON_LIBPATH}
-                                       ${PLAYER_TARGETDIR_VER}/python/lib
-                               )
-                       else()
-                               add_custom_command(
-                                       OUTPUT ${PYTHON_EXTRACT_DIR}
-                                       COMMAND ${CMAKE_COMMAND} -E remove_directory "${PYTHON_EXTRACT_DIR}/"
-                                       COMMAND ${CMAKE_COMMAND} -E make_directory "${PYTHON_EXTRACT_DIR}/"
-                                       COMMAND ${CMAKE_COMMAND} -E chdir "${PYTHON_EXTRACT_DIR}/"
-                                                       ${CMAKE_COMMAND} -E tar xzfv "${LIBDIR}/release/${PYTHON_ZIP}"
-                                       DEPENDS ${LIBDIR}/release/${PYTHON_ZIP})
-
-                               # copy extracted python files
-                               install_dir(
-                                       ${PYTHON_EXTRACT_DIR}
-                                       \${PLAYER_TARGETDIR_VER}
-                               )
-                       endif()
+                       # Copy the python libs into the install directory
+                       install_dir(
+                               ${PYTHON_LIBPATH}
+                               ${PLAYER_TARGETDIR_VER}/python/lib
+                       )
                endif()
 
        endif()
@@ -1090,70 +1050,9 @@ if(WIN32 AND NOT WITH_PYTHON_MODULE)
                COMPONENT Blender
                DESTINATION "."
        )
-       if(CMAKE_CL_64)
-               set(_WIN_PLATFORM x64)
-       else()
-               set(_WIN_PLATFORM x86)
-       endif()
-       if(MSVC12_REDIST_DIR)
-               install(
-                       FILES
-                               ${MSVC12_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC120.CRT/msvcp120.dll
-                               ${MSVC12_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC120.CRT/msvcr120.dll
-                       DESTINATION "."
-               )
-               if(WITH_OPENMP)
-                       install(
-                               FILES ${MSVC12_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC120.OpenMP/vcomp120.dll
-                               DESTINATION "."
-                       )
-               endif()
-       endif()
-       
-       if(MSVC14_REDIST_DIR)
-               set(KITSDIRx86 "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/10/")
-               set(KITSDIR "$ENV{ProgramFiles}/Windows Kits/10/")
-               if(IS_DIRECTORY ${KITSDIR})
-                       set(KITSPATH "${KITSDIR}/Redist/ucrt/DLLs/${_WIN_PLATFORM}")
-               else()
-                       if(IS_DIRECTORY ${KITSDIRx86})
-                               set(KITSPATH "${KITSDIRx86}/Redist/ucrt/DLLs/${_WIN_PLATFORM}")
-                       else()
-                               message(FATAL_ERROR "Windows 10 SDK directory not found")
-                       endif()
-               endif()
-               FILE(TO_CMAKE_PATH  ${KITSPATH} KITSPATH)
-               install(
-                       FILES
-                               ${KITSPATH}/api-ms-win-core-file-l1-2-0.dll
-                               ${KITSPATH}/api-ms-win-core-file-l2-1-0.dll
-                               ${KITSPATH}/api-ms-win-core-localization-l1-2-0.dll
-                               ${KITSPATH}/api-ms-win-core-processthreads-l1-1-0.dll
-                               ${KITSPATH}/api-ms-win-core-processthreads-l1-1-1.dll
-                               ${KITSPATH}/api-ms-win-core-synch-l1-1-0.dll
-                               ${KITSPATH}/api-ms-win-core-synch-l1-2-0.dll
-                               ${KITSPATH}/api-ms-win-core-timezone-l1-1-0.dll
-                               ${KITSPATH}/api-ms-win-crt-conio-l1-1-0.dll
-                               ${KITSPATH}/api-ms-win-crt-convert-l1-1-0.dll
-                               ${KITSPATH}/api-ms-win-crt-environment-l1-1-0.dll
-                               ${KITSPATH}/api-ms-win-crt-filesystem-l1-1-0.dll
-                               ${KITSPATH}/api-ms-win-crt-heap-l1-1-0.dll
-                               ${KITSPATH}/api-ms-win-crt-locale-l1-1-0.dll
-                               ${KITSPATH}/api-ms-win-crt-math-l1-1-0.dll
-                               ${KITSPATH}/api-ms-win-crt-process-l1-1-0.dll
-                               ${KITSPATH}/api-ms-win-crt-runtime-l1-1-0.dll
-                               ${KITSPATH}/api-ms-win-crt-stdio-l1-1-0.dll
-                               ${KITSPATH}/api-ms-win-crt-string-l1-1-0.dll
-                               ${KITSPATH}/api-ms-win-crt-time-l1-1-0.dll
-                               ${KITSPATH}/ucrtbase.dll
-                               ${MSVC14_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC140.CRT/vcruntime140.dll
-                       DESTINATION "."
-               )
-               if(WITH_OPENMP)
-                       install(
-                               FILES ${MSVC14_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC140.OpenMP/vcomp140.dll
-                               DESTINATION "."
-                       )
-               endif()
-       endif()
+       set_target_properties(
+               blender
+               PROPERTIES
+                       VS_USER_PROPS "blender.Cpp.user.props"
+       )
 endif()