Commit: 8efe90f0a01fa3fcae68c02952aefb9c15c7c0d0 Author: Martijn Berger Date: Thu Mar 31 13:45:33 2016 +0200 Branches: blender-v2.77-release https://developer.blender.org/rB8efe90f0a01fa3fcae68c02952aefb9c15c7c0d0
CMAKE / msvc openmp, delay loading of openmp dll so we can set environment variable before it is loaded =================================================================== M CMakeLists.txt M source/creator/creator.c =================================================================== diff --git a/CMakeLists.txt b/CMakeLists.txt index 9028f94..198995a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1292,6 +1292,17 @@ elseif(WIN32) set(PLATFORM_LINKFLAGS_DEBUG "/IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib") + # Use dynamic loading for OpenMP + if(WITH_OPENMP) + if(MSVC_VERSION EQUAL 1800) + set(OPENMP_DLL_NAME "vcomp120") + else() + set(OPENMP_DLL_NAME "vcomp140") + endif() + set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib") + set(PLATFORM_LINKFLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG} /DELAYLOAD::${OPENMP_DLL_NAME}d.dll delayimp.lib") + endif() + if(NOT DEFINED LIBDIR) # Setup 64bit and 64bit windows systems diff --git a/source/creator/creator.c b/source/creator/creator.c index b2bfe7f..bf8347d 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1816,6 +1816,11 @@ int main( #ifdef WIN32 + /* We delay loading of openmp so we can set the policy here. */ +# if defined(_MSC_VER) + _putenv_s("OMP_WAIT_POLICY", "PASSIVE"); +# endif + /* FMA3 support in the 2013 CRT is broken on Vista and Windows 7 RTM (fixed in SP1). Just disable it. */ # if defined(_MSC_VER) && defined(_M_X64) _set_FMA3_enable(0); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs