Windows: Switch to the dynamic C runtime
authorRay Molenkamp <github@lazydodo.com>
Fri, 8 Nov 2019 16:01:00 +0000 (09:01 -0700)
committerRay Molenkamp <github@lazydodo.com>
Fri, 8 Nov 2019 16:01:00 +0000 (09:01 -0700)
This change switches windows to the dynamic C runtime
avoiding issues coming from mixing the static and dynamic
runtime like the ones outlined in [1]

[1] https://developer.blender.org/D5387#122165

Differential Revision: https://developer.blender.org/D6175

Reviewed by: @Sergey

23 files changed:
build_files/build_environment/cmake/alembic.cmake
build_files/build_environment/cmake/boost.cmake
build_files/build_environment/cmake/clang.cmake
build_files/build_environment/cmake/harvest.cmake
build_files/build_environment/cmake/llvm.cmake
build_files/build_environment/cmake/opencolorio.cmake
build_files/build_environment/cmake/openimageio.cmake
build_files/build_environment/cmake/opensubdiv.cmake
build_files/build_environment/cmake/openvdb.cmake
build_files/build_environment/cmake/options.cmake
build_files/build_environment/cmake/osl.cmake
build_files/build_environment/cmake/versions.cmake
build_files/build_environment/cmake/webp.cmake
build_files/build_environment/cmake/yamlcpp.cmake
build_files/build_environment/patches/opencollada.diff
build_files/cmake/macros.cmake
build_files/cmake/platform/platform_win32.cmake
build_files/windows/check_libraries.cmd
build_files/windows/find_dependencies.cmd
build_files/windows/format.cmd
intern/cycles/CMakeLists.txt
intern/openvdb/CMakeLists.txt
source/blender/blenlib/intern/expr_pylike_eval.c

index fa2d7243f7d194f2d514662e064039b9bff47087..49c54ff6e826be67713a075d77bcd2f1b3e85477 100644 (file)
@@ -40,7 +40,7 @@ set(ALEMBIC_EXTRA_ARGS
   -DBoost_USE_MULTITHREADED=ON
   -DUSE_STATIC_BOOST=On
   -DBoost_USE_STATIC_LIBS=ON
-  -DBoost_USE_STATIC_RUNTIME=ON
+  -DBoost_USE_STATIC_RUNTIME=OFF
   -DBoost_DEBUG=ON
   -DBOOST_ROOT=${LIBDIR}/boost
   -DBoost_NO_SYSTEM_PATHS=ON
index fabc055ce29e4fc97d97b6b338827c97e3ac2573..4c5ce749cd52a1ea3c3ee7bc360233fbd295e811 100644 (file)
@@ -29,13 +29,13 @@ if(WIN32)
     set(PYTHON_OUTPUTDIR ${BUILD_DIR}/python/src/external_python/pcbuild/win32/)
     set(BOOST_ADDRESS_MODEL 32)
   endif()
-  if(MSVC14)
-    set(BOOST_TOOLSET toolset=msvc-14.0)
-    set(BOOST_COMPILER_STRING -vc140)
-  endif()
+
+  set(BOOST_TOOLSET toolset=msvc-14.1)
+  set(BOOST_COMPILER_STRING -vc141)
+
   set(BOOST_CONFIGURE_COMMAND bootstrap.bat)
   set(BOOST_BUILD_COMMAND bjam)
-  set(BOOST_BUILD_OPTIONS runtime-link=static )
+  set(BOOST_BUILD_OPTIONS runtime-link=shared )
   set(BOOST_HARVEST_CMD   ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/lib/ ${HARVEST_TARGET}/boost/lib/ )
   if(BUILD_MODE STREQUAL Release)
     set(BOOST_HARVEST_CMD ${BOOST_HARVEST_CMD} && ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/include/boost-1_68/ ${HARVEST_TARGET}/boost/include/)
index f1f537baf1d78b4aa4a2d88bbe0eaf836785a683..3231a339e1753a0d2fd4379ff0d87acf2fa89c81 100644 (file)
@@ -19,8 +19,8 @@
 set(CLANG_EXTRA_ARGS
   -DCLANG_PATH_TO_LLVM_SOURCE=${BUILD_DIR}/ll/src/ll
   -DCLANG_PATH_TO_LLVM_BUILD=${LIBDIR}/llvm
-  -DLLVM_USE_CRT_RELEASE=MT
-  -DLLVM_USE_CRT_DEBUG=MTd
+  -DLLVM_USE_CRT_RELEASE=MD
+  -DLLVM_USE_CRT_DEBUG=MDd
   -DLLVM_CONFIG=${LIBDIR}/llvm/bin/llvm-config
 )
 
index cc596b2c78654f175540eba5de49c8cac3860dcb..38820dfb6730b2dd0935b1c96394072f0f525c6f 100644 (file)
@@ -53,8 +53,6 @@ if(BUILD_MODE STREQUAL Release)
         ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tiff/include/ ${HARVEST_TARGET}/tiff/include/ &&
         # hidapi
         ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/hidapi/ ${HARVEST_TARGET}/hidapi/ &&
-        # webp, straight up copy
-        ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/webp ${HARVEST_TARGET}/webp &&
     DEPENDS
   )
 endif()
index 8acf6b56e3df24af4cf6d603f98a6117564a8dbe..dc1a5cf8a80215adb7daf530b39e04f307fe0aba 100644 (file)
@@ -17,8 +17,8 @@
 # ***** END GPL LICENSE BLOCK *****
 
 set(LLVM_EXTRA_ARGS
-  -DLLVM_USE_CRT_RELEASE=MT
-  -DLLVM_USE_CRT_DEBUG=MTd
+  -DLLVM_USE_CRT_RELEASE=MD
+  -DLLVM_USE_CRT_DEBUG=MDd
   -DLLVM_INCLUDE_TESTS=OFF
   -DLLVM_TARGETS_TO_BUILD=X86
   -DLLVM_INCLUDE_EXAMPLES=OFF
index 1260a1217dde51ef4eb045e6098c69ce55b1c88f..d75b4325847d6e343ab7bfc362cccc38e3190a75 100644 (file)
@@ -103,7 +103,7 @@ if(WIN32)
   if(BUILD_MODE STREQUAL Debug)
     ExternalProject_Add_Step(external_opencolorio after_install
       COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/lib/static/Opencolorio.lib ${HARVEST_TARGET}/opencolorio/lib/OpencolorIO_d.lib
-      COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/libyaml-cppmtd.lib ${HARVEST_TARGET}/opencolorio/lib/libyaml-cpp_d.lib
+      COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/libyaml-cppmdd.lib ${HARVEST_TARGET}/opencolorio/lib/libyaml-cpp_d.lib
       COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tinyxml/lib/tinyxml.lib ${HARVEST_TARGET}/opencolorio/lib/tinyxml_d.lib
       DEPENDEES install
     )
index 920e9ee0273e6be591d0bec06e54b23b0479cba2..57b8860f2bd065c542fb2e4e3b67f76ae18f2de1 100644 (file)
@@ -69,7 +69,7 @@ set(OPENIMAGEIO_EXTRA_ARGS
   -DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
   -DBoost_USE_MULTITHREADED=ON
   -DBoost_USE_STATIC_LIBS=ON
-  -DBoost_USE_STATIC_RUNTIME=ON
+  -DBoost_USE_STATIC_RUNTIME=OFF
   -DBOOST_ROOT=${LIBDIR}/boost
   -DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
   -DBoost_NO_SYSTEM_PATHS=ON
index b81170c72b749ded7cee6e997770ba8e5c09eb56..5c1ebe46a20fc3764f1443d8984fe4d403d44216 100644 (file)
@@ -41,7 +41,6 @@ if(WIN32)
     -DCLEW_LIBRARY=${LIBDIR}/clew/lib/clew${LIBEXT}
     -DCUEW_INCLUDE_DIR=${LIBDIR}/cuew/include
     -DCUEW_LIBRARY=${LIBDIR}/cuew/lib/cuew${LIBEXT}
-    -DCMAKE_EXE_LINKER_FLAGS_RELEASE=libcmt.lib
   )
   if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
     set(OPENSUBDIV_EXTRA_ARGS
index 215b3e8f2fe16ece80e15d7d795a577530532e8c..c73cf2681aee7e90971ccf172b9329195fd36d9e 100644 (file)
@@ -24,7 +24,7 @@ set(OPENVDB_EXTRA_ARGS
   -DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
   -DBoost_USE_MULTITHREADED=ON
   -DBoost_USE_STATIC_LIBS=ON
-  -DBoost_USE_STATIC_RUNTIME=ON
+  -DBoost_USE_STATIC_RUNTIME=OFF
   -DBOOST_ROOT=${LIBDIR}/boost
   -DBoost_NO_SYSTEM_PATHS=ON
   -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
index 52b850a021f98c2846aeb62e1d049ab7d10f4eb8..af9f8b6271d9d8b8601169e173441e9758cf3616 100644 (file)
@@ -62,22 +62,22 @@ if(WIN32)
   endif()
   set(COMMON_MSVC_FLAGS "${COMMON_MSVC_FLAGS} /bigobj")
   if(WITH_OPTIMIZED_DEBUG)
-    set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+    set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
   else()
-    set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+    set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
   endif()
-  set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MT ${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
-  set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MT ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
-  set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MT ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+  set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MD ${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+  set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+  set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
 
   if(WITH_OPTIMIZED_DEBUG)
-    set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MTd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+    set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
   else()
     set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /MTd  ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
   endif()
-  set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MT /${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG  /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
-  set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MT ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
-  set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+  set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MD /${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG  /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+  set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+  set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
 
   set(PLATFORM_FLAGS)
   set(PLATFORM_CXX_FLAGS)
@@ -97,8 +97,8 @@ if(WIN32)
 
   set(CONFIGURE_ENV
     cd ${MINGW_PATH} &&
-    call ${MINGW_SHELL} &&
     call ${PERL_SHELL} &&
+    call ${MINGW_SHELL} &&
     set path &&
     set CFLAGS=-g &&
     set LDFLAGS=-Wl,--as-needed -static-libgcc
index 4e0a924530a57fbe5b1577f80c2eed9743922092..840eb87b1962612197aaf743addebbe416ab5ed0 100644 (file)
@@ -40,7 +40,7 @@ set(OSL_EXTRA_ARGS
   -DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
   -DBoost_USE_MULTITHREADED=ON
   -DBoost_USE_STATIC_LIBS=ON
-  -DBoost_USE_STATIC_RUNTIME=ON
+  -DBoost_USE_STATIC_RUNTIME=OFF
   -DBOOST_ROOT=${LIBDIR}/boost
   -DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
   -DBoost_NO_SYSTEM_PATHS=ON
index a261b5fd5049622063827bbab0acce6d2e329c5c..af071fbb0192a955b72db71654f671bb06d05673 100644 (file)
@@ -263,9 +263,9 @@ set(TINYXML_VERSION_DOTS 2.6.2)
 set(TINYXML_URI https://nchc.dl.sourceforge.net/project/tinyxml/tinyxml/${TINYXML_VERSION_DOTS}/tinyxml_${TINYXML_VERSION}.tar.gz)
 set(TINYXML_HASH c1b864c96804a10526540c664ade67f0)
 
-set(YAMLCPP_VERSION 0.6.2)
+set(YAMLCPP_VERSION 0.6.3)
 set(YAMLCPP_URI https://codeload.github.com/jbeder/yaml-cpp/tar.gz/yaml-cpp-${YAMLCPP_VERSION})
-set(YAMLCPP_HASH 5b943e9af0060d0811148b037449ef82)
+set(YAMLCPP_HASH b45bf1089a382e81f6b661062c10d0c2)
 
 set(LCMS_VERSION 2.9)
 set(LCMS_URI https://nchc.dl.sourceforge.net/project/lcms/lcms/${LCMS_VERSION}/lcms2-${LCMS_VERSION}.tar.gz)
index 73557859ae66448bf4b7faaf7678f08bfc23f9c9..7d5a533335671984952f8352c5909d9467aa5be6 100644 (file)
@@ -39,3 +39,12 @@ ExternalProject_Add(external_webp
   CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/webp -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${WEBP_EXTRA_ARGS}
   INSTALL_DIR ${LIBDIR}/webp
 )
+
+if(WIN32)
+  if(BUILD_MODE STREQUAL Release)
+    ExternalProject_Add_Step(external_webp after_install
+      COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/webp ${HARVEST_TARGET}/webp
+      DEPENDEES install
+    )
+  endif()
+endif()
index b0ce77d079f9de24bc4b4e97e405ef2389b705b0..3d3639593adc0ba509dd7bd63cfa68f77fb1936c 100644 (file)
@@ -21,7 +21,7 @@ set(YAMLCPP_EXTRA_ARGS
   -DYAML_CPP_BUILD_TESTS=OFF
   -DYAML_CPP_BUILD_TOOLS=OFF
   -DYAML_CPP_BUILD_CONTRIB=OFF
-  -DMSVC_SHARED_RT=OFF
+  -DYAML_MSVC_SHARED_RT=ON
 )
 
 ExternalProject_Add(external_yamlcpp
index 48a5008f356a8e256903d3407bbb72e0ad6444fb..19498e517063cf0be19f7f779c3fe13f445afe15 100644 (file)
@@ -3,19 +3,19 @@ index 95abbe2..4f14f30 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -254,11 +254,11 @@ if(USE_STATIC_MSVC_RUNTIME)
- endif()\r
\r
- #adding PCRE\r
--find_package(PCRE)\r
-+#find_package(PCRE)\r
- if (PCRE_FOUND)\r
-       message(STATUS "SUCCESSFUL: PCRE found")\r
- else ()  # if pcre not found building its local copy from ./Externals\r
--      if (WIN32 OR APPLE)\r
-+      if (1)\r
-               message("WARNING: Native PCRE not found, taking PCRE from ./Externals")\r
-               add_definitions(-DPCRE_STATIC)\r
-               add_subdirectory(${EXTERNAL_LIBRARIES}/pcre)\r
+ endif()
+ #adding PCRE
+-find_package(PCRE)
++#find_package(PCRE)
+ if (PCRE_FOUND)
+       message(STATUS "SUCCESSFUL: PCRE found")
+ else ()  # if pcre not found building its local copy from ./Externals
+-      if (WIN32 OR APPLE)
++      if (1)
+               message("WARNING: Native PCRE not found, taking PCRE from ./Externals")
+               add_definitions(-DPCRE_STATIC)
+               add_subdirectory(${EXTERNAL_LIBRARIES}/pcre)
 diff --git a/DAEValidator/library/include/no_warning_begin b/DAEValidator/library/include/no_warning_begin
 index 7a69c32..defb315 100644
 --- a/DAEValidator/library/include/no_warning_begin
@@ -43,3 +43,34 @@ index 1f9a3ee..d151e9a 100644
          return isnan( value );
  #else
          return std::isnan(value);
+diff --git a/DAEValidator/CMakeLists.txt b/DAEValidator/CMakeLists.txt
+index 03ad540f..f7d05cfb 100644
+--- a/DAEValidator/CMakeLists.txt
++++ b/DAEValidator/CMakeLists.txt
+@@ -98,7 +98,7 @@ if (WIN32)
+ # C4710: 'function' : function not inlined
+ # C4711: function 'function' selected for inline expansion
+ # C4820: 'bytes' bytes padding added after construct 'member_name'
+-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /Wall /WX /wd4505 /wd4514 /wd4592 /wd4710 /wd4711 /wd4820")
++      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /Wall /wd4505 /wd4514 /wd4592 /wd4710 /wd4711 /wd4820")
+ else ()
+       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror")
+ endif ()
+diff --git a/DAEValidator/library/src/ArgumentParser.cpp b/DAEValidator/library/src/ArgumentParser.cpp
+index 897e4dcf..98a69ff1 100644
+--- a/DAEValidator/library/src/ArgumentParser.cpp
++++ b/DAEValidator/library/src/ArgumentParser.cpp
+@@ -6,10 +6,10 @@
+ using namespace std;
+-#ifdef _MSC_VER
+-#define NOEXCEPT _NOEXCEPT
+-#else
++#ifndef _NOEXCEPT
+ #define NOEXCEPT noexcept
++#else
++#define NOEXCEPT _NOEXCEPT
+ #endif
+ namespace opencollada
\ No newline at end of file
index 4f5abf8d5611ae25b1703fa7c03dfbdac73d710a..4bc0565754cd9e21ca01743366bc82385784980f 100644 (file)
@@ -396,6 +396,7 @@ endfunction()
 
 macro(setup_platform_linker_flags)
   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
+  set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${PLATFORM_LINKFLAGS_RELEASE}")
   set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
 endmacro()
 
@@ -405,12 +406,15 @@ function(setup_liblinks
 
   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
   set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
+  set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${PLATFORM_LINKFLAGS_RELEASE}" PARENT_SCOPE)
 
   set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
   set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
+  set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${PLATFORM_LINKFLAGS_RELEASE}" PARENT_SCOPE)
 
   set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
   set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
+  set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${PLATFORM_LINKFLAGS_RELEASE}" PARENT_SCOPE)
 
   # jemalloc must be early in the list, to be before pthread (see T57998)
   if(WITH_MEM_JEMALLOC)
index e2006be8fc2a3f84cf5354d0a93b5a6d27ee2149..9fe5359c5bd3b777531bfe8332910de2f0f9597c 100644 (file)
@@ -151,14 +151,14 @@ else()
   set(CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj")
 endif()
 
-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd /ZI")
-set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd /ZI")
-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
-set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
-set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MT")
-set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MT")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT")
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /ZI")
+set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd /ZI")
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
+set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MD")
+set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MD")
+set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MD")
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MD")
 
 # JMC is available on msvc 15.8 (1915) and up
 if(MSVC_VERSION GREATER 1914 AND NOT MSVC_CLANG)
@@ -166,7 +166,8 @@ if(MSVC_VERSION GREATER 1914 AND NOT MSVC_CLANG)
 endif()
 
 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ")
-set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib ")
+set(PLATFORM_LINKFLAGS_RELEASE "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib")
+set(PLATFORM_LINKFLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG} /IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcmtd.lib")
 
 # Ignore meaningless for us linker warnings.
 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /ignore:4049 /ignore:4217 /ignore:4221")
@@ -178,8 +179,6 @@ else()
   set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
 endif()
 
-set(PLATFORM_LINKFLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG} /IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
-
 if(NOT DEFINED LIBDIR)
 
   # Setup 64bit and 64bit windows systems
@@ -192,22 +191,19 @@ if(NOT DEFINED LIBDIR)
   # Can be 1910..1912
   if(MSVC_VERSION GREATER 1919)
     message(STATUS "Visual Studio 2019 detected.")
-    set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
+    set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
   elseif(MSVC_VERSION GREATER 1909)
     message(STATUS "Visual Studio 2017 detected.")
-    set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
+    set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
   elseif(MSVC_VERSION EQUAL 1900)
     message(STATUS "Visual Studio 2015 detected.")
-    set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
-  else()
-    message(STATUS "Visual Studio 2013 detected.")
-    set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc12)
+    set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
   endif()
 else()
   message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
 endif()
 if(NOT EXISTS "${LIBDIR}/")
-  message(FATAL_ERROR "Windows requires pre-compiled libs at: '${LIBDIR}'")
+  message(FATAL_ERROR "\n\nWindows requires pre-compiled libs at: '${LIBDIR}'. Please run `make update` in the blender source folder to obtain them.")
 endif()
 
 # Mark libdir as system headers with a lower warn level, to resolve some warnings
@@ -397,8 +393,8 @@ if(WITH_BOOST)
     set(BOOST_INCLUDE_DIR ${BOOST}/include)
     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")
+      set(BOOST_POSTFIX "vc141-mt-x64-1_68.lib")
+      set(BOOST_DEBUG_POSTFIX "vc141-mt-gd-x64-1_68.lib")
     endif()
     set(BOOST_LIBRARIES
       optimized ${BOOST_LIBPATH}/libboost_date_time-${BOOST_POSTFIX}
@@ -503,8 +499,12 @@ if(WITH_OPENIMAGEDENOISE)
   set(OPENIMAGEDENOISE_LIBPATH ${LIBDIR}/OpenImageDenoise/lib)
   set(OPENIMAGEDENOISE_INCLUDE_DIRS ${OPENIMAGEDENOISE}/include)
   set(OPENIMAGEDENOISE_LIBRARIES
-    optimized ${OPENIMAGEDENOISE_LIBPATH}/OpenImageDenoise.lib ${OPENIMAGEDENOISE_LIBPATH}/common.lib ${OPENIMAGEDENOISE_LIBPATH}/mkldnn.lib
-    debug ${OPENIMAGEDENOISE_LIBPATH}/OpenImageDenoise_d.lib ${OPENIMAGEDENOISE_LIBPATH}/common_d.lib ${OPENIMAGEDENOISE_LIBPATH}/mkldnn_d.lib)
+    optimized ${OPENIMAGEDENOISE_LIBPATH}/OpenImageDenoise.lib
+    optimized ${OPENIMAGEDENOISE_LIBPATH}/common.lib
+    optimized ${OPENIMAGEDENOISE_LIBPATH}/mkldnn.lib
+    debug ${OPENIMAGEDENOISE_LIBPATH}/OpenImageDenoise_d.lib
+    debug ${OPENIMAGEDENOISE_LIBPATH}/common_d.lib
+    debug ${OPENIMAGEDENOISE_LIBPATH}/mkldnn_d.lib)
   set(OPENIMAGEDENOISE_DEFINITIONS)
 endif()
 
index 24b30c6a9b0408c4f1ec6fbbf7024d69269794e5..8e43cda9eb77cb0855085e8975ab2eaf5d1ef588 100644 (file)
@@ -1,6 +1,5 @@
-if "%BUILD_VS_YEAR%"=="2015" set BUILD_VS_LIBDIRPOST=vc14
-if "%BUILD_VS_YEAR%"=="2017" set BUILD_VS_LIBDIRPOST=vc14
-if "%BUILD_VS_YEAR%"=="2019" set BUILD_VS_LIBDIRPOST=vc14
+if "%BUILD_VS_YEAR%"=="2017" set BUILD_VS_LIBDIRPOST=vc15
+if "%BUILD_VS_YEAR%"=="2019" set BUILD_VS_LIBDIRPOST=vc15
 
 set BUILD_VS_SVNDIR=win64_%BUILD_VS_LIBDIRPOST%
 set BUILD_VS_LIBDIR="%BLENDER_DIR%..\lib\%BUILD_VS_SVNDIR%"
index 7419a0bc77ee1cbf86564aceddcd38c1f6abb140..0b6ae2d3c32ea90bac73b32f3d76b10c8f9522ee 100644 (file)
@@ -3,7 +3,7 @@ for %%X in (svn.exe) do (set SVN=%%~$PATH:X)
 for %%X in (cmake.exe) do (set CMAKE=%%~$PATH:X)
 for %%X in (ctest.exe) do (set CTEST=%%~$PATH:X)
 for %%X in (git.exe) do (set GIT=%%~$PATH:X)
-set PYTHON=%BLENDER_DIR%\..\lib\win64_vc14\python\37\bin\python.exe
+set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\37\bin\python.exe
 if NOT "%verbose%" == "" (
        echo svn    : "%SVN%"
        echo cmake  : "%CMAKE%"
index 43f8b61727d7a213c527f651892411a6051516b6..d19595bf0423388e25b934e70f8c2af25d0dd499 100644 (file)
@@ -1,5 +1,5 @@
-if EXIST %BLENDER_DIR%\..\lib\win64_vc14\llvm\bin\clang-format.exe (
-    set CF_PATH=..\lib\win64_vc14\llvm\bin
+if EXIST %BLENDER_DIR%\..\lib\win64_vc15\llvm\bin\clang-format.exe (
+    set CF_PATH=..\lib\win64_vc15\llvm\bin
     goto detect_done
 )
 
@@ -10,7 +10,7 @@ exit /b 1
 echo found clang-format in %CF_PATH%
 
 if EXIST %PYTHON% (
-    set PYTHON=%BLENDER_DIR%\..\lib\win64_vc14\python\37\bin\python.exe
+    set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\37\bin\python.exe
     goto detect_python_done
 )
 
index a32911568c571cecddfd7251d9ed7bd5882cf534..6f6bd7ec2cca8b63326edca26a14317d393a4a9f 100644 (file)
@@ -362,6 +362,9 @@ if(WITH_OPENCOLORIO)
     SYSTEM
     ${OPENCOLORIO_INCLUDE_DIRS}
   )
+  if(WIN32)
+    add_definitions(-DOpenColorIO_STATIC)
+  endif()
 endif()
 
 if(WITH_CYCLES_STANDALONE OR WITH_CYCLES_NETWORK OR WITH_CYCLES_CUBIN_COMPILER)
index 412dade0f1a7a1525e9ac7751d96d67fee015c39..5d51e6c3dbc08bdcde990b7aac6405ced8c43748 100644 (file)
@@ -40,6 +40,12 @@ if(WITH_OPENVDB)
     ${OPENVDB_DEFINITIONS}
   )
 
+  if(WIN32)
+    add_definitions(
+      -DOPENVDB_STATICLIB
+    )
+  endif()
+
   if(WITH_OPENVDB_3_ABI_COMPATIBLE)
     add_definitions(
       -DOPENVDB_3_ABI_COMPATIBLE
index c7631f8991e14321048c7588d4ff9009ae43810b..43923ce8c981ab9a811de1e37393d9e4f9772c55 100644 (file)
@@ -357,6 +357,13 @@ typedef struct BuiltinOpDef {
   void *funcptr;
 } BuiltinOpDef;
 
+#ifdef _MSC_VER
+/* Prevent MSVC from inlining calls to ceil/floor so the table below can get a function pointer to
+ * them. */
+#  pragma function(ceil)
+#  pragma function(floor)
+#endif
+
 static BuiltinOpDef builtin_ops[] = {
     {"radians", OPCODE_FUNC1, op_radians},
     {"degrees", OPCODE_FUNC1, op_degrees},