[Piglit] [PATCH 1/3] cmake: Install under separate piglit directory

Jordan Justen jordan.l.justen at intel.com
Wed Apr 30 10:28:55 PDT 2014


Install paths updated:
* $PREFIX/share/doc => $PREFIX/share/doc/piglit
* $PREFIX/lib => $PREFIX/lib/piglit/lib
* $PREFIX/bin => $PREFIX/lib/piglit/bin
* etc...

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 CMakeLists.txt          | 23 +++++++++++++++++------
 cmake/piglit_util.cmake |  4 ++--
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cbdccf1..0c91705 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.6)
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
 
+INCLUDE (GNUInstallDirs)
 INCLUDE (CheckCCompilerFlag)
 INCLUDE (CheckCSourceCompiles)
 INCLUDE (CheckCXXCompilerFlag)
@@ -376,6 +377,16 @@ check_include_file(sys/stat.h  HAVE_SYS_STAT_H)
 check_include_file(unistd.h    HAVE_UNISTD_H)
 check_include_file(fcntl.h     HAVE_FCNTL_H)
 
+set(PIGLIT_INSTALL_LIBDIR
+    "${CMAKE_INSTALL_LIBDIR}/piglit")
+if(NOT IS_ABSOLUTE ${PIGLIT_INSTALL_LIBDIR})
+	set(PIGLIT_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${PIGLIT_INSTALL_LIBDIR}")
+else()
+	set(PIGLIT_INSTALL_FULL_LIBDIR "${PIGLIT_INSTALL_LIBDIR}")
+endif()
+
+SET(CMAKE_INSTALL_RPATH "${PIGLIT_INSTALL_FULL_LIBDIR}/lib")
+
 configure_file(
 	"${piglit_SOURCE_DIR}/tests/util/config.h.in"
 	"${piglit_BINARY_DIR}/tests/util/config.h"
@@ -398,7 +409,7 @@ install (
 		COPYING
 		README
 		RELEASE
-	DESTINATION share/doc
+	DESTINATION share/doc/piglit
 )
 
 install (
@@ -410,30 +421,30 @@ install (
 		piglit-summary.py
 		piglit-summary-html.py
 		piglit-summary-junit.py
-	DESTINATION .
+	DESTINATION ${PIGLIT_INSTALL_LIBDIR}
 )
 
 install (
 	DIRECTORY framework
-	DESTINATION .
+	DESTINATION ${PIGLIT_INSTALL_LIBDIR}
 	FILES_MATCHING PATTERN "*.py"
 )
 
 install (
 	DIRECTORY templates
-	DESTINATION .
+	DESTINATION ${PIGLIT_INSTALL_LIBDIR}
 )
 
 install (
 	DIRECTORY tests
-	DESTINATION .
+	DESTINATION ${PIGLIT_INSTALL_LIBDIR}
 	FILES_MATCHING REGEX ".*\\.(py|program_test|shader_test|frag|vert|geom|ktx|cl|txt|vpfp)$"
 	REGEX "CMakeFiles|CMakeLists" EXCLUDE
 )
 
 install (
 	DIRECTORY ${CMAKE_BINARY_DIR}/generated_tests
-	DESTINATION .
+	DESTINATION ${PIGLIT_INSTALL_LIBDIR}
 	FILES_MATCHING REGEX ".*\\.(shader_test|program_test|frag|vert|geom|cl|txt)$"
 	REGEX "CMakeFiles|CMakeLists" EXCLUDE
 )
diff --git a/cmake/piglit_util.cmake b/cmake/piglit_util.cmake
index d3cab44..e2c3454 100644
--- a/cmake/piglit_util.cmake
+++ b/cmake/piglit_util.cmake
@@ -62,7 +62,7 @@ function(piglit_add_executable name)
     add_executable(${name} ${ARGV})
     add_dependencies(${name} piglit_dispatch_gen)
 
-    install(TARGETS ${name} DESTINATION bin)
+    install(TARGETS ${name} DESTINATION ${PIGLIT_INSTALL_LIBDIR}/bin)
 
 endfunction(piglit_add_executable)
 
@@ -81,7 +81,7 @@ function(piglit_add_library name)
         add_library(${name} STATIC ${ARGV})
     else(WIN32)
         add_library(${name} SHARED ${ARGV})
-        install(TARGETS ${name} DESTINATION lib)
+        install(TARGETS ${name} DESTINATION ${PIGLIT_INSTALL_LIBDIR}/lib)
     endif(WIN32)
     add_dependencies(${name} piglit_dispatch_gen)
 
-- 
1.9.2



More information about the Piglit mailing list