-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make pxrTargets.cmake relocatable (when built with TBB and OpenSubdiv) #3441
base: dev
Are you sure you want to change the base?
Changes from 2 commits
a714e51
d8e668e
c6e63a2
7c591d4
f6dc727
1b5c2b7
08c8ca9
9decb4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,7 +139,14 @@ endif() | |
|
||
|
||
# --TBB | ||
find_package(TBB REQUIRED COMPONENTS tbb) | ||
find_package(TBB CONFIG) | ||
if(TBB_DIR) | ||
# Found in CONFIG mode. | ||
set(TBB_tbb_LIBRARY TBB::tbb) | ||
else() | ||
find_package(TBB REQUIRED COMPONENTS tbb) | ||
endif() | ||
|
||
add_definitions(${TBB_DEFINITIONS}) | ||
|
||
# --math | ||
|
@@ -251,7 +258,22 @@ if (PXR_BUILD_IMAGING) | |
endif() | ||
# --Opensubdiv | ||
set(OPENSUBDIV_USE_GPU ${PXR_BUILD_GPU_SUPPORT}) | ||
find_package(OpenSubdiv 3 REQUIRED) | ||
find_package(OpenSubdiv 3 CONFIG) | ||
if(OpenSubdiv_DIR) | ||
set(OPENSUBDIV_LIBRARIES OpenSubdiv::osdCPU OpenSubdiv::osdGPU) | ||
set(OPENSUBDIV_OSDCPU_LIBRARY OpenSubdiv::osdCPU) | ||
message(STATUS "OpenSubdiv found as config, OpenSubdiv_DIR is ${OpenSubdiv_DIR}") | ||
foreach(t OpenSubdiv::osdCPU OpenSubdiv::osdGPU OpenSubdiv::osdCPU_static OpenSubdiv::osdGPU_static OpenSubdiv::OpenSubdiv) | ||
if(TARGET "${t}") | ||
message(STATUS "${t} is TARGET") | ||
else() | ||
message(STATUS "${t} is not TARGET") | ||
endif() | ||
endforeach() | ||
else() | ||
find_package(OpenSubdiv 3 REQUIRED) | ||
message(STATUS "OpenSubdiv found as module") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto above - can we lower to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also debugging, will be removed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed |
||
endif() | ||
# --Ptex | ||
if (PXR_ENABLE_PTEX_SUPPORT) | ||
find_package(PTex REQUIRED) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,13 @@ pxr_core_epilogue() | |
|
||
export(PACKAGE pxr) | ||
|
||
if(TBB_DIR) | ||
set(PXR_FIND_TBB_IN_CONFIG ON) | ||
endif() | ||
if(OpenSubdiv_DIR) | ||
set(PXR_FIND_OPENSUBDIV_IN_CONFIG ON) | ||
endif() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Personally, I would find this more readable if these variables were set in I can see the thinking of wanting to restrict Pixar-specific variables to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, changed in 08c8ca9 |
||
|
||
configure_file(pxrConfig.cmake.in | ||
"${PROJECT_BINARY_DIR}/pxrConfig.cmake" @ONLY) | ||
install(FILES | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,16 @@ if(@PXR_ENABLE_PYTHON_SUPPORT@) | |
endif() | ||
endif() | ||
|
||
include(CMakeFindDependencyMacro) | ||
|
||
if(@PXR_FIND_TBB_IN_CONFIG@) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we replace this with:
I know there's already an established precedent of just doing the "bare" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that lines like set(PXR_FIND_TBB_IN_CONFIG "@PXR_FIND_TBB_IN_CONFIG@")
if(PXR_FIND_TBB_IN_CONFIG) or, what about a comment? if(@PXR_FIND_TBB_IN_CONFIG@) # if(PXR_FIND_TBB_IN_CONFIG) I'm fine with either one of the 3 above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did the second option, please let me know if you prefer your original or the comment. 9decb4e |
||
find_dependency(TBB @TBB_VERSION@ CONFIG) | ||
endif() | ||
|
||
if(@PXR_FIND_OPENSUBDIV_IN_CONFIG@) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to above - can we replace with:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
find_dependency(OpenSubdiv @OpenSubdiv_VERSION@ CONFIG) | ||
endif() | ||
|
||
# If MaterialX support was enabled for this USD build, try to find the | ||
# associated import targets by invoking the same FindMaterialX.cmake | ||
# module that was used for that build. This can be overridden by | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These messages feel more like debugging messages than things that need to be displayed every build - do you think we could lower the message code from
STATUS
toVERBOSE
orDEBUG
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, they are debugging messages and I removed them in my final commit. I set up a workflow on my fork and I was experimenting with solutions to fix the build error here.
Sorry for the noise, I left the PR in Draft state to indicate it's in progress.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed