[clblas] 38/125: Adding 'staging' directory to make it easier to debug; all binary code is copied together Adding new install logic for debug builds to copy debug runtimes into package Adding new install logic to copy test dependencies into package if tests are built

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Fri May 29 06:57:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository clblas.

commit 5472441a834c3a307ab6d98c7311b533ac38e08f
Author: Kent Knox <kent.knox at amd>
Date:   Fri Nov 1 16:26:23 2013 -0500

    Adding 'staging' directory to make it easier to debug; all binary code is copied together
    Adding new install logic for debug builds to copy debug runtimes into package
    Adding new install logic to copy test dependencies into package if tests are built
---
 src/client/CMakeLists.txt                         |  2 +
 src/library/CMakeLists.txt                        | 32 ++++++++++
 src/library/blas/gens/legacy/tests/CMakeLists.txt |  1 +
 src/library/blas/gens/tests/CMakeLists.txt        |  1 +
 src/library/common/tests/CMakeLists.txt           |  2 +
 src/library/tools/ktest/CMakeLists.txt            |  1 +
 src/library/tools/tune/CMakeLists.txt             |  1 +
 src/tests/CMakeLists.txt                          | 21 ++++++-
 src/tests/copyTestDependencies.cmake.in           | 72 +++++++++++++++++++++++
 9 files changed, 132 insertions(+), 1 deletion(-)

diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt
index 360173d..a647da0 100644
--- a/src/client/CMakeLists.txt
+++ b/src/client/CMakeLists.txt
@@ -48,9 +48,11 @@ include_directories(
 
 add_executable(client ${CLIENT_SRC} ${CLIENT_HEADER})
 target_link_libraries(client ${Boost_LIBRARIES} ${OPENCL_LIBRARIES} clBLAS)
+set_target_properties( client PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 add_executable(testPerfWrapper ${WRAPPER_SRC})
 target_link_libraries(testPerfWrapper ${Boost_LIBRARIES})
+set_target_properties( testPerfWrapper PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 # CPack configuration; include the executable into the package
 install( TARGETS client testPerfWrapper
diff --git a/src/library/CMakeLists.txt b/src/library/CMakeLists.txt
index f3ac63e..f06282e 100644
--- a/src/library/CMakeLists.txt
+++ b/src/library/CMakeLists.txt
@@ -311,6 +311,7 @@ add_library(clBLAS SHARED ${CLBLAS_SOURCES} ${GLOBAL_HEADERS} ${SRC_BLAS_HEADERS
 add_dependencies(clBLAS GENERATE_CLT)
 set_target_properties(clBLAS PROPERTIES VERSION ${clBLAS_VERSION})
 set_target_properties(clBLAS PROPERTIES SOVERSION ${clBLAS_SOVERSION})
+set_target_properties( clBLAS PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 target_link_libraries(clBLAS ${OPENCL_LIBRARIES} ${MATH_LIBRARY})
 
 # CPack configuration; include the executable into the package
@@ -319,3 +320,34 @@ install( TARGETS clBLAS
 		LIBRARY DESTINATION lib${SUFFIX_LIB}
 		ARCHIVE DESTINATION lib${SUFFIX_LIB}/import
 		)
+
+# For debug builds, include the debug runtimes into the package for testing on non-developer machines
+set( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP true )
+set( CMAKE_INSTALL_DEBUG_LIBRARIES true )
+set( CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY true )
+
+if( WIN32 )
+    set( CLBLAS_RUNTIME_DESTINATION bin${SUFFIX_BIN} )
+else( )
+    set( CLBLAS_RUNTIME_DESTINATION lib${SUFFIX_LIB} )
+endif( )
+
+include( InstallRequiredSystemLibraries )
+
+# Install necessary runtime files for debug builds
+install(    PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
+            CONFIGURATIONS Debug
+            DESTINATION ${CLBLAS_RUNTIME_DESTINATION} )
+
+# Install all *.pdb files for debug builds
+install(    DIRECTORY ${PROJECT_BINARY_DIR}/staging/
+            DESTINATION ${CLBLAS_RUNTIME_DESTINATION}
+            OPTIONAL
+            CONFIGURATIONS Debug
+            FILES_MATCHING PATTERN "*.pdb" )
+
+# Install a snapshot of the source as it was for this build; useful for the .pdb's
+install(    DIRECTORY ${PROJECT_SOURCE_DIR}
+            DESTINATION ${CLBLAS_RUNTIME_DESTINATION}
+            OPTIONAL
+            CONFIGURATIONS Debug )
diff --git a/src/library/blas/gens/legacy/tests/CMakeLists.txt b/src/library/blas/gens/legacy/tests/CMakeLists.txt
index cf31f1e..fae11cc 100644
--- a/src/library/blas/gens/legacy/tests/CMakeLists.txt
+++ b/src/library/blas/gens/legacy/tests/CMakeLists.txt
@@ -45,6 +45,7 @@ include_directories(${OPENCL_INCLUDE_DIRS} ${clBLAS_SOURCE_DIR} ${clBLAS_SOURCE_
 
 add_executable(t_blkmul ${SRC_BLKMUL})
 target_link_libraries(t_blkmul ${OPENCL_LIBRARIES})
+set_target_properties( t_blkmul PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 # CPack configuration; include the executable into the package
 install( TARGETS t_blkmul
diff --git a/src/library/blas/gens/tests/CMakeLists.txt b/src/library/blas/gens/tests/CMakeLists.txt
index 3490426..6d10e3f 100644
--- a/src/library/blas/gens/tests/CMakeLists.txt
+++ b/src/library/blas/gens/tests/CMakeLists.txt
@@ -42,6 +42,7 @@ include_directories(${OPENCL_INCLUDE_DIRS} ${clBLAS_SOURCE_DIR} ${clBLAS_SOURCE_
 
 add_executable(t_tilemul ${SRC_TILEMUL})
 target_link_libraries(t_tilemul ${OPENCL_LIBRARIES})
+set_target_properties( t_tilemul PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 # CPack configuration; include the executable into the package
 install( TARGETS t_tilemul
diff --git a/src/library/common/tests/CMakeLists.txt b/src/library/common/tests/CMakeLists.txt
index c38e59d..b1e3487 100644
--- a/src/library/common/tests/CMakeLists.txt
+++ b/src/library/common/tests/CMakeLists.txt
@@ -44,9 +44,11 @@ include_directories(${OPENCL_INCLUDE_DIRS} ${clBLAS_SOURCE_DIR} ${clBLAS_SOURCE_
 
 add_executable(t_dblock_kgen ${SRC_DBLOCK_KGEN})
 target_link_libraries(t_dblock_kgen ${OPENCL_LIBRARIES} ${MATH_LIBRARY})
+set_target_properties( t_dblock_kgen PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 add_executable(t_gens_cache ${SRC_GENS_CACHE})
 target_link_libraries(t_gens_cache ${OPENCL_LIBRARIES} ${MATH_LIBRARY})
+set_target_properties( t_gens_cache PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 # CPack configuration; include the executable into the package
 install( TARGETS t_dblock_kgen t_gens_cache
diff --git a/src/library/tools/ktest/CMakeLists.txt b/src/library/tools/ktest/CMakeLists.txt
index e86ea00..2cc8c31 100644
--- a/src/library/tools/ktest/CMakeLists.txt
+++ b/src/library/tools/ktest/CMakeLists.txt
@@ -140,6 +140,7 @@ source_group(\\ FILES ${KTEST_SRC})
 add_executable(make-ktest ${KTEST_SRC} ${KTEST_EXTERNAL_SRC})
 add_dependencies(make-ktest GENERATE_CLT)
 target_link_libraries(make-ktest ${OPENCL_LIBRARIES} ${Boost_LIBRARIES} ${MATH_LIBRARY})
+set_target_properties( make-ktest PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 # CPack configuration; include the executable into the package
 install( TARGETS make-ktest
diff --git a/src/library/tools/tune/CMakeLists.txt b/src/library/tools/tune/CMakeLists.txt
index 65bf00e..2de5bf3 100644
--- a/src/library/tools/tune/CMakeLists.txt
+++ b/src/library/tools/tune/CMakeLists.txt
@@ -138,6 +138,7 @@ endif()
 add_executable(tune ${TOOLS_SRC} ${TOOLS_EXTERNAL_SRC})
 add_dependencies(tune GENERATE_CLT)
 target_link_libraries(tune ${OPENCL_LIBRARIES} ${TIME_LIBRARY} ${MATH_LIBRARY})
+set_target_properties( tune PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 # CPack configuration; include the executable into the package
 install( TARGETS tune
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index 61f5e84..feda624 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -294,14 +294,17 @@ if( GTEST_FOUND )
 	    
 	    add_executable(test-correctness ${SRC_CORR} ${SRC_COMMON} ${SRC_COMMON_REFIMPL}
 									    ${CORR_HEADERS} ${TESTS_HEADERS})
+        set_target_properties( test-correctness PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 	    add_executable(test-medium ${SRC_CORR} ${SRC_COMMON} ${SRC_COMMON_REFIMPL}
 							      ${CORR_HEADERS} ${TESTS_HEADERS})
 	    set_target_properties(test-medium PROPERTIES COMPILE_DEFINITIONS MEDIUM_TESTS)
+        set_target_properties( test-medium PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 	    add_executable(test-short ${SRC_CORR} ${SRC_COMMON} ${SRC_COMMON_REFIMPL}
 							      ${CORR_HEADERS} ${TESTS_HEADERS})
 	    set_target_properties(test-short PROPERTIES COMPILE_DEFINITIONS SHORT_TESTS)
+        set_target_properties( test-short PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 	    # The build server builds the library with gcc 4.1.2 to support Red Hat 5.5, but the test programs must be built with 
 	    # gcc > 4.3.2 to support ACML.  
@@ -325,14 +328,17 @@ if( GTEST_FOUND )
 
 		add_executable(test-correctness ${SRC_CORR} ${SRC_COMMON} ${SRC_COMMON_REFIMPL}
 						${CORR_HEADERS} ${TESTS_HEADERS})
+        set_target_properties( test-correctness PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 		add_executable(test-medium ${SRC_CORR} ${SRC_COMMON} ${SRC_COMMON_REFIMPL}
 					  ${CORR_HEADERS} ${TESTS_HEADERS})
 		set_target_properties( test-medium PROPERTIES COMPILE_DEFINITIONS MEDIUM_TESTS )
+        set_target_properties( test-medium PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 		add_executable(test-short ${SRC_CORR} ${SRC_COMMON} ${SRC_COMMON_REFIMPL}
 					  ${CORR_HEADERS} ${TESTS_HEADERS})
 		set_target_properties( test-short PROPERTIES COMPILE_DEFINITIONS SHORT_TESTS )
+        set_target_properties( test-short PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 		if( NOT CORR_TEST_WITH_ACML AND NOT WIN32)
 			set_target_properties( test-correctness PROPERTIES LINKER_LANGUAGE Fortran )
@@ -374,6 +380,17 @@ if( GTEST_FOUND )
             ARCHIVE DESTINATION lib${SUFFIX_LIB}/import
             )
     
+    get_target_property( testLocation test-correctness LOCATION )
+
+    configure_file(
+        "${CMAKE_CURRENT_SOURCE_DIR}/copyTestDependencies.cmake.in"
+        "${CMAKE_CURRENT_BINARY_DIR}/copyTestDependencies.cmake"
+        @ONLY
+    )
+
+    # Register script at run at install time to analyze the executable and copy dependencies into package
+    install( SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/copyTestDependencies.cmake")
+ 
 	if( ACML_FOUND )
 		include_directories(${OPENCL_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
 			${clBLAS_SOURCE_DIR} ${clBLAS_SOURCE_DIR}/tests/include  ${clBLAS_SOURCE_DIR}/include)
@@ -384,6 +401,7 @@ if( GTEST_FOUND )
 			${SRC_COMMON_TIMER} ${PERF_HEADERS} ${TESTS_HEADERS}
 			${SRC_COMMON_REFIMPL})
 		target_link_libraries(test-performance ${ACML_LIBRARIES})
+        set_target_properties( test-performance PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 
 
 		if( BUILD_RUNTIME )
@@ -408,8 +426,9 @@ if( GTEST_FOUND )
 	add_executable(test-functional ${SRC_FUNC} ${SRC_COMMON} ${SRC_COMMON_TIMER}
 								  ${FUNC_HEADERS} ${TESTS_HEADERS})
 								  
+    set_target_properties( test-functional PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
 	if( BUILD_RUNTIME )
-		target_link_libraries(test-functional ${GTEST_LIBRARIES} ${TIME_LIBRARY} clBLAS)
+		target_link_libraries(test-functional ${GTEST_LIBRARIES} ${TIME_LIBRARY} ${THREAD_LIBRARY} clBLAS )
 	else()
 		target_link_libraries(test-functional ${GTEST_LIBRARIES} ${TIME_LIBRARY} ${THREAD_LIBRARY} ${OPENCL_LIBRARIES} ${runtime.library} )
 	endif()
diff --git a/src/tests/copyTestDependencies.cmake.in b/src/tests/copyTestDependencies.cmake.in
new file mode 100644
index 0000000..3a5d395
--- /dev/null
+++ b/src/tests/copyTestDependencies.cmake.in
@@ -0,0 +1,72 @@
+# Customized install script for fftw test program; analyzes all the shared library dependencies and installs
+# the dependencies into the package
+include( GetPrerequisites )
+
+#    message( testLocation ": @testLocation@" )
+
+# The Microsoft IDE presents a challenge because the full configuration is not known at cmake time
+# This logic allows us to 'substitute' the proper confguration at install time
+if( "${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "Debug" )
+    string( REPLACE "\$(Configuration)" "Debug" fixedTestLocation "@testLocation@" )
+elseif( "${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "Release" )
+    string( REPLACE "\$(Configuration)" "Release" fixedTestLocation "@testLocation@" )
+elseif( "${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "MinSizeRel" )
+    string( REPLACE "\$(Configuration)" "MinSizeRel" fixedTestLocation "@testLocation@" )
+elseif( "${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "RelwithDebInfo" )
+    string( REPLACE "\$(Configuration)" "RelwithDebInfo" fixedTestLocation "@testLocation@" )
+endif( )
+
+#    message( fixedTestLocation ": ${fixedTestLocation}" )
+# Get the directory that the test executable resides in; this helps get_prerequisites( ) find dependent libraries
+get_filename_component( testName "${fixedTestLocation}" NAME )
+string( REPLACE ${testName} "" testDir ${fixedTestLocation} )
+string( REGEX REPLACE "/+$" "" testDir ${testDir} )
+#    message( testDir ": ${testDir}" )
+
+set( installPath "" )
+if( WIN32 )
+    set( installPath "${CMAKE_INSTALL_PREFIX}/bin at SUFFIX_BIN@" )
+else( )
+    set( installPath "${CMAKE_INSTALL_PREFIX}/lib at SUFFIX_LIB@" )
+endif( )
+
+# Only search for dependencies that have ROOT defined
+set( depList "" )
+
+if( EXISTS "@ACML_ROOT@" )
+    list( APPEND depList "@ACML_ROOT@/lib" )
+endif( )
+
+if( EXISTS "@GTEST_ROOT@" )
+    list( APPEND depList "@GTEST_ROOT@/lib at SUFFIX_LIB@" )
+endif( )
+
+if( EXISTS "${testDir}" )
+    list( APPEND depList "${testDir}" )
+endif( )
+
+# message( STATUS "depList: ${depList}" )
+
+# This retrieves a list of shared library dependencies from the target; they are not full path names
+# Skip system dependencies and skip recursion
+get_prerequisites( ${fixedTestLocation} testDependencies 1 0 "" "${depList}" )
+
+# Loop on queried library dependencies and copy them into package
+foreach( dep ${testDependencies} )
+    # This converts the dependency into a full path
+    gp_resolve_item( "${fixedTestLocation}" "${dep}" "" "${depList}" dep_test_path )
+
+    # In linux, the dep_test_path may point to a symbolic link, we also need to copy real file
+    get_filename_component( dep_realpath "${dep_test_path}" REALPATH )
+    get_filename_component( dep_name "${dep_test_path}" NAME )
+    # message( STATUS "depName: ${dep_name}" )
+    # message( STATUS "depFullPath: ${dep_test_path}" )
+    # message( STATUS "dep_realpath: ${dep_realpath}" )
+
+    if( NOT EXISTS ${installPath}/${dep_name} )
+        file( INSTALL ${dep_test_path} ${dep_realpath}
+              USE_SOURCE_PERMISSIONS
+              DESTINATION ${installPath}
+            )
+    endif( )
+endforeach( )

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/clblas.git



More information about the debian-science-commits mailing list