Skip to content

Commit

Permalink
CMake: use only one generate_dispatch_tables
Browse files Browse the repository at this point in the history
  • Loading branch information
dabrain34 committed Nov 12, 2024
1 parent 5bfaead commit 78c02a6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 27 deletions.
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,23 @@ else()
PATTERN "*.a" EXCLUDE)
endif()

# Define a custom target to generate the dispatch table files
add_custom_target(GenerateDispatchTables
DEPENDS ${VK_VIDEO_COMMON_LIBS_SOURCE_ROOT}/VkCodecUtils/HelpersDispatchTable.h
${VK_VIDEO_COMMON_LIBS_SOURCE_ROOT}/VkCodecUtils/HelpersDispatchTable.cpp
)

# Add the custom command to generate the dispatch tables
macro(generate_dispatch_table out)
add_custom_command(OUTPUT ${out}
COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/generate-dispatch-table.py ${out}
DEPENDS ${SCRIPTS_DIR}/generate-dispatch-table.py
)
endmacro()

generate_dispatch_table(${VK_VIDEO_COMMON_LIBS_SOURCE_ROOT}/VkCodecUtils/HelpersDispatchTable.h)
generate_dispatch_table(${VK_VIDEO_COMMON_LIBS_SOURCE_ROOT}/VkCodecUtils/HelpersDispatchTable.cpp)


if(BUILD_DECODER)
add_subdirectory(vk_video_decoder)
Expand Down
10 changes: 0 additions & 10 deletions vk_video_decoder/demos/vk-video-dec/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
macro(generate_dispatch_table out)
add_custom_command(OUTPUT ${out}
COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/generate-dispatch-table.py ${out}
DEPENDS ${SCRIPTS_DIR}/generate-dispatch-table.py
)
endmacro()

macro(glsl_to_spirv src)
add_custom_command(OUTPUT ${src}.h
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glsl-to-spirv ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${CMAKE_CURRENT_SOURCE_DIR}/${src}.h ${GLSLANG_VALIDATOR}
Expand All @@ -21,9 +14,6 @@ macro(compile_cuda src)
)
endmacro()

generate_dispatch_table(${VK_VIDEO_COMMON_LIBS_SOURCE_ROOT}/VkCodecUtils/HelpersDispatchTable.h)
generate_dispatch_table(${VK_VIDEO_COMMON_LIBS_SOURCE_ROOT}/VkCodecUtils/HelpersDispatchTable.cpp)

set(sources
Main.cpp
${VK_VIDEO_COMMON_LIBS_SOURCE_ROOT}/VkShell/Shell.cpp
Expand Down
17 changes: 0 additions & 17 deletions vk_video_encoder/libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,6 @@ if(WIN32)
add_definitions(-DVK_USE_PLATFORM_WIN32_KHR)
endif()

# Define a custom target to generate the dispatch table files
add_custom_target(GenerateDispatchTables
DEPENDS ${VK_VIDEO_COMMON_LIBS_SOURCE_ROOT}/VkCodecUtils/HelpersDispatchTable.h
${VK_VIDEO_COMMON_LIBS_SOURCE_ROOT}/VkCodecUtils/HelpersDispatchTable.cpp
)

# Add the custom command to generate the dispatch tables
macro(generate_dispatch_table out)
add_custom_command(OUTPUT ${out}
COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/generate-dispatch-table.py ${out}
DEPENDS ${SCRIPTS_DIR}/generate-dispatch-table.py
)
endmacro()

generate_dispatch_table(${VK_VIDEO_COMMON_LIBS_SOURCE_ROOT}/VkCodecUtils/HelpersDispatchTable.h)
generate_dispatch_table(${VK_VIDEO_COMMON_LIBS_SOURCE_ROOT}/VkCodecUtils/HelpersDispatchTable.cpp)

# Even though shaderc.hpp is a headers-only library, adding
# a dependency here will force clients of the library to rebuild
# when it changes.
Expand Down

0 comments on commit 78c02a6

Please sign in to comment.