deps/win: Fix failing script_bundled_modules test in debug build

The resulting .pyd files for a debug build had wrong filenames.
MaterialX and OpenImageio used incorrect soabi tags, while usd
had a double _d_d postfix.

These changes should not affect linux+mac
This commit is contained in:
Ray Molenkamp 2024-06-10 08:38:50 -06:00
parent f9a75d1e40
commit a309b4c8d1
3 changed files with 33 additions and 0 deletions

@ -18,6 +18,11 @@ set(MATERIALX_EXTRA_ARGS
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
LIST(APPEND MATERIALX_EXTRA_ARGS -DPYTHON_MODULE_EXTENSION=.pyd)
else()
LIST(APPEND MATERIALX_EXTRA_ARGS -DPYTHON_MODULE_EXTENSION=_d.pyd)
endif()
LIST(APPEND MATERIALX_EXTRA_ARGS -DPYTHON_LIBRARIES=${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}${PYTHON_POSTFIX}.lib)
endif()

@ -108,6 +108,21 @@ set(OPENIMAGEIO_EXTRA_ARGS
-Dfmt_ROOT=${LIBDIR}/fmt
)
if(WIN32)
# We don't want the SOABI tags in the final filename since it gets the debug
# tags wrong and the final .pyd won't be found by python, pybind11 will try to
# get the tags and dump them into PYTHON_MODULE_EXTENSION every time the current
# python interperter doesn't match the old one, overwriting our preference.
# To side step this behavior we set PYBIND11_PYTHON_EXECUTABLE_LAST so it'll
# leave the PYTHON_MODULE_EXTENSION value we set alone.
LIST(APPEND OPENIMAGEIO_EXTRA_ARGS -DPYBIND11_PYTHON_EXECUTABLE_LAST=${PYTHON_BINARY})
if(BUILD_MODE STREQUAL Release)
LIST(APPEND OPENIMAGEIO_EXTRA_ARGS -DPYTHON_MODULE_EXTENSION=.pyd)
else()
LIST(APPEND OPENIMAGEIO_EXTRA_ARGS -DPYTHON_MODULE_EXTENSION=_d.pyd)
endif()
endif()
ExternalProject_Add(external_openimageio
URL file://${PACKAGE_DIR}/${OPENIMAGEIO_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}

@ -142,3 +142,16 @@ index 53c026689..e99a5ac17 100644
plugin
)
diff --git a/cmake/macros/Private.cmake b/cmake/macros/Private.cmake
index f0bc34ed8..c39db4bc4 100644
--- a/cmake/macros/Private.cmake
+++ b/cmake/macros/Private.cmake
@@ -979,7 +979,7 @@ function(_pxr_python_module NAME)
return()
endif()
- if (WIN32 AND PXR_USE_DEBUG_PYTHON)
+ if (WIN32 AND PXR_USE_DEBUG_PYTHON AND NOT "${CMAKE_DEBUG_POSTFIX}" STREQUAL "_d")
# On Windows when compiling with debug python the library must be named with _d.
set(LIBRARY_NAME "_${NAME}_d")
else()