-
Notifications
You must be signed in to change notification settings - Fork 7.5k
[nvrhi] New port. #51041
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
Merged
Merged
[nvrhi] New port. #51041
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| index 5d1797e..7cfb05b 100644 | ||
| --- a/CMakeLists.txt | ||
| +++ b/CMakeLists.txt | ||
| @@ -61,10 +61,18 @@ endif() | ||
|
|
||
| set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | ||
|
|
||
| +if (NVRHI_WITH_VULKAN AND NOT TARGET Vulkan-Headers AND NOT TARGET Vulkan::Headers) | ||
| + find_package(VulkanHeaders CONFIG QUIET) | ||
| +endif() | ||
| + | ||
| if (NVRHI_WITH_VULKAN AND NOT TARGET Vulkan-Headers AND NOT TARGET Vulkan::Headers) | ||
| add_subdirectory(thirdparty/Vulkan-Headers) | ||
| endif() | ||
|
|
||
| +if(NVRHI_WITH_DX12 AND NOT TARGET DirectX-Headers AND NOT TARGET Microsoft::DirectX-Headers) | ||
| + find_package(directx-headers CONFIG QUIET) | ||
| +endif() | ||
| + | ||
| if(NVRHI_WITH_DX12 AND NOT TARGET DirectX-Headers AND NOT TARGET Microsoft::DirectX-Headers) | ||
| add_subdirectory(thirdparty/DirectX-Headers) | ||
| endif() | ||
| @@ -209,7 +217,9 @@ if (NVRHI_BUILD_SHARED) | ||
| if(NVRHI_WITH_VULKAN) | ||
| target_compile_definitions(nvrhi PRIVATE VULKAN_HPP_STORAGE_SHARED VULKAN_HPP_STORAGE_SHARED_EXPORT) | ||
| endif() | ||
| - set_property(TARGET nvrhi PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") | ||
| + if(NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) | ||
| + set_property(TARGET nvrhi PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") | ||
| + endif() | ||
| endif() | ||
|
|
||
| if (NVRHI_WITH_VALIDATION) | ||
| @@ -220,7 +230,7 @@ endif() | ||
|
|
||
| target_include_directories(nvrhi PUBLIC | ||
| $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
| - $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>) | ||
| + $<INSTALL_INTERFACE:include>) | ||
|
|
||
| set_target_properties(nvrhi PROPERTIES FOLDER "NVRHI") | ||
|
|
||
| @@ -388,4 +398,4 @@ if (NVRHI_INSTALL) | ||
| EXPORT_LINK_INTERFACE_LIBRARIES | ||
| DESTINATION "${nvrhi_CONFIG_PATH}") | ||
| endif() | ||
| -endif() | ||
| \ No newline at end of file | ||
| +endif() | ||
| diff --git a/src/nvrhiConfig.cmake.in b/src/nvrhiConfig.cmake.in | ||
| index f9ff79d..6de08c5 100644 | ||
| --- a/src/nvrhiConfig.cmake.in | ||
| +++ b/src/nvrhiConfig.cmake.in | ||
| @@ -19,4 +19,14 @@ | ||
| # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
| # DEALINGS IN THE SOFTWARE. | ||
|
|
||
| +include(CMakeFindDependencyMacro) | ||
| + | ||
| +if(@NVRHI_WITH_VULKAN@) | ||
| + find_dependency(VulkanHeaders CONFIG) | ||
| +endif() | ||
| + | ||
| +if(@NVRHI_WITH_DX12@) | ||
| + find_dependency(directx-headers CONFIG) | ||
| +endif() | ||
| + | ||
| include("${CMAKE_CURRENT_LIST_DIR}/nvrhiTargets.cmake") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| vcpkg_from_github( | ||
| OUT_SOURCE_PATH SOURCE_PATH | ||
| REPO NVIDIA-RTX/NVRHI | ||
| REF 54100464714de88a5a5059d25808f5ccb914ad7d | ||
| SHA512 56d5de1cc0840e29d8df976a5fe7b13d676c110ba24c09ff5e0caaa73f4aa56cc78d2ec2c31b1cb8da9f5b099c8b8598410792f8343a77ba928da28ba8146b1f | ||
| HEAD_REF main | ||
| PATCHES | ||
| fix-vcpkg-deps.patch | ||
| ) | ||
|
|
||
| vcpkg_cmake_configure( | ||
| SOURCE_PATH "${SOURCE_PATH}" | ||
| OPTIONS | ||
| -DNVRHI_INSTALL=ON | ||
| -DNVRHI_INSTALL_EXPORTS=ON | ||
| -DNVRHI_WITH_NVAPI=OFF | ||
| -DNVRHI_WITH_AFTERMATH=OFF | ||
| -DNVRHI_WITH_RTXMU=OFF | ||
| ) | ||
|
|
||
| vcpkg_cmake_install() | ||
| vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/nvrhi") | ||
| vcpkg_copy_pdbs() | ||
|
|
||
| file(REMOVE_RECURSE | ||
| "${CURRENT_PACKAGES_DIR}/debug/include" | ||
| "${CURRENT_PACKAGES_DIR}/debug/share" | ||
| ) | ||
|
|
||
| vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt") | ||
| file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| The package exports CMake targets from `find_package(nvrhi CONFIG REQUIRED)`. | ||
|
|
||
| Static builds install one interface/common target plus backend libraries: | ||
|
|
||
| target_link_libraries(main PRIVATE nvrhi nvrhi_d3d11 nvrhi_d3d12 nvrhi_vk) | ||
|
|
||
| Link only the backend targets you actually use on the current platform. On Linux, | ||
| only `nvrhi` and `nvrhi_vk` are relevant. | ||
|
|
||
| Shared builds install a single `nvrhi` target with the enabled backends compiled in: | ||
|
|
||
| target_link_libraries(main PRIVATE nvrhi) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "name": "nvrhi", | ||
| "version-date": "2026-02-26", | ||
| "description": "NVIDIA Rendering Hardware Interface abstraction layer for D3D11, D3D12, and Vulkan", | ||
| "homepage": "https://github.com/NVIDIA-RTX/NVRHI", | ||
| "license": "MIT", | ||
| "supports": "(windows & x64 & !uwp & !xbox) | (linux & (x64 | arm64))", | ||
| "dependencies": [ | ||
| { | ||
| "name": "directx-headers", | ||
| "platform": "windows" | ||
| }, | ||
| { | ||
| "name": "vcpkg-cmake", | ||
| "host": true | ||
| }, | ||
| { | ||
| "name": "vcpkg-cmake-config", | ||
| "host": true | ||
| }, | ||
| "vulkan-headers" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "versions": [ | ||
| { | ||
| "git-tree": "b355711be2fb5c423ab2381046b5f929477c8d7b", | ||
| "version-date": "2026-02-26", | ||
| "port-version": 0 | ||
| } | ||
| ] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 should probably be REQUIRED not QUIET but we know those are declared as explicit dependencies already so I'm not going to ask for a rebuild over it.