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

OSL Support Does Not Build with Imath (Fix included) #2977

Open
jonahjnewton opened this issue Feb 29, 2024 · 1 comment
Open

OSL Support Does Not Build with Imath (Fix included) #2977

jonahjnewton opened this issue Feb 29, 2024 · 1 comment

Comments

@jonahjnewton
Copy link

jonahjnewton commented Feb 29, 2024

Description of Issue

Commit 2818017 brought up from pull #1829 from 2022 fixed USD's dependency on OpenEXR 2.x's Imath libraries to allow building with Imath & OpenEXR 3.
The sdrOsl CMakeLists file, however, was not fixed to reflect this.

I've added the fixes myself and thought I would share. Here is the fixed script:

#pxr/usd/plugin/sdrOsl/CMakeLists.txt

set(PXR_PREFIX pxr/usd)
set(PXR_PACKAGE sdrOsl)

if(NOT PXR_ENABLE_OSL_SUPPORT)
    return()
endif()

if (Imath_FOUND)
    set(__OSL_IMATH_LIBS "Imath::Imath")
else()
    set(__OSL_IMATH_INCLUDE ${OPENEXR_INCLUDE_DIRS})
endif()

pxr_plugin(sdrOsl
    LIBRARIES
        gf
        tf
        vt
        ar
        ndr
        sdr
        ${OSL_QUERY_LIBRARY}
        ${OIIO_LIBRARIES}
        ${__OSL_IMATH_LIBS}

    INCLUDE_DIRS
        ${__OSL_IMATH_INCLUDE}
        ${OSL_INCLUDE_DIR}
        ${OIIO_INCLUDE_DIRS}

    PUBLIC_CLASSES
        oslParser

    PRIVATE_HEADERS
        api.h

    PYTHON_CPPFILES
        moduleDeps.cpp

    PYMODULE_CPPFILES
        module.cpp
        wrapOslParser.cpp

    PYMODULE_FILES
        __init__.py

    RESOURCE_FILES
        plugInfo.json
)

pxr_test_scripts(
    testenv/testOslParser.py
)

pxr_install_test_dir(
    SRC testenv/testOslParser.testenv
    DEST testOslParser
)

pxr_register_test(testOslParser
    PYTHON
    COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testOslParser"
    EXPECTED_RETURN_CODE 0
)

Steps to Reproduce

  1. Set PXR_ENABLE_OSL_SUPPORT to ON
  2. Build USD with CMake and Imath 3 independently of OpenEXR

System Information (OS, Hardware)

Linux CentOS 7

Package Versions

GCC-9.3.1
CMake-3.16
USD-23.08
Imath-3.1.9
OpenEXR-3.1.11
OpenShadingLanguage-1.12.13.0

Build Flags

PXR_ENABLE_OSL_SUPPORT=ON

@jonahjnewton jonahjnewton changed the title OSL Bindings Do Not Build with Imath (Fix included) OSL Support Does Not Build with Imath (Fix included) Feb 29, 2024
@jesschimein
Copy link

Filed as internal issue #USD-9376

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants