cmake: adjustments required for lib-upgrade on windows.
authorRay Molenkamp <github@lazydodo.com>
Tue, 28 Aug 2018 01:37:55 +0000 (19:37 -0600)
committerRay Molenkamp <github@lazydodo.com>
Tue, 28 Aug 2018 01:38:31 +0000 (19:38 -0600)
CMakeLists.txt
build_files/cmake/platform/platform_win32.cmake
intern/cycles/CMakeLists.txt
intern/cycles/render/osl.cpp
intern/opencolorio/CMakeLists.txt
intern/openvdb/CMakeLists.txt
source/creator/CMakeLists.txt

index 9e88c89..697f734 100644 (file)
@@ -167,6 +167,7 @@ option_defaults_init(
        _init_FFTW3
        _init_GAMEENGINE
        _init_OPENSUBDIV
+       _init_SYSTEM_OPENJPG
 )
 
 # customize...
@@ -183,11 +184,13 @@ if(UNIX AND NOT APPLE)
        set(_init_SDL                            OFF)
        set(_init_FFTW3                          OFF)
        set(_init_OPENSUBDIV                     OFF)
+       set(_init_SYSTEM_OPENJPG                 OFF)
 elseif(WIN32)
        set(_init_JACK                           OFF)
 elseif(APPLE)
        set(_init_JACK                           OFF)
        set(_init_OPENSUBDIV                     OFF)
+       set(_init_SYSTEM_OPENJPG                 OFF)
 endif()
 
 
@@ -302,7 +305,7 @@ endif()
 
 
 # (unix defaults to System OpenJPEG On)
-option(WITH_SYSTEM_OPENJPEG "Use the operating systems OpenJPEG library" OFF)
+option(WITH_SYSTEM_OPENJPEG "Use the operating systems OpenJPEG library" ${_init_SYSTEM_OPENJPG})
 
 if(UNIX AND NOT APPLE)
        option(WITH_SYSTEM_EIGEN3 "Use the systems Eigen3 library" OFF)
index bfbc8d9..1460808 100644 (file)
@@ -265,9 +265,7 @@ if(WITH_OPENCOLLADA)
                ${OPENCOLLADA}/lib/opencollada/ftoa.lib
        )
 
-       if(NOT WITH_LLVM)
-               list(APPEND OPENCOLLADA_LIBRARIES ${OPENCOLLADA}/lib/opencollada/UTF.lib)
-       endif()
+       list(APPEND OPENCOLLADA_LIBRARIES ${OPENCOLLADA}/lib/opencollada/UTF.lib)
 
        set(PCRE_LIBRARIES
                ${OPENCOLLADA}/lib/opencollada/pcre.lib
@@ -282,8 +280,6 @@ if(WITH_CODEC_FFMPEG)
        windows_find_package(FFMPEG)
        if(NOT FFMPEG_FOUND)
                warn_hardcoded_paths(ffmpeg)
-               set(FFMPEG_LIBRARY_VERSION 57)
-               set(FFMPEG_LIBRARY_VERSION_AVU 55)
                set(FFMPEG_LIBRARIES
                        ${LIBDIR}/ffmpeg/lib/avcodec.lib
                        ${LIBDIR}/ffmpeg/lib/avformat.lib
@@ -305,16 +301,16 @@ if(WITH_IMAGE_OPENEXR)
                set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR}/include/OpenEXR)
                set(OPENEXR_LIBPATH ${OPENEXR}/lib)
                set(OPENEXR_LIBRARIES
-                       optimized ${OPENEXR_LIBPATH}/Iex-2_2.lib
-                       optimized ${OPENEXR_LIBPATH}/Half.lib
-                       optimized ${OPENEXR_LIBPATH}/IlmImf-2_2.lib
-                       optimized ${OPENEXR_LIBPATH}/Imath-2_2.lib
-                       optimized ${OPENEXR_LIBPATH}/IlmThread-2_2.lib
-                       debug ${OPENEXR_LIBPATH}/Iex-2_2_d.lib
-                       debug ${OPENEXR_LIBPATH}/Half_d.lib
-                       debug ${OPENEXR_LIBPATH}/IlmImf-2_2_d.lib
-                       debug ${OPENEXR_LIBPATH}/Imath-2_2_d.lib
-                       debug ${OPENEXR_LIBPATH}/IlmThread-2_2_d.lib
+                       optimized ${OPENEXR_LIBPATH}/Iex_s.lib
+                       optimized ${OPENEXR_LIBPATH}/Half_s.lib
+                       optimized ${OPENEXR_LIBPATH}/IlmImf_s.lib
+                       optimized ${OPENEXR_LIBPATH}/Imath_s.lib
+                       optimized ${OPENEXR_LIBPATH}/IlmThread_s.lib
+                       debug ${OPENEXR_LIBPATH}/Iex_s_d.lib
+                       debug ${OPENEXR_LIBPATH}/Half_s_d.lib
+                       debug ${OPENEXR_LIBPATH}/IlmImf_s_d.lib
+                       debug ${OPENEXR_LIBPATH}/Imath_s_d.lib
+                       debug ${OPENEXR_LIBPATH}/IlmThread_s_d.lib
                )
        endif()
 endif()
@@ -338,7 +334,7 @@ if(WITH_JACK)
 endif()
 
 if(WITH_PYTHON)
-       set(PYTHON_VERSION 3.6) # CACHE STRING)
+       set(PYTHON_VERSION 3.7) # CACHE STRING)
 
        string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
        # Use shared libs for vc2008 and vc2010 until we actually have vc2010 libs
@@ -373,14 +369,13 @@ if(WITH_BOOST)
                warn_hardcoded_paths(BOOST)
                set(BOOST ${LIBDIR}/boost)
                set(BOOST_INCLUDE_DIR ${BOOST}/include)
-               if(MSVC12)
-                       set(BOOST_LIBPATH ${BOOST}/lib)
-                       set(BOOST_POSTFIX "vc120-mt-s-1_60.lib")
-                       set(BOOST_DEBUG_POSTFIX "vc120-mt-sgd-1_60.lib")
+               set(BOOST_LIBPATH ${BOOST}/lib)
+               if(CMAKE_CL_64)
+                       set(BOOST_POSTFIX "vc140-mt-s-x64-1_68.lib")
+                       set(BOOST_DEBUG_POSTFIX "vc140-mt-sgd-x64-1_68.lib")
                else()
-                       set(BOOST_LIBPATH ${BOOST}/lib)
-                       set(BOOST_POSTFIX "vc140-mt-s-1_60.lib")
-                       set(BOOST_DEBUG_POSTFIX "vc140-mt-sgd-1_60.lib")
+                       set(BOOST_POSTFIX "vc140-mt-s-x32-1_68.lib")
+                       set(BOOST_DEBUG_POSTFIX "vc140-mt-sgd-x32-1_68.lib")
                endif()
                set(BOOST_LIBRARIES
                        optimized ${BOOST_LIBPATH}/libboost_date_time-${BOOST_POSTFIX}
@@ -459,7 +454,14 @@ if(WITH_OPENCOLORIO)
        set(OPENCOLORIO ${LIBDIR}/opencolorio)
        set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
        set(OPENCOLORIO_LIBPATH ${LIBDIR}/opencolorio/lib)
-       set(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBPATH}/OpenColorIO.lib)
+       set(OPENCOLORIO_LIBRARIES 
+               optimized ${OPENCOLORIO_LIBPATH}/OpenColorIO.lib
+               optimized ${OPENCOLORIO_LIBPATH}/tinyxml.lib
+               optimized ${OPENCOLORIO_LIBPATH}/libyaml-cpp.lib
+               debug ${OPENCOLORIO_LIBPATH}/OpenColorIO_d.lib
+               debug ${OPENCOLORIO_LIBPATH}/tinyxml_d.lib
+               debug ${OPENCOLORIO_LIBPATH}/libyaml-cpp_d.lib
+       )
        set(OPENCOLORIO_DEFINITIONS)
 endif()
 
@@ -471,7 +473,7 @@ if(WITH_OPENVDB)
        set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
        set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include ${TBB_INCLUDE_DIR})
        set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug ${OPENVDB_LIBPATH}/openvdb_d.lib ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
-
+       set(OPENVDB_DEFINITIONS -DNOMINMAX)
 endif()
 
 if(WITH_ALEMBIC)
@@ -494,6 +496,12 @@ if(WITH_MOD_CLOTH_ELTOPO)
        )
 endif()
 
+if(WITH_IMAGE_OPENJPEG)
+       set(OPENJPEG ${LIBDIR}/openjpeg)
+       set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG}/include/openjpeg-2.3)
+       set(OPENJPEG_LIBRARIES ${OPENJPEG}/lib/openjp2.lib)
+endif()
+
 if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
        set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
        set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
@@ -583,9 +591,11 @@ if(WITH_CYCLES_OSL)
                optimized ${OSL_LIB_COMP}
                optimized ${OSL_LIB_EXEC}
                optimized ${OSL_LIB_QUERY}
+               optimized ${CYCLES_OSL}/lib/pugixml.lib
                debug ${OSL_LIB_EXEC_DEBUG}
                debug ${OSL_LIB_COMP_DEBUG}
                debug ${OSL_LIB_QUERY_DEBUG}
+               debug ${CYCLES_OSL}/lib/pugixml_d.lib
        )
        find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
        find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
index 00ac8e7..0147a43 100644 (file)
@@ -200,6 +200,9 @@ endif()
 
 if(WITH_CYCLES_OSL)
        add_definitions(-DWITH_OSL)
+       #osl 1.9.x
+       add_definitions(-DOSL_STATIC_BUILD)
+       #pre 1.9
        add_definitions(-DOSL_STATIC_LIBRARY)
        include_directories(
                SYSTEM
index fdd872f..2bf69c8 100644 (file)
@@ -28,6 +28,7 @@
 #include "kernel/osl/osl_globals.h"
 #include "kernel/osl/osl_services.h"
 #include "kernel/osl/osl_shader.h"
+#include "OSL/llvm_util.h"
 
 #include "util/util_foreach.h"
 #include "util/util_logging.h"
@@ -66,6 +67,14 @@ OSLShaderManager::~OSLShaderManager()
 {
        shading_system_free();
        texture_system_free();
+#ifdef OSL_HAS_BLENDER_CLEANUP_FIX
+       /* There is a problem with llvm+osl: The order global destructors across
+        * different compilation units run cannot be guaranteed, on windows this means
+        * that the llvm destructors run before the osl destructors, causing a crash
+        * when the process exits. the OSL in svn has a special cleanup hack to
+        * sidestep this behavior */
+       OSL::pvt::LLVM_Util::Cleanup();
+#endif
 }
 
 void OSLShaderManager::reset(Scene * /*scene*/)
index 75e2289..ac2c95d 100644 (file)
@@ -63,6 +63,9 @@ if(WITH_OPENCOLORIO)
                list(APPEND INC_SYS
                        ${BOOST_INCLUDE_DIR}
                )
+               add_definitions(
+                       -DOpenColorIO_STATIC
+               )
        endif()
 
        data_to_c_simple(gpu_shader_display_transform.glsl SRC)
index f666dc7..9ac0817 100644 (file)
@@ -38,6 +38,7 @@ set(SRC
 if(WITH_OPENVDB)
        add_definitions(
                -DWITH_OPENVDB
+               ${OPENVDB_DEFINITIONS}
        )
 
        if(WITH_OPENVDB_3_ABI_COMPATIBLE)
index d4246d9..e6772a0 100644 (file)
@@ -717,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)
@@ -780,12 +780,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()
@@ -834,15 +834,6 @@ elseif(WIN32)
                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"