summaryrefslogtreecommitdiffstats
path: root/Tests/FindVulkan/Test/Run-glslc.cmake
blob: 086eb9d0f0507c12bc143d3b26970fa6149c216b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
cmake_minimum_required(VERSION 3.12)

function(run_glslc exe exe_display)
  execute_process(COMMAND ${exe} --help
    OUTPUT_VARIABLE output
    OUTPUT_STRIP_TRAILING_WHITESPACE
    RESULT_VARIABLE result
    )

  if(NOT result EQUAL 0)
    message(SEND_ERROR "Result of ${exe_display} --help is ${result}, should be 0")
  endif()

  if(NOT output MATCHES "^glslc - Compile shaders into SPIR-V")
    message(SEND_ERROR "Output of ${exe_display} --help is \"${output}\", should begin with \"glslc - Compile shaders into SPIR-V\"")
  endif()
endfunction()

run_glslc("${VULKAN_GLSLC_EXECUTABLE}" "\${VULKAN_GLSLC_EXECUTABLE}")
run_glslc("${VULKAN_GLSLC_EXECUTABLE_TARGET}" "Vulkan::glslc")