-
Notifications
You must be signed in to change notification settings - Fork 0
Fix RPATH on linux to point in bin dir #79
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
Changes from 3 commits
5ff1792
e62a449
818d7a8
a910c76
851137a
dda1ee4
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 |
|---|---|---|
|
|
@@ -41,20 +41,33 @@ include(VcpkgSetup) | |
| # NOTE: We can't use PROJECT_IS_TOP_LEVEL here because the project is not yet defined. | ||
| string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}" _HVT_PROJECT_IS_TOP_LEVEL) | ||
|
|
||
| # Variables that need to be set prior to the project definition. | ||
| # RPATH for Linux and macOS | ||
| if (_HVT_PROJECT_IS_TOP_LEVEL AND UNIX) | ||
DDoS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Set platform-specific RPATH syntax | ||
| if (APPLE) | ||
| set(_rpath "@loader_path/;@loader_path/../lib/") | ||
| set_if_not_defined(CMAKE_MACOSX_RPATH ON "") | ||
| else() | ||
| # Linux | ||
| set(_rpath "$ORIGIN:$ORIGIN/../lib") | ||
| endif() | ||
|
Contributor
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. 🔴 No, The
Contributor
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. Note: Here is the file the code doesn't know yet where are the
Contributor
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. This RPATH is relative to the loader (an executable in
Contributor
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.
Agree e.g.,
Contributor
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. CMake is supposed to set RPATHs automatically according to the linker command line. We shouldn't need an RPATH for the build.
Contributor
Author
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. All the USD lib and binaries are in lib and bin folders, we do not use the externals folder for that. It is the same with HVTEx. This also make sense, you can copy these folders and you have everything you need.
Contributor
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.
Nope.
Contributor
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.
Based on my experiments on macOS, the two must be explicit.
Contributor
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've never had to explicitly set the RPATH, as long as you leave the default CMake RPATH settings on. |
||
|
|
||
| # Common RPATH settings for all UNIX platforms | ||
| set_if_not_defined(CMAKE_SKIP_BUILD_RPATH TRUE "") | ||
| set_if_not_defined(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE "") | ||
| set_if_not_defined(CMAKE_INSTALL_RPATH "@loader_path/" "") | ||
| set_if_not_defined(CMAKE_INSTALL_RPATH "${_rpath}" "") | ||
| set_if_not_defined(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE "") | ||
| endif() | ||
|
|
||
| # macOS specific (ignored on other platforms) | ||
| # Apple-specific configuration | ||
| if (_HVT_PROJECT_IS_TOP_LEVEL AND APPLE) | ||
| set_if_not_defined(CMAKE_OSX_DEPLOYMENT_TARGET "12.0" "Minimum OSX deployment version") | ||
|
|
||
| # Validate architecture (universal builds not supported due to libjpeg-turbo) | ||
| list(LENGTH CMAKE_OSX_ARCHITECTURES osx_arch_count) | ||
| if(osx_arch_count GREATER 1) | ||
| message(FATAL_ERROR "Universal builds are not supported because of libjpeg-turbo") | ||
| endif() | ||
| set_if_not_defined(CMAKE_OSX_DEPLOYMENT_TARGET "12.0" "Minimum OSX deployment version") | ||
| set_if_not_defined(CMAKE_MACOSX_RPATH ON "") | ||
| endif() | ||
|
|
||
| # Enable only the typical build types. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,24 +67,8 @@ add_executable(${_TARGET} | |
| get_cmake_property(_MULTI_CONFIG GENERATOR_IS_MULTI_CONFIG) | ||
|
|
||
| if (UNIX) | ||
|
||
| # Do not copy the third-party libraries by updating the rpath with: | ||
| # 1. The OpenUSD library location. | ||
| # 2. The default library location. | ||
| # 3. The OpenUSD plugins location. | ||
| # Note: Handle the multi-generator cases. | ||
|
|
||
| if(_MULTI_CONFIG) | ||
| set(openusd_path_gen "$<IF:$<CONFIG:Debug>,${OPENUSD_INSTALL_PATH_DEBUG},${OPENUSD_INSTALL_PATH}>") | ||
| list(APPEND _RPATH "${openusd_path_gen}/lib") | ||
| list(APPEND _RPATH "${openusd_path_gen}/plugin") | ||
| list(APPEND _RPATH "${_HVT_OUTPUT_DIR}/lib/$<CONFIG>") | ||
| else() | ||
| list(APPEND _RPATH "${OPENUSD_INSTALL_PATH}/lib") | ||
| list(APPEND _RPATH "${OPENUSD_INSTALL_PATH}/plugin") | ||
| list(APPEND _RPATH "${_HVT_OUTPUT_DIR}/lib") | ||
| endif() | ||
|
|
||
| set_target_properties(${_TARGET} PROPERTIES INSTALL_RPATH "${_RPATH}") | ||
| # RPATH is set globally in root CMakeLists.txt for all UNIX platforms | ||
| # No additional per-target RPATH configuration needed | ||
| elseif (WIN32) | ||
| # On the Windows platform, the safest approach is to copy libraries where are the executables. | ||
|
|
||
|
|
||
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.
🔴 The
RPATHcomputation is needed all the time (i.e., cannot depend on_HVT_PROJECT_IS_TOP_LEVEL).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.
When building as part gf HVTEx, the RPATH defined there is supposed to be set for other submodules being built.
Uh oh!
There was an error while loading. Please reload this page.
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.
The
OPENUSD_INSTALL_PATH(defined below in the cmake file) takes care of that.