Skip to content

Commit

Permalink
Merge pull request #2735 from erikaharrison-adsk/adsk/feature/hgivulk…
Browse files Browse the repository at this point in the history
…an_build_support

Autodesk: Vulkan Build Support

(Internal change: 2317837)
  • Loading branch information
pixar-oss committed Mar 1, 2024
2 parents 916299e + 843b288 commit 114773d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
11 changes: 8 additions & 3 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,15 @@ that depend on Metal, including:

##### Vulkan

Vulkan support for USD is currently experimental and disabled by default.

Building USD with Vulkan enabled requires the Vulkan SDK and glslang to
be installed. The VULKAN_SDK environment variable must point to the
location of the SDK. The glslang compiler headers must be locatable during
the build process.
be installed. If you wish to build a debug build on Windows, please make sure
you have the optional component "Shader Toolchain Debug Symbols" installed as
part of the Vulkan SDK.

The VULKAN_SDK environment variable must point to the location of the SDK. The
glslang compiler headers must be locatable during the build process.

Support for Vulkan can optionally be enabled by specifying the cmake flag
`PXR_ENABLE_VULKAN_SUPPORT=TRUE`.
Expand Down
10 changes: 7 additions & 3 deletions cmake/defaults/Packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -243,18 +243,22 @@ if (PXR_BUILD_IMAGING)
add_definitions(-DPXR_METAL_SUPPORT_ENABLED)
endif()
if (PXR_ENABLE_VULKAN_SUPPORT)
message(STATUS "Enabling experimental feature Vulkan support")
if (EXISTS $ENV{VULKAN_SDK})
# Prioritize the VULKAN_SDK includes and packages before any system
# installed headers. This is to prevent linking against older SDKs
# that may be installed by the OS.
# XXX This is fixed in cmake 3.18+
include_directories(BEFORE SYSTEM $ENV{VULKAN_SDK} $ENV{VULKAN_SDK}/include $ENV{VULKAN_SDK}/lib)
set(ENV{PATH} "$ENV{VULKAN_SDK}:$ENV{VULKAN_SDK}/include:$ENV{VULKAN_SDK}/lib:$ENV{PATH}")
include_directories(BEFORE SYSTEM $ENV{VULKAN_SDK} $ENV{VULKAN_SDK}/include $ENV{VULKAN_SDK}/lib $ENV{VULKAN_SDK}/source)
set(ENV{PATH} "$ENV{VULKAN_SDK}:$ENV{VULKAN_SDK}/include:$ENV{VULKAN_SDK}/lib:$ENV{VULKAN_SDK}/source:$ENV{PATH}")
find_package(Vulkan REQUIRED)
list(APPEND VULKAN_LIBS Vulkan::Vulkan)

# Find the extra vulkan libraries we need
set(EXTRA_VULKAN_LIBS shaderc_combined)
if (WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
set(EXTRA_VULKAN_LIBS shaderc_combinedd)
endif()
foreach(EXTRA_LIBRARY ${EXTRA_VULKAN_LIBS})
find_library("${EXTRA_LIBRARY}_PATH" NAMES "${EXTRA_LIBRARY}" PATHS $ENV{VULKAN_SDK}/lib)
list(APPEND VULKAN_LIBS "${${EXTRA_LIBRARY}_PATH}")
Expand Down Expand Up @@ -357,4 +361,4 @@ if(REQUIRES_Imath)
endif()
endif()

set(BUILD_SHARED_LIBS "${build_shared_libs}")
set(BUILD_SHARED_LIBS "${build_shared_libs}")

0 comments on commit 114773d

Please sign in to comment.