[Piglit] [PATCH 2/3] cmake: Allow to generate a tarball/zip with the binaries, scripts, data.

jfonseca at vmware.com jfonseca at vmware.com
Tue Feb 5 08:20:17 PST 2013


From: José Fonseca <jfonseca at vmware.com>

It doesn't make much sense to package piglit or install on machines, due
to the frequency piglit tests are added/changed.

However, binary packages are still useful for distributed testing where
the binaries are built on one machine, and then passed to (sometimes
other teams) for the actual testing.

This patch allows one to conveniently generate such packages, simply by
doing

  make package

Then one can run piglit by unpacking the package elsewhere, set the
PIGLIT_SOURCE_DIR and LD_LIBRARY_PATH accordingly, and run piglit scripts
as usual.
---
 .gitignore              |    6 +++++
 CMakeLists.txt          |   66 +++++++++++++++++++++++++++++++++++++++++++++++
 cmake/piglit_util.cmake |    5 +++-
 3 files changed, 76 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 911c266..65ece5d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,14 +1,20 @@
 .*.sw?
 *.pyc
+*.tar.bz2
+*.zip
 *~
 
 /.ninja_log
 /build.ninja
 /rules.ninja
 
+_CPack_Packages
+
 bin
 lib
 CMakeFiles
+CPackConfig.cmake
+CPackSourceConfig.cmake
 Makefile
 cmake_install.cmake
 CMakeCache.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 98fa713..9c207f9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -273,3 +273,69 @@ include(cmake/piglit_dispatch.cmake)
 include_directories(src)
 add_subdirectory(cmake/target_api)
 add_subdirectory(generated_tests)
+
+
+##############################################################################
+# Packaging
+
+install (
+	FILES
+		COPYING
+		README
+		RELEASE
+	DESTINATION share/doc
+)
+
+install (
+	PROGRAMS
+		piglit-merge-results.py
+		piglit-print-commands.py
+		piglit-run.py
+		piglit-summary-html.py
+		piglit-summary-junit.py
+	DESTINATION .
+)
+
+install (
+	DIRECTORY framework
+	DESTINATION .
+	FILES_MATCHING PATTERN "*.py"
+)
+
+install (
+	DIRECTORY tests
+	DESTINATION .
+	FILES_MATCHING REGEX ".*\\.(tests|program_test|shader_test|frag|vert|ktx|cl)$"
+)
+
+install (
+	DIRECTORY generated_tests
+	DESTINATION .
+	FILES_MATCHING REGEX ".*\\.(shader_test|program_test|frag|vert)$"
+)
+
+
+set (CPACK_PACKAGE_VERSION_MAJOR "1")
+set (CPACK_PACKAGE_VERSION_MINOR "0")
+
+# Use current date in YYYYMMDD format as patch number
+execute_process (
+	COMMAND ${python} -c "import time, sys; sys.stdout.write(time.strftime('%Y%m%d'))"
+	OUTPUT_VARIABLE CPACK_PACKAGE_VERSION_PATCH
+)
+
+# cpack mistakenly detects Mingw-w64 as win32
+if (MINGW)
+	if (CMAKE_SIZEOF_VOID_P EQUAL 8)
+		set (CPACK_SYSTEM_NAME win64)
+	endif ()
+endif ()
+
+# See http://www.vtk.org/Wiki/CMake:CPackPackageGenerators
+if (WIN32)
+	set (CPACK_GENERATOR "ZIP")
+else ()
+	set (CPACK_GENERATOR "TBZ2")
+endif ()
+
+include(CPack)
diff --git a/cmake/piglit_util.cmake b/cmake/piglit_util.cmake
index 382485b..d3cab44 100644
--- a/cmake/piglit_util.cmake
+++ b/cmake/piglit_util.cmake
@@ -62,6 +62,8 @@ function(piglit_add_executable name)
     add_executable(${name} ${ARGV})
     add_dependencies(${name} piglit_dispatch_gen)
 
+    install(TARGETS ${name} DESTINATION bin)
+
 endfunction(piglit_add_executable)
 
 #
@@ -76,9 +78,10 @@ function(piglit_add_library name)
 
     list(REMOVE_AT ARGV 0)
     if(WIN32)
-        add_library(${name} ${ARGV})
+        add_library(${name} STATIC ${ARGV})
     else(WIN32)
         add_library(${name} SHARED ${ARGV})
+        install(TARGETS ${name} DESTINATION lib)
     endif(WIN32)
     add_dependencies(${name} piglit_dispatch_gen)
 
-- 
1.7.9.5



More information about the Piglit mailing list