diff --git a/CMakeLists.txt b/CMakeLists.txt index ceb5b35..8518321 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/vk_video_decoder/demos/vk-video-dec/CMakeLists.txt b/vk_video_decoder/demos/vk-video-dec/CMakeLists.txt index 0a61f85..999d487 100644 --- a/vk_video_decoder/demos/vk-video-dec/CMakeLists.txt +++ b/vk_video_decoder/demos/vk-video-dec/CMakeLists.txt @@ -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} @@ -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 diff --git a/vk_video_encoder/libs/CMakeLists.txt b/vk_video_encoder/libs/CMakeLists.txt index d433163..c9d0eeb 100644 --- a/vk_video_encoder/libs/CMakeLists.txt +++ b/vk_video_encoder/libs/CMakeLists.txt @@ -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.