Skip to content

Commit

Permalink
Use volk instead of DILIGENT_VOLK_DIR variable (DiligentGraphics/Dili…
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Mar 31, 2022
1 parent e646f6d commit ecb0955
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
10 changes: 4 additions & 6 deletions Graphics/GraphicsEngineVulkan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ endif()
target_include_directories(Diligent-GraphicsEngineVk-static
PRIVATE
include
${DILIGENT_VOLK_DIR}
)

set(PRIVATE_DEPENDENCIES
Expand Down Expand Up @@ -247,20 +246,19 @@ else()
endif()

if(PLATFORM_WIN32)
# Use Volk
list(APPEND PRIVATE_DEPENDENCIES volk_headers)
elseif(PLATFORM_MACOS)
# Use Volk
list(APPEND PRIVATE_DEPENDENCIES volk_headers)
elseif(PLATFORM_IOS OR PLATFORM_TVOS)
find_library(CORE_GRAPHICS CoreGraphics)
find_library(METAL_LIBRARY Metal)
find_library(QUARTZ_CORE QuartzCore)
find_library(UI_KIT UIKit)
list(APPEND PRIVATE_DEPENDENCIES ${MOLTENVK_LIBRARY} ${CORE_GRAPHICS} ${METAL_LIBRARY} ${QUARTZ_CORE} ${UI_KIT})
elseif(PLATFORM_LINUX)
# Use Volk
list(APPEND PRIVATE_DEPENDENCIES dl)
list(APPEND PRIVATE_DEPENDENCIES volk_headers)
elseif(PLATFORM_ANDROID)
# Use Volk
list(APPEND PRIVATE_DEPENDENCIES volk_headers)
else()
find_library(Vulkan_LIBRARY NAMES vulkan)
list(APPEND PRIVATE_DEPENDENCIES ${Vulkan_LIBRARY})
Expand Down
4 changes: 1 addition & 3 deletions Tests/GPUTestFramework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,11 @@ if(PLATFORM_LINUX)
endif()

if(VULKAN_SUPPORTED)
target_include_directories(Diligent-GPUTestFramework PUBLIC ${DILIGENT_VOLK_DIR})
target_link_libraries(Diligent-GPUTestFramework PUBLIC Vulkan-Headers)
target_link_libraries(Diligent-GPUTestFramework PUBLIC Vulkan-Headers volk_headers)

if(PLATFORM_LINUX)
target_link_libraries(Diligent-GPUTestFramework
PUBLIC
dl # Required by Volk
xcb
)
endif()
Expand Down
19 changes: 11 additions & 8 deletions ThirdParty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ if (VULKAN_SUPPORTED OR METAL_SUPPORTED)
)
endif()

if (VULKAN_SUPPORTED AND (PLATFORM_WIN32 OR PLATFORM_LINUX OR PLATFORM_MACOS OR PLATFORM_ANDROID))
if (NOT TARGET volk)
set(VOLK_PULL_IN_VULKAN OFF)
set(VOLK_INSTALL OFF)
add_subdirectory(volk)
set_directory_root_folder("volk" "DiligentCore/ThirdParty/volk")
set_target_properties(volk PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
endif()
install(FILES "${volk_SOURCE_DIR}/LICENSE.md" DESTINATION "Licenses/ThirdParty/${DILIGENT_CORE_DIR}" RENAME Volk-License.md)
endif()

if (${DILIGENT_BUILD_GOOGLE_TEST})
if (NOT TARGET gtest)
set(INSTALL_GTEST OFF CACHE BOOL "Do not install googletest")
Expand All @@ -156,14 +167,6 @@ if (NOT TARGET xxHash::xxhash)
endif()
install(FILES "${xxHash_SOURCE_DIR}/../LICENSE" DESTINATION "Licenses/ThirdParty/${DILIGENT_CORE_DIR}" RENAME xxHash-License.txt)

if (NOT DILIGENT_VOLK_DIR)
set(DILIGENT_VOLK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/volk" CACHE PATH "volk source directory")
endif()
if (NOT EXISTS "${DILIGENT_VOLK_DIR}/volk.h")
message(FATAL_ERROR "${DILIGENT_VOLK_DIR}/volk.h does not exist. This indicates that volk submodule is not checked out or DILIGENT_VOLK_DIR variable contains invalid path.")
endif()
install(FILES "${DILIGENT_VOLK_DIR}/LICENSE.md" DESTINATION "Licenses/ThirdParty/${DILIGENT_CORE_DIR}" RENAME Volk-License.md)

install(FILES stb/stb_image_write_license.txt DESTINATION "Licenses/ThirdParty/${DILIGENT_CORE_DIR}")
install(FILES DirectXShaderCompiler/LICENSE.TXT DESTINATION "Licenses/ThirdParty/${DILIGENT_CORE_DIR}" RENAME DXC-License.txt)
install(FILES DirectXShaderCompiler/ThirdPartyNotices.txt DESTINATION "Licenses/ThirdParty/${DILIGENT_CORE_DIR}" RENAME DXC-ThirdPartyNotices.txt)

0 comments on commit ecb0955

Please sign in to comment.