Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APPLE: Fix OpenImageIO and OpenEXR debug libraries not found #2079

Closed
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
2 changes: 2 additions & 0 deletions build_scripts/build_usd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1702,8 +1702,10 @@ def InstallUSD(context, force, buildArgs):

if context.buildDebug:
extraArgs.append('-DTBB_USE_DEBUG_BUILD=ON')
extraArgs.append('-DPXR_USE_DEBUG_BUILD=ON')
else:
extraArgs.append('-DTBB_USE_DEBUG_BUILD=OFF')
extraArgs.append('-DPXR_USE_DEBUG_BUILD=OFF')

if context.buildDocs:
extraArgs.append('-DPXR_BUILD_DOCUMENTATION=ON')
Expand Down
10 changes: 8 additions & 2 deletions cmake/modules/FindOpenEXR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,16 @@ foreach(OPENEXR_LIB

# OpenEXR libraries may be suffixed with the version number, so we search
# using both versioned and unversioned names.
set(DEBUG_POSTFIX )
if(DEFINED PXR_USE_DEBUG_BUILD)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND ${PXR_USE_DEBUG_BUILD} MATCHES ON)
set(DEBUG_POSTFIX _d)
endif()
endif()
Comment on lines +71 to +76
Copy link
Contributor

Choose a reason for hiding this comment

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

We are building a full debug and also building OpenEXR (and Alembic) statically. Locally I've added extra NAMES lines for debug and static. But I like your approach. When building OpenExr statically the libs are appended with "_s" and "_s_d". Could that be added here as well?

find_library(OPENEXR_${OPENEXR_LIB}_LIBRARY
NAMES
${OPENEXR_LIB}-${OPENEXR_MAJOR_VERSION}_${OPENEXR_MINOR_VERSION}
${OPENEXR_LIB}
${OPENEXR_LIB}-${OPENEXR_MAJOR_VERSION}_${OPENEXR_MINOR_VERSION}${DEBUG_POSTFIX}
${OPENEXR_LIB}{DEBUG_POSTFIX}
HINTS
"${OPENEXR_LOCATION}"
"$ENV{OPENEXR_LOCATION}"
Expand Down
19 changes: 15 additions & 4 deletions cmake/modules/FindOpenImageIO.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ if(UNIX)
"$ENV{OIIO_LOCATION}"
"/opt/oiio"
)
set(LIBNAME libOpenImageIO.so)
if(if DEFINED PXR_USE_DEBUG_BUILD)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND ${PXR_USE_DEBUG_BUILD} MATCHES ON)
set(LIBNAME libOpenImageIO_d.dylib)
endif()
endif()
find_path(OIIO_LIBRARY_DIR
libOpenImageIO.so
${LIBNAME}
HINTS
"${OIIO_LOCATION}"
"$ENV{OIIO_LOCATION}"
Expand Down Expand Up @@ -74,10 +80,15 @@ find_path(OIIO_INCLUDE_DIR
)

list(APPEND OIIO_INCLUDE_DIRS ${OIIO_INCLUDE_DIR})

set(DEBUG_POSTFIX )
if(if DEFINED PXR_USE_DEBUG_BUILD)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND ${PXR_USE_DEBUG_BUILD} MATCHES ON)
set(DEBUG_POSTFIX _d)
endif()
endif()
foreach(OIIO_LIB
OpenImageIO
OpenImageIO_Util
OpenImageIO${DEBUG_POSTFIX}
OpenImageIO_Util${DEBUG_POSTFIX}
)

find_library(OIIO_${OIIO_LIB}_LIBRARY
Expand Down