[Bf-blender-cvs] [b46245470f7] master: cmake: Fix python linker issues on windows.

Ray Molenkamp noreply at git.blender.org
Wed Apr 17 21:26:21 CEST 2019


Commit: b46245470f79cdacf879954bfa9f6e4cc0d80f0e
Author: Ray Molenkamp
Date:   Wed Apr 17 13:26:02 2019 -0600
Branches: master
https://developer.blender.org/rBb46245470f79cdacf879954bfa9f6e4cc0d80f0e

cmake: Fix python linker issues on windows.

Recent cmake work made the debug build link both python37.dll and python37_d.dll

===================================================================

M	build_files/cmake/macros.cmake
M	build_files/cmake/platform/platform_win32.cmake

===================================================================

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 699f9cb1a99..56d9117e560 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -383,18 +383,10 @@ function(setup_liblinks
     ${FREETYPE_LIBRARY}
   )
 
-  # since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
-  if(WITH_PYTHON)  # AND NOT WITH_PYTHON_MODULE  # WIN32 needs
-    target_link_libraries(${target} ${PYTHON_LINKFLAGS})
 
-    if(WIN32 AND NOT UNIX)
-      file_list_suffix(PYTHON_LIBRARIES_DEBUG "${PYTHON_LIBRARIES}" "_d")
-      target_link_libraries_debug(${target} "${PYTHON_LIBRARIES_DEBUG}")
-      target_link_libraries_optimized(${target} "${PYTHON_LIBRARIES}")
-      unset(PYTHON_LIBRARIES_DEBUG)
-    else()
-      target_link_libraries(${target} ${PYTHON_LIBRARIES})
-    endif()
+  if(WITH_PYTHON)
+    target_link_libraries(${target} ${PYTHON_LINKFLAGS})
+    target_link_libraries(${target} ${PYTHON_LIBRARIES})
   endif()
 
   if(WITH_LZO AND WITH_SYSTEM_LZO)
diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
index 7b516d87f38..dce0e73cb37 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -339,6 +339,8 @@ if(WITH_PYTHON)
   string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
   # Use shared libs for vc2008 and vc2010 until we actually have vc2010 libs
   set(PYTHON_LIBRARY ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.lib)
+  set(PYTHON_LIBRARY_DEBUG ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}_d.lib)
+
   unset(_PYTHON_VERSION_NO_DOTS)
 
   # Shared includes for both vc2008 and vc2010
@@ -346,7 +348,7 @@ if(WITH_PYTHON)
 
   # uncached vars
   set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
-  set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
+  set(PYTHON_LIBRARIES debug "${PYTHON_LIBRARY_DEBUG}" optimized "${PYTHON_LIBRARY}" )
 endif()
 
 if(WITH_BOOST)



More information about the Bf-blender-cvs mailing list