diff --git a/build_files/build_environment/cmake/materialx.cmake b/build_files/build_environment/cmake/materialx.cmake index b8aa1947885..14f153a2bb8 100644 --- a/build_files/build_environment/cmake/materialx.cmake +++ b/build_files/build_environment/cmake/materialx.cmake @@ -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() diff --git a/build_files/build_environment/cmake/openimageio.cmake b/build_files/build_environment/cmake/openimageio.cmake index 857970f86bd..0deaf6a0eb3 100644 --- a/build_files/build_environment/cmake/openimageio.cmake +++ b/build_files/build_environment/cmake/openimageio.cmake @@ -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} diff --git a/build_files/build_environment/patches/usd.diff b/build_files/build_environment/patches/usd.diff index 44772f206c3..5b19ef5f00d 100644 --- a/build_files/build_environment/patches/usd.diff +++ b/build_files/build_environment/patches/usd.diff @@ -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()