Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions source/MaterialXContrib/MaterialXMaya/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ if (EXISTS "${MAYA_DEBUG_DIR}" OR EXISTS "${MAYA_RELEASE_DIR}")
${_headers}
)

if (${APPLE})
set(MAYA_PLUGIN_EXT ".bundle")
elseif(MSVC)
set(MAYA_PLUGIN_EXT ".mll")
else()
set(MAYA_PLUGIN_EXT ".so")
endif()

set_target_properties(
${PROJECT_NAME}
PROPERTIES
Expand All @@ -93,7 +101,7 @@ if (EXISTS "${MAYA_DEBUG_DIR}" OR EXISTS "${MAYA_RELEASE_DIR}")
VERSION ${MATERIALX_NODE_VERSION}
SOVERSION ${MATERIALX_NODE_VERSION}
PREFIX ""
SUFFIX ".mll"
SUFFIX ${MAYA_PLUGIN_EXT}
DEBUG_POSTFIX ""
)

Expand All @@ -120,6 +128,5 @@ if (EXISTS "${MAYA_DEBUG_DIR}" OR EXISTS "${MAYA_RELEASE_DIR}")
install(FILES ${_scripts} DESTINATION ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/scripts)
install(FILES ${_AEtemplate} DESTINATION ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/AEtemplate)
install(FILES ${_mods} DESTINATION ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resources DESTINATION "${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}")
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../../resources DESTINATION "${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}")
endif()
1 change: 1 addition & 0 deletions source/MaterialXContrib/MaterialXMaya/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ mx::FileSearchPath Plugin::getResourceSearchPath() const
builder.append(_pluginLoadPath);
builder.append(_pluginLoadPath / mx::FilePath("../../resources"));
builder.append(_pluginLoadPath / mx::FilePath("../resources"));
builder.append(_pluginLoadPath / mx::FilePath(".."));

builder.appendFromOptionVar("materialXResourceSearchPaths");
return searchPath;
Expand Down
12 changes: 9 additions & 3 deletions source/MaterialXContrib/MaterialXMaya/ShadingNodeOverrides.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "MayaUtil.h"

#include <maya/MDGModifier.h>
#include <maya/MGlobal.h>
#include <maya/MShaderManager.h>
#include <maya/MPxShadingNodeOverride.h>
#include <maya/MPxSurfaceShadingNodeOverride.h>
Expand Down Expand Up @@ -121,13 +122,18 @@ MStatus bindFileTexture(MHWRender::MShaderInstance& shaderInstance,
}
else
{
std::cerr << "*Unable to find image file: " << fileName << " in search paths: "
<< searchPath.asString() << std::endl;
MString message("*Unable to find image file: ");
message += fileName.c_str();
message += " in search paths: ";
message += searchPath.asString().c_str();
MGlobal::displayError(message);
}
status = shaderInstance.setParameter(parameterName.c_str(), textureAssignment);
if (!status)
{
std::cerr << "*Unable to bind image file: " << fileName << std::endl;
MString message("*Unable to bind image file: ");
message += fileName.c_str();
MGlobal::displayError(message);
}
}

Expand Down
8 changes: 7 additions & 1 deletion source/PyMaterialX/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ if(CMAKE_CXX_COMPILER_ID MATCHES Clang)
add_compile_options(-Wno-undefined-var-template)
endif()
endif()


# Add proper postfix for Python 2.7 on Windows when using a Debug interpreter:
set(MATERIALX_PYTHON_DEBUG_POSTFIX "")
if(MSVC AND PYTHON_IS_DEBUG AND (PYBIND11_PYTHON_VERSION VERSION_LESS 3.0))
set(MATERIALX_PYTHON_DEBUG_POSTFIX "_d")
Copy link
Collaborator Author

@JGamache-autodesk JGamache-autodesk Dec 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug interpreter, using python27_d.lib. This happens only if the MATERIALX_PYTHON_INTERPRETER was built in debug mode.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this also the case for Python3 and on other platforms?

Copy link
Collaborator Author

@JGamache-autodesk JGamache-autodesk Dec 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed for Python 2.7 version up to 3.8,only on Windows:
https://github.com/python/cpython/blob/c4cacc8c5eab50db8da3140353596f38a01115ca/PCbuild/readme.txt#L39

Has become a lot more complex for UNIX platforms following Python 3.2 (or actually a lot simpler by calling sysconfig.get_config_var('EXT_SUFFIX')):
Details: https://www.python.org/dev/peps/pep-3149/
Boost::python is aware: boostorg/build#321
Does not appear in PyBind11's issue tracker yet.

And with 3.8 debug and release binaries can coexist peacefully:
https://docs.python.org/3/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ashwinbhat for asking the right question. I ran tests and PyBind11 implements PEP 3149 for Python 3 perfectly on all test platforms. I made sure the suffix is only used for legacy Python 2.7 when a Debug interpreter is found, on the Windows platform.

endif()

add_subdirectory(PyMaterialXCore)
add_subdirectory(PyMaterialXFormat)
add_subdirectory(PyMaterialXGenShader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
# endif
# pragma warning(push)
# pragma warning(disable: 4510 4610 4512 4005)
# if defined(_DEBUG)
# if defined(_DEBUG) && !defined(Py_DEBUG)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix was submitted back to PyBind11. See pybind/pybind11#2025

# define PYBIND11_DEBUG_MARKER
# undef _DEBUG
# endif
Expand Down
2 changes: 1 addition & 1 deletion source/PyMaterialX/PyMaterialXCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set_target_properties(
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}"
DEBUG_POSTFIX "${MATERIALX_DEBUG_POSTFIX}")
DEBUG_POSTFIX "${MATERIALX_PYTHON_DEBUG_POSTFIX}")

target_link_libraries(
PyMaterialXCore
Expand Down
2 changes: 1 addition & 1 deletion source/PyMaterialX/PyMaterialXFormat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set_target_properties(
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}"
DEBUG_POSTFIX "${MATERIALX_DEBUG_POSTFIX}")
DEBUG_POSTFIX "${MATERIALX_PYTHON_DEBUG_POSTFIX}")

target_link_libraries(
PyMaterialXFormat
Expand Down
2 changes: 1 addition & 1 deletion source/PyMaterialX/PyMaterialXGenArnold/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set_target_properties(
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}"
DEBUG_POSTFIX "${MATERIALX_DEBUG_POSTFIX}")
DEBUG_POSTFIX "${MATERIALX_PYTHON_DEBUG_POSTFIX}")

target_link_libraries(
PyMaterialXGenArnold
Expand Down
2 changes: 1 addition & 1 deletion source/PyMaterialX/PyMaterialXGenGlsl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set_target_properties(
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}"
DEBUG_POSTFIX "${MATERIALX_DEBUG_POSTFIX}")
DEBUG_POSTFIX "${MATERIALX_PYTHON_DEBUG_POSTFIX}")

target_link_libraries(
PyMaterialXGenGlsl
Expand Down
2 changes: 1 addition & 1 deletion source/PyMaterialX/PyMaterialXGenOgsFx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set_target_properties(
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}"
DEBUG_POSTFIX "${MATERIALX_DEBUG_POSTFIX}")
DEBUG_POSTFIX "${MATERIALX_PYTHON_DEBUG_POSTFIX}")

target_link_libraries(
PyMaterialXGenOgsFx
Expand Down
2 changes: 1 addition & 1 deletion source/PyMaterialX/PyMaterialXGenOsl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set_target_properties(
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}"
DEBUG_POSTFIX "${MATERIALX_DEBUG_POSTFIX}")
DEBUG_POSTFIX "${MATERIALX_PYTHON_DEBUG_POSTFIX}")

target_link_libraries(
PyMaterialXGenOsl
Expand Down
2 changes: 1 addition & 1 deletion source/PyMaterialX/PyMaterialXGenShader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set_target_properties(
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}"
DEBUG_POSTFIX "${MATERIALX_DEBUG_POSTFIX}")
DEBUG_POSTFIX "${MATERIALX_PYTHON_DEBUG_POSTFIX}")

target_link_libraries(
PyMaterialXGenShader
Expand Down
2 changes: 1 addition & 1 deletion source/PyMaterialX/PyMaterialXRender/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set_target_properties(
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}"
DEBUG_POSTFIX "${MATERIALX_DEBUG_POSTFIX}")
DEBUG_POSTFIX "${MATERIALX_PYTHON_DEBUG_POSTFIX}")

if(NOT MATERIALX_BUILD_CONTRIB)
target_link_libraries(
Expand Down
3 changes: 2 additions & 1 deletion source/PyMaterialX/PyMaterialXRenderGlsl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ set_target_properties(
COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS}"
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}")
SOVERSION "${MATERIALX_MAJOR_VERSION}"
DEBUG_POSTFIX "${MATERIALX_PYTHON_DEBUG_POSTFIX}")

target_link_libraries(
PyMaterialXRenderGlsl
Expand Down
2 changes: 1 addition & 1 deletion source/PyMaterialX/PyMaterialXRenderOsl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set_target_properties(
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}"
VERSION "${MATERIALX_LIBRARY_VERSION}"
SOVERSION "${MATERIALX_MAJOR_VERSION}"
DEBUG_POSTFIX "${MATERIALX_DEBUG_POSTFIX}")
DEBUG_POSTFIX "${MATERIALX_PYTHON_DEBUG_POSTFIX}")

target_link_libraries(
PyMaterialXRenderOsl
Expand Down