Compare commits
2 Commits
91fff304b5
...
364973fb65
| Author | SHA1 | Date | |
|---|---|---|---|
| 364973fb65 | |||
| 11ce024d6c |
+41
-12
@@ -15,24 +15,35 @@ find_package(OpenUSD REQUIRED)
|
|||||||
find_package(Imgui REQUIRED)
|
find_package(Imgui REQUIRED)
|
||||||
find_package(Glad REQUIRED)
|
find_package(Glad REQUIRED)
|
||||||
|
|
||||||
# User-supplied Embree SDK bin/ dir if Embree DLLs are not bundled inside USD lib/.
|
# USD build that includes hdEmbree (built with PXR_ENABLE_EMBREE_PLUGIN=ON).
|
||||||
set(EMBREE_LOCATION "" CACHE PATH "Embree SDK bin/ directory (leave empty if bundled in USD lib/)")
|
# Can be a separate install from OpenUSD_ROOT_DIR; leave empty to search there instead.
|
||||||
|
set(HDEMBREE_USD_ROOT "" CACHE PATH "USD build containing hdEmbree plugin (separate from OpenUSD_ROOT_DIR)")
|
||||||
|
# Only needed if embree*.dll are not inside HDEMBREE_USD_ROOT/bin.
|
||||||
|
set(EMBREE_LOCATION "" CACHE PATH "Embree SDK bin/ directory (leave empty if bundled in HDEMBREE_USD_ROOT/bin)")
|
||||||
|
|
||||||
# ── hdEmbree detection ───────────────────────────────────────────────────────
|
# ── hdEmbree detection ───────────────────────────────────────────────────────
|
||||||
set(HDEMBREE_PLUGIN_DIR "${OpenUSD_ROOT_DIR}/plugin/usd/hdEmbree")
|
if(HDEMBREE_USD_ROOT AND EXISTS "${HDEMBREE_USD_ROOT}")
|
||||||
|
set(_hdembree_root "${HDEMBREE_USD_ROOT}")
|
||||||
|
else()
|
||||||
|
set(_hdembree_root "${OpenUSD_ROOT_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# hdEmbree.dll lives at plugin/usd/hdEmbree.dll; the subdir holds only plugin metadata.
|
||||||
|
set(HDEMBREE_PLUGIN_DIR "${_hdembree_root}/plugin/usd/hdEmbree")
|
||||||
|
set(HDEMBREE_DLL "${_hdembree_root}/plugin/usd/hdEmbree.dll")
|
||||||
|
|
||||||
if(EXISTS "${HDEMBREE_PLUGIN_DIR}")
|
if(EXISTS "${HDEMBREE_PLUGIN_DIR}")
|
||||||
set(OPENUSD_HAS_EMBREE TRUE)
|
set(OPENUSD_HAS_EMBREE TRUE)
|
||||||
if(EMBREE_LOCATION AND EXISTS "${EMBREE_LOCATION}")
|
if(EMBREE_LOCATION AND EXISTS "${EMBREE_LOCATION}")
|
||||||
set(_embree_dll_dir "${EMBREE_LOCATION}")
|
set(_embree_dll_dir "${EMBREE_LOCATION}")
|
||||||
else()
|
else()
|
||||||
set(_embree_dll_dir "${OpenUSD_ROOT_DIR}/lib")
|
set(_embree_dll_dir "${_hdembree_root}/bin")
|
||||||
endif()
|
endif()
|
||||||
file(GLOB EMBREE_DLLS
|
# Skip tbb*.dll — already supplied by the main USD install to avoid conflicts.
|
||||||
"${_embree_dll_dir}/embree*.dll"
|
file(GLOB EMBREE_DLLS "${_embree_dll_dir}/embree*.dll")
|
||||||
"${_embree_dll_dir}/tbb12.dll")
|
|
||||||
else()
|
else()
|
||||||
set(OPENUSD_HAS_EMBREE FALSE)
|
set(OPENUSD_HAS_EMBREE FALSE)
|
||||||
message(STATUS "hdEmbree: NOT found — rebuild USD with PXR_ENABLE_EMBREE_PLUGIN=ON to enable")
|
message(STATUS "hdEmbree: NOT found — set HDEMBREE_USD_ROOT to a USD build with PXR_ENABLE_EMBREE_PLUGIN=ON")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Collect source files
|
# Collect source files
|
||||||
@@ -99,7 +110,19 @@ if(WIN32)
|
|||||||
COMMENT "Copying runtime DLLs and USD plugins..."
|
COMMENT "Copying runtime DLLs and USD plugins..."
|
||||||
)
|
)
|
||||||
|
|
||||||
if(OPENUSD_HAS_EMBREE AND EMBREE_DLLS)
|
if(OPENUSD_HAS_EMBREE)
|
||||||
|
add_custom_command(TARGET UsdLayerManager POST_BUILD
|
||||||
|
# plugInfo.json has LibraryPath "../hdEmbree.dll" relative to usd/hdEmbree/,
|
||||||
|
# which resolves to usd/hdEmbree.dll — so the DLL must live in usd/, not exe root.
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
"${HDEMBREE_DLL}"
|
||||||
|
"$<TARGET_FILE_DIR:UsdLayerManager>/usd/hdEmbree.dll"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
|
"${HDEMBREE_PLUGIN_DIR}"
|
||||||
|
"$<TARGET_FILE_DIR:UsdLayerManager>/usd/hdEmbree"
|
||||||
|
COMMENT "Copying hdEmbree plugin..."
|
||||||
|
)
|
||||||
|
if(EMBREE_DLLS)
|
||||||
add_custom_command(TARGET UsdLayerManager POST_BUILD
|
add_custom_command(TARGET UsdLayerManager POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
${EMBREE_DLLS}
|
${EMBREE_DLLS}
|
||||||
@@ -107,6 +130,7 @@ if(WIN32)
|
|||||||
COMMENT "Copying Embree runtime DLLs..."
|
COMMENT "Copying Embree runtime DLLs..."
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Compiler warnings
|
# Compiler warnings
|
||||||
@@ -148,8 +172,13 @@ install(FILES ${OpenUSD_ROOT_DIR}/plugin/usd/hdStorm.dll
|
|||||||
)
|
)
|
||||||
|
|
||||||
if(OPENUSD_HAS_EMBREE)
|
if(OPENUSD_HAS_EMBREE)
|
||||||
install(FILES "${HDEMBREE_PLUGIN_DIR}/hdEmbree.dll"
|
# Install to bin/usd/ so plugInfo.json's LibraryPath "../hdEmbree.dll" resolves correctly.
|
||||||
DESTINATION bin
|
install(FILES "${HDEMBREE_DLL}"
|
||||||
|
DESTINATION bin/usd
|
||||||
|
OPTIONAL
|
||||||
|
)
|
||||||
|
install(DIRECTORY "${HDEMBREE_PLUGIN_DIR}"
|
||||||
|
DESTINATION bin/usd
|
||||||
OPTIONAL
|
OPTIONAL
|
||||||
)
|
)
|
||||||
if(EMBREE_DLLS)
|
if(EMBREE_DLLS)
|
||||||
@@ -214,7 +243,7 @@ message(STATUS "hdEmbree support: ${OPENUSD_HAS_EMBREE}")
|
|||||||
if(OPENUSD_HAS_EMBREE AND EMBREE_DLLS)
|
if(OPENUSD_HAS_EMBREE AND EMBREE_DLLS)
|
||||||
message(STATUS "Embree DLLs: ${EMBREE_DLLS}")
|
message(STATUS "Embree DLLs: ${EMBREE_DLLS}")
|
||||||
elseif(OPENUSD_HAS_EMBREE)
|
elseif(OPENUSD_HAS_EMBREE)
|
||||||
message(WARNING "hdEmbree found but no Embree DLLs detected — set EMBREE_LOCATION to the Embree SDK bin/ dir")
|
message(WARNING "hdEmbree found but no Embree DLLs detected — set EMBREE_LOCATION to the Embree SDK bin/ dir or check HDEMBREE_USD_ROOT/bin")
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "=======================================")
|
message(STATUS "=======================================")
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
|
|||||||
Reference in New Issue
Block a user