Skip to content

Commit

Permalink
Merge pull request #1478 from seando-adsk/donnels/debug_build_support
Browse files Browse the repository at this point in the history
Full debug (with debug python) build support

(Internal change: 2184287)
  • Loading branch information
pixar-oss committed Aug 20, 2021
2 parents c328b04 + 5bf5247 commit 8cf99d8
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 57 deletions.
162 changes: 119 additions & 43 deletions build_scripts/build_usd.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cmake/defaults/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ option(PXR_ENABLE_MATERIALX_SUPPORT "Enable MaterialX support" OFF)
option(PXR_BUILD_DOCUMENTATION "Generate doxygen documentation" OFF)
option(PXR_ENABLE_PYTHON_SUPPORT "Enable Python based components for USD" ON)
option(PXR_USE_PYTHON_3 "Build Python bindings for Python 3" OFF)
option(PXR_USE_DEBUG_PYTHON "Build with debug python" OFF)
option(PXR_ENABLE_HDF5_SUPPORT "Enable HDF5 backend in the Alembic plugin for USD" ON)
option(PXR_ENABLE_OSL_SUPPORT "Enable OSL (OpenShadingLanguage) based components" OFF)
option(PXR_ENABLE_PTEX_SUPPORT "Enable Ptex support" ON)
Expand Down
4 changes: 4 additions & 0 deletions cmake/defaults/Packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ if(PXR_ENABLE_PYTHON_SUPPORT)
find_package(PythonLibs 2.7 REQUIRED)
endif()

if(WIN32 AND PXR_USE_DEBUG_PYTHON)
set(Boost_USE_DEBUG_PYTHON ON)
endif()

# This option indicates that we don't want to explicitly link to the python
# libraries. See BUILDING.md for details.
if(PXR_PY_UNDEFINED_DYNAMIC_LOOKUP AND NOT WIN32 )
Expand Down
5 changes: 5 additions & 0 deletions cmake/defaults/msvcdefaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ if (NOT Boost_USE_STATIC_LIBS)
_add_define("BOOST_ALL_DYN_LINK")
endif()

if(${PXR_USE_DEBUG_PYTHON})
_add_define("BOOST_DEBUG_PYTHON")
_add_define("BOOST_LINKING_PYTHON")
endif()

# Need half::_toFloat and half::_eLut.
_add_define("OPENEXR_DLL")

Expand Down
35 changes: 24 additions & 11 deletions cmake/macros/Private.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ endfunction() # _copy_headers
# our naming conventions, e.g. Tf
function(_get_python_module_name LIBRARY_FILENAME MODULE_NAME)
# Library names are either something like tf.so for shared libraries
# or _tf.so for Python module libraries. We want to strip the leading
# "_" off.
string(REPLACE "_" "" LIBNAME ${LIBRARY_FILENAME})
# or _tf.pyd/_tf_d.pyd for Python module libraries.
# We want to strip off the leading "_" and the trailing "_d".
set(LIBNAME ${LIBRARY_FILENAME})
if (PXR_USE_DEBUG_PYTHON)
string(REGEX REPLACE "_d$" "" LIBNAME ${LIBNAME})
endif()
string(REGEX REPLACE "^_" "" LIBNAME ${LIBNAME})
string(SUBSTRING ${LIBNAME} 0 1 LIBNAME_FL)
string(TOUPPER ${LIBNAME_FL} LIBNAME_FL)
string(SUBSTRING ${LIBNAME} 1 -1 LIBNAME_SUFFIX)
Expand Down Expand Up @@ -261,10 +265,17 @@ function(_install_pyside_ui_files LIBRARY_NAME)
get_filename_component(outFileName ${uiFile} NAME_WE)
get_filename_component(uiFilePath ${uiFile} ABSOLUTE)
set(outFilePath "${CMAKE_CURRENT_BINARY_DIR}/${outFileName}.py")
get_filename_component(pysideUicBinName ${PYSIDEUICBINARY} NAME_WLE)
if("${pysideUicBinName}" STREQUAL "uic")
# Newer versions of Qt have deprecated pyside2-uic. It
# has been replaced by "uic" which needs extra arg for
# generating python output (instead of default C++ ).
set(PYSIDEUIC_EXTRA_ARGS -g python)
endif()
add_custom_command(
OUTPUT ${outFilePath}
COMMAND "${PYSIDEUICBINARY}"
ARGS -o ${outFilePath} ${uiFilePath}
ARGS ${PYSIDEUIC_EXTRA_ARGS} -o ${outFilePath} ${uiFilePath}
MAIN_DEPENDENCY "${uiFilePath}"
COMMENT "Generating Python for ${uiFilePath} ..."
VERBATIM
Expand Down Expand Up @@ -605,14 +616,11 @@ function(_pxr_install_rpath rpathRef NAME)
# Canonicalize and uniquify paths.
set(final "")
foreach(path ${rpath})
# Absolutize on Mac. SIP disallows relative rpaths.
# Replace $ORIGIN with @loader_path
if(APPLE)
if("${path}/" MATCHES "^[$]ORIGIN/")
# Replace with origin path.
string(REPLACE "$ORIGIN/" "${origin}/" path "${path}/")

# Simplify.
get_filename_component(path "${path}" REALPATH)
string(REPLACE "$ORIGIN/" "@loader_path/" path "${path}/")
endif()
endif()

Expand Down Expand Up @@ -892,7 +900,12 @@ function(_pxr_python_module NAME)
return()
endif()

set(LIBRARY_NAME "_${NAME}")
if (WIN32 AND PXR_USE_DEBUG_PYTHON)
# On Windows when compiling with debug python the library must be named with _d.
set(LIBRARY_NAME "_${NAME}_d")
else()
set(LIBRARY_NAME "_${NAME}")
endif()

# Install .py files.
if(args_PYTHON_FILES)
Expand Down Expand Up @@ -1026,7 +1039,7 @@ function(_pxr_python_module NAME)
target_include_directories(${LIBRARY_NAME}
SYSTEM
PUBLIC
${PYTHON_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
)

install(
Expand Down
6 changes: 4 additions & 2 deletions cmake/modules/FindPySide.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ execute_process(
)
if (pySideImportResult EQUAL 0)
set(pySideImportResult "PySide2")
set(pySideUIC pyside2-uic python2-pyside2-uic pyside2-uic-2.7)
set(pySideUIC pyside2-uic python2-pyside2-uic pyside2-uic-2.7 uic)
endif()

# PySide2 not found OR PYSIDE explicitly requested
Expand All @@ -51,10 +51,12 @@ if (pySideImportResult EQUAL 1 OR PYSIDE_USE_PYSIDE)
endif()
endif()

# If nothing is found, the result will be <VAR>-NOTFOUND.
find_program(PYSIDEUICBINARY NAMES ${pySideUIC} HINTS ${PYSIDE_BIN_DIR})

if (pySideImportResult)
if (EXISTS ${PYSIDEUICBINARY})
# False if the constant ends in the suffix -NOTFOUND.
if (PYSIDEUICBINARY)
message(STATUS "Found ${pySideImportResult}: with ${PYTHON_EXECUTABLE}, will use ${PYSIDEUICBINARY} for pyside-uic binary")
set(PYSIDE_AVAILABLE True)
else()
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/tf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pxr_library(tf
${TBB_tbb_LIBRARY}

INCLUDE_DIRS
${PYTHON_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${TBB_INCLUDE_DIRS}

Expand Down

0 comments on commit 8cf99d8

Please sign in to comment.