[55/63] CMake: search for glslangValidator, spirv-dis if needed

Submitted by apinheiro on Feb. 23, 2019, 11:45 p.m.

Details

Message ID 20190223234551.21111-56-apinheiro@igalia.com
State New
Headers show
Series "ARB_gl_spirv full series" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

apinheiro Feb. 23, 2019, 11:45 p.m.
If we are generating SPIR-V tests using already existing tests, we
would need both programs.

Note that we are not removing the option to configure where those
binaries are on the script using envvars, as that can be handy if you
want to use glslang from master compiled by yourself, and having
glslang from system installed.
---
 CMakeLists.txt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Patch hide | download patch | download mbox

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 435c40ea5..d5e9de3a9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,6 +52,23 @@  option(PIGLIT_BUILD_CL_TESTS "Build tests for OpenCL" OFF)
 option(PIGLIT_GENERATE_GL_SPIRV_TESTS
 	"Generate ARB_gl_spirv tests by converting GLSL shader_tests to SPIR-V" OFF)
 
+if (PIGLIT_GENERATE_GL_SPIRV_TESTS)
+	find_program(GLSLANG_VALIDATOR_FOUND glslangValidator)
+	find_program(SPIRV_DIS_FOUND spirv-dis)
+
+	if(NOT GLSLANG_VALIDATOR_FOUND)
+		message(FATAL_ERROR "Failed fo find glslangValidator, needed to "
+			"generate the ARB_gl_spirv generated tests."
+			)
+	endif()
+
+	if(NOT SPIRV_DIS_FOUND)
+		message(FATAL_ERROR "Failed to find spirv-dis, needed "
+			"to generate the ARB_gl_spirv generated tests."
+			)
+		endif()
+endif()
+
 if(PIGLIT_BUILD_GL_TESTS)
 	find_package(OpenGL REQUIRED)
 endif()