[Piglit] [PATCH 2/2] cmake: only install files for APIs that are built

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Mon Nov 23 17:28:55 PST 2015


From: Dylan Baker <baker.dylan.c at gmail.com>

This configures piglit to only install the following features if they're
enabled:
- profiles
- generated files
- shader_test,program_test,{shader stage},ktx,cl,etc

The basic idea is that if one doesn't build OpenGL, then the OpenGL
tests and profiles shouldn't be installed, and likewise for OpenCL.

This patch continues to combine OpenGL and OpenGL ES, install both if
any are selected. While it could be split more it would be a very
invasive change.

There are two benefits to this. First, it reduces the install foot print
by not install features that are incomplete. Second, and more
importantly, it doesn't install profiles that are unsupported, which
means that piglit will die with an error message equivalent to "no such
profile", rather than dying while trying to compile the profile. This
can be a source of confusion for those who are not familiar with piglit.

I have verified that running "piglit run quick cl foo -c" produces the
same output before and after (this will run quick.py and cl.py)

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 CMakeLists.txt | 68 +++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 56 insertions(+), 12 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e571d70..3e76b46 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -492,25 +492,69 @@ install (
 	DESTINATION ${PIGLIT_INSTALL_LIBDIR}
 )
 
-install (
-	DIRECTORY tests
-	DESTINATION ${PIGLIT_INSTALL_LIBDIR}
-	FILES_MATCHING REGEX ".*\\.(py|program_test|shader_test|frag|vert|geom|tesc|tese|ktx|cl|txt|inc)$"
-	REGEX "CMakeFiles|CMakeLists" EXCLUDE
-)
+if(${PIGLIT_BUILD_GL_TESTS} OR ${PIGLIT_BUILD_GLES1_TESTS} OR ${PIGLIT_BUILD_GLES2_TESTS} OR ${PIGLIT_BUILD_GLES3_TESTS})
+	set(gl_regex ".*\\.(shader_test|frag|vert|geom|tesc|tese|ktx)$" CACHE STRING INTERNAL)
+	# Tests
+	install (
+		DIRECTORY tests
+		DESTINATION ${PIGLIT_INSTALL_LIBDIR}
+		FILES_MATCHING REGEX ${gl_regex}
+		REGEX "CMakeFiles|CMakeLists" EXCLUDE
+	)
+
+	# Generated tests
+	install (
+		DIRECTORY ${CMAKE_BINARY_DIR}/generated_tests
+		DESTINATION ${PIGLIT_INSTALL_LIBDIR}
+		FILES_MATCHING REGEX ${gl_regex}
+		REGEX "CMakeFiles|CMakeLists" EXCLUDE
+	)
+
+	# python profiles.
+	install (
+		DIRECTORY tests
+		DESTINATION ${PIGLIT_INSTALL_LIBDIR}
+		FILES_MATCHING REGEX "(all|llvmpipe|cpu|sanity|gpu|glslparser|shader|quick)\\.py$"
+	)
+endif(${PIGLIT_BUILD_GL_TESTS} OR ${PIGLIT_BUILD_GLES1_TESTS} OR ${PIGLIT_BUILD_GLES2_TESTS} OR ${PIGLIT_BUILD_GLES3_TESTS})
+
+if(${PIGLIT_BUILD_CL_TESTS})
+	set(cl_regex ".*\\(program_test|cl|txt|inc)$" CACHE STRING INTERNAL)
+	install (
+		DIRECTORY tests
+		DESTINATION ${PIGLIT_INSTALL_LIBDIR}
+		FILES_MATCHING REGEX ${cl_regex}
+		REGEX "CMakeFiles|CMakeLists" EXCLUDE
+	)
+
+	install (
+		DIRECTORY generated_tests
+		DESTINATION ${PIGLIT_INSTALL_LIBDIR}
+		FILES_MATCHING REGEX ${cl_regex}
+		REGEX "CMakeFiles|CMakeLists" EXCLUDE
+	)
 
+	# python profiles.
+	install (
+		DIRECTORY tests
+		DESTINATION ${PIGLIT_INSTALL_LIBDIR}
+		FILES_MATCHING REGEX "(cl|quick_cl)\\.py$"
+	)
+endif(${PIGLIT_BUILD_CL_TESTS})
+
+# python integration profiles, just install these 
+# This also includes the ciritical __init__.py file which must be installed or piglit will break.
 install (
-	DIRECTORY ${CMAKE_BINARY_DIR}/generated_tests
+	DIRECTORY tests
 	DESTINATION ${PIGLIT_INSTALL_LIBDIR}
-	FILES_MATCHING REGEX ".*\\.(shader_test|program_test|frag|vert|geom|tesc|tese|cl|txt)$"
-	REGEX "CMakeFiles|CMakeLists" EXCLUDE
+	FILES_MATCHING REGEX "(__init__|cts|deqp_gles2|deqp_gles3|deqp_gles31|es3conform|igt|oglconform|xts|xts-render)\\.py$"
 )
 
+# Install shared modules for profiles
 install (
-	DIRECTORY generated_tests
+	DIRECTORY tests
 	DESTINATION ${PIGLIT_INSTALL_LIBDIR}
-	FILES_MATCHING REGEX ".*\\.inc$"
-	REGEX "CMakeFiles|CMakeLists" EXCLUDE
+	FILES_MATCHING REGEX "py_modules/.*py$"
 )
 
 if (WIN32)
-- 
2.6.2



More information about the Piglit mailing list