Skip to content

Commit

Permalink
Isolate the Vulkan-Headers dependency to the NVRHI library, and avoid…
Browse files Browse the repository at this point in the history
… including the headers submodule if the Vulkan-Headers target is already defined externally.

#45
  • Loading branch information
apanteleev committed Feb 17, 2024
1 parent 84ffe6e commit fe9e756
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ endif()

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

if (NVRHI_WITH_VULKAN)
if (NVRHI_WITH_VULKAN AND NOT TARGET Vulkan-Headers)
add_subdirectory(thirdparty/Vulkan-Headers)
endif()

Expand Down Expand Up @@ -226,10 +226,10 @@ if (NVRHI_WITH_DX11)
target_include_directories(${nvrhi_d3d11_target} PRIVATE include)
endif()

target_link_libraries(${nvrhi_d3d11_target} d3d11 dxguid)
target_link_libraries(${nvrhi_d3d11_target} PUBLIC d3d11 dxguid)

if (NVRHI_WITH_NVAPI)
target_link_libraries(${nvrhi_d3d11_target} nvapi)
target_link_libraries(${nvrhi_d3d11_target} PUBLIC nvapi)
target_compile_definitions(${nvrhi_d3d11_target} PRIVATE NVRHI_D3D11_WITH_NVAPI=1)
else()
target_compile_definitions(${nvrhi_d3d11_target} PRIVATE NVRHI_D3D11_WITH_NVAPI=0)
Expand All @@ -256,13 +256,13 @@ if (NVRHI_WITH_DX12)

if (NVRHI_WITH_RTXMU)
target_compile_definitions(${nvrhi_d3d12_target} PUBLIC NVRHI_WITH_RTXMU=1)
target_link_libraries(${nvrhi_d3d12_target} rtxmu)
target_link_libraries(${nvrhi_d3d12_target} PUBLIC rtxmu)
endif()

target_link_libraries(${nvrhi_d3d12_target} d3d12 dxguid)
target_link_libraries(${nvrhi_d3d12_target} PUBLIC d3d12 dxguid)

if (NVRHI_WITH_NVAPI)
target_link_libraries(${nvrhi_d3d12_target} nvapi)
target_link_libraries(${nvrhi_d3d12_target} PUBLIC nvapi)
target_compile_definitions(${nvrhi_d3d12_target} PRIVATE NVRHI_D3D12_WITH_NVAPI=1)
else()
target_compile_definitions(${nvrhi_d3d12_target} PRIVATE NVRHI_D3D12_WITH_NVAPI=0)
Expand Down Expand Up @@ -294,10 +294,10 @@ if (NVRHI_WITH_VULKAN)

if (NVRHI_WITH_RTXMU)
target_compile_definitions(${nvrhi_vulkan_target} PUBLIC NVRHI_WITH_RTXMU=1)
target_link_libraries(${nvrhi_vulkan_target} rtxmu)
target_link_libraries(${nvrhi_vulkan_target} PUBLIC rtxmu)
endif()

target_link_libraries(${nvrhi_vulkan_target} Vulkan-Headers)
target_link_libraries(${nvrhi_vulkan_target} PRIVATE Vulkan-Headers)

endif()

Expand Down

0 comments on commit fe9e756

Please sign in to comment.