CMake: add hdEmbree plugin detection and deployment
When the USD installation contains plugin/usd/hdEmbree/ (i.e. USD was built with PXR_ENABLE_EMBREE_PLUGIN=ON), the build system now: - Detects OPENUSD_HAS_EMBREE and logs status in the CMake configure output - POST_BUILD: copies Embree runtime DLLs to the exe directory (looks in USD lib/ first, or EMBREE_LOCATION cache variable if DLLs live in a separate SDK dir) - install(): deploys hdEmbree.dll and Embree DLLs alongside other runtime DLLs - Adds EMBREE_LOCATION CACHE PATH for pointing at an external Embree SDK bin/ No app code changes needed: UsdImagingGLEngine::GetRendererPlugins() already enumerates all registered Hydra plugins, and the per-viewport renderer dropdown already lists them. HdEmbree will appear automatically once the plugin is present. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,26 @@ find_package(OpenUSD REQUIRED)
|
||||
find_package(Imgui REQUIRED)
|
||||
find_package(Glad REQUIRED)
|
||||
|
||||
# User-supplied Embree SDK bin/ dir if Embree DLLs are not bundled inside USD lib/.
|
||||
set(EMBREE_LOCATION "" CACHE PATH "Embree SDK bin/ directory (leave empty if bundled in USD lib/)")
|
||||
|
||||
# ── hdEmbree detection ───────────────────────────────────────────────────────
|
||||
set(HDEMBREE_PLUGIN_DIR "${OpenUSD_ROOT_DIR}/plugin/usd/hdEmbree")
|
||||
if(EXISTS "${HDEMBREE_PLUGIN_DIR}")
|
||||
set(OPENUSD_HAS_EMBREE TRUE)
|
||||
if(EMBREE_LOCATION AND EXISTS "${EMBREE_LOCATION}")
|
||||
set(_embree_dll_dir "${EMBREE_LOCATION}")
|
||||
else()
|
||||
set(_embree_dll_dir "${OpenUSD_ROOT_DIR}/lib")
|
||||
endif()
|
||||
file(GLOB EMBREE_DLLS
|
||||
"${_embree_dll_dir}/embree*.dll"
|
||||
"${_embree_dll_dir}/tbb12.dll")
|
||||
else()
|
||||
set(OPENUSD_HAS_EMBREE FALSE)
|
||||
message(STATUS "hdEmbree: NOT found — rebuild USD with PXR_ENABLE_EMBREE_PLUGIN=ON to enable")
|
||||
endif()
|
||||
|
||||
# Collect source files
|
||||
file(GLOB_RECURSE CORE_SOURCES "src/core/*.cpp")
|
||||
file(GLOB_RECURSE UI_SOURCES "src/ui/*.cpp")
|
||||
@@ -78,6 +98,15 @@ if(WIN32)
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>"
|
||||
COMMENT "Copying runtime DLLs and USD plugins..."
|
||||
)
|
||||
|
||||
if(OPENUSD_HAS_EMBREE AND EMBREE_DLLS)
|
||||
add_custom_command(TARGET UsdLayerManager POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${EMBREE_DLLS}
|
||||
"$<TARGET_FILE_DIR:UsdLayerManager>"
|
||||
COMMENT "Copying Embree runtime DLLs..."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Compiler warnings
|
||||
@@ -118,6 +147,19 @@ install(FILES ${OpenUSD_ROOT_DIR}/plugin/usd/hdStorm.dll
|
||||
DESTINATION bin
|
||||
)
|
||||
|
||||
if(OPENUSD_HAS_EMBREE)
|
||||
install(FILES "${HDEMBREE_PLUGIN_DIR}/hdEmbree.dll"
|
||||
DESTINATION bin
|
||||
OPTIONAL
|
||||
)
|
||||
if(EMBREE_DLLS)
|
||||
install(FILES ${EMBREE_DLLS}
|
||||
DESTINATION bin
|
||||
OPTIONAL
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Install Python runtime DLLs required by OpenUSD.
|
||||
install(FILES
|
||||
"$ENV{LOCALAPPDATA}/Programs/Python/Python312/python312.dll"
|
||||
@@ -168,6 +210,12 @@ message(STATUS "ImGui found: ${Imgui_FOUND}")
|
||||
message(STATUS "OpenGL found: ${OPENGL_FOUND}")
|
||||
message(STATUS "Glad found: ${Glad_FOUND}")
|
||||
message(STATUS "Build tests: ${BUILD_TESTS}")
|
||||
message(STATUS "hdEmbree support: ${OPENUSD_HAS_EMBREE}")
|
||||
if(OPENUSD_HAS_EMBREE AND EMBREE_DLLS)
|
||||
message(STATUS "Embree DLLs: ${EMBREE_DLLS}")
|
||||
elseif(OPENUSD_HAS_EMBREE)
|
||||
message(WARNING "hdEmbree found but no Embree DLLs detected — set EMBREE_LOCATION to the Embree SDK bin/ dir")
|
||||
endif()
|
||||
message(STATUS "=======================================")
|
||||
message(STATUS "")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user