Skip to content

Commit 0b41606

Browse files
author
Timmy
committed
Merge pull request #28 from kknox/develop
Logic added to packaging step
2 parents 08130dc + 1927730 commit 0b41606

File tree

4 files changed

+116
-1
lines changed

4 files changed

+116
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
clFFT
22
=====
3+
[![Build Status](https://travis-ci.org/clMathLibraries/clFFT.png)](https://travis-ci.org/clMathLibraries/clFFT)
34

45
clMath is a software library containing FFT and BLAS functions written in OpenCL. In addition to GPU devices, the libraries also support running on CPU devices to facilitate debugging and multicore programming.
56

67
<a href="http://developer.amd.com/tools-and-sdks/heterogeneous-computing/amd-accelerated-parallel-processing-math-libraries/">APPML 1.10</a> is the most current generally available version of the library, and pre-built binaries are available for download on both Linux and Windows platforms.
78

8-
[![Build Status](https://travis-ci.org/kknox/clFFT.png)](https://travis-ci.org/kknox/clFFT)
99
## Introduction to clFFT
1010

1111
The FFT is an implementation of the Discrete Fourier Transform (DFT) that makes use of symmetries in the FFT definition to reduce the mathematical intensity required from O(N<sup>2</sup>) to O(N log<sub>2</sub>( N )) when the sequence length N is the product of small prime factors. Currently, there is no standard API for FFT routines. Hardware vendors usually provide a set of high-performance FFTs optimized for their systems: no two vendors employ the same interfaces for their FFT routines. clFFT provides a set of FFT routines that are optimized for AMD graphics processors, but also are functional across CPU and other compute devices.

src/library/CMakeLists.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,34 @@ install( TARGETS clFFT
9595
LIBRARY DESTINATION lib${SUFFIX_LIB}
9696
ARCHIVE DESTINATION lib${SUFFIX_LIB}/import
9797
)
98+
99+
# For debug builds, include the debug runtimes into the package for testing on non-developer machines
100+
set( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP true )
101+
set( CMAKE_INSTALL_DEBUG_LIBRARIES true )
102+
set( CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY true )
103+
104+
if( WIN32 )
105+
set( CLFFT_RUNTIME_DESTINATION bin${SUFFIX_BIN} )
106+
else( )
107+
set( CLFFT_RUNTIME_DESTINATION lib${SUFFIX_LIB} )
108+
endif( )
109+
110+
include( InstallRequiredSystemLibraries )
111+
112+
# Install necessary runtime files for debug builds
113+
install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
114+
CONFIGURATIONS Debug
115+
DESTINATION ${CLFFT_RUNTIME_DESTINATION} )
116+
117+
# Install all *.pdb files for debug builds
118+
install( DIRECTORY ${PROJECT_BINARY_DIR}/staging/
119+
DESTINATION ${CLFFT_RUNTIME_DESTINATION}
120+
OPTIONAL
121+
CONFIGURATIONS Debug
122+
FILES_MATCHING PATTERN "*.pdb" )
123+
124+
# Install a snapshot of the source as it was for this build; useful for the .pdb's
125+
install( DIRECTORY ${PROJECT_SOURCE_DIR}
126+
DESTINATION ${CLFFT_RUNTIME_DESTINATION}
127+
OPTIONAL
128+
CONFIGURATIONS Debug )

src/tests/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,15 @@ install( TARGETS Test
104104
LIBRARY DESTINATION lib${SUFFIX_LIB}
105105
ARCHIVE DESTINATION lib${SUFFIX_LIB}/import
106106
)
107+
108+
get_target_property( testLocation Test LOCATION )
109+
110+
configure_file(
111+
"${CMAKE_CURRENT_SOURCE_DIR}/copyTestDependencies.cmake.in"
112+
"${CMAKE_CURRENT_BINARY_DIR}/copyTestDependencies.cmake"
113+
@ONLY
114+
)
115+
116+
# Register script at run at install time to analyze the executable and copy dependencies into package
117+
install( SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/copyTestDependencies.cmake")
118+
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Customized install script for fftw test program; analyzes all the shared library dependencies and installs
2+
# the dependencies into the package
3+
include( GetPrerequisites )
4+
5+
# message( testLocation ": @testLocation@" )
6+
7+
# The Microsoft IDE presents a challenge because the full configuration is not known at cmake time
8+
# This logic allows us to 'substitute' the proper confguration at install time
9+
if( "${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "Debug" )
10+
string( REPLACE "\$(Configuration)" "Debug" fixedTestLocation "@testLocation@" )
11+
elseif( "${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "Release" )
12+
string( REPLACE "\$(Configuration)" "Release" fixedTestLocation "@testLocation@" )
13+
elseif( "${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "MinSizeRel" )
14+
string( REPLACE "\$(Configuration)" "MinSizeRel" fixedTestLocation "@testLocation@" )
15+
elseif( "${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "RelwithDebInfo" )
16+
string( REPLACE "\$(Configuration)" "RelwithDebInfo" fixedTestLocation "@testLocation@" )
17+
endif( )
18+
19+
# message( fixedTestLocation ": ${fixedTestLocation}" )
20+
# Get the directory that the test executable resides in; this helps get_prerequisites( ) find dependent libraries
21+
get_filename_component( testName "${fixedTestLocation}" NAME )
22+
string( REPLACE ${testName} "" testDir ${fixedTestLocation} )
23+
string( REGEX REPLACE "/+$" "" testDir ${testDir} )
24+
# message( testDir ": ${testDir}" )
25+
26+
set( installPath "" )
27+
if( WIN32 )
28+
set( installPath "${CMAKE_INSTALL_PREFIX}/bin@SUFFIX_BIN@" )
29+
else( )
30+
set( installPath "${CMAKE_INSTALL_PREFIX}/lib@SUFFIX_LIB@" )
31+
endif( )
32+
33+
# Only search for dependencies that have ROOT defined
34+
set( depList "" )
35+
36+
if( EXISTS "@FFTW_ROOT@" )
37+
list( APPEND depList "@FFTW_ROOT@/lib@SUFFIX_LIB@" )
38+
endif( )
39+
40+
if( EXISTS "@GTEST_ROOT@" )
41+
list( APPEND depList "@GTEST_ROOT@/lib@SUFFIX_LIB@" )
42+
endif( )
43+
44+
if( EXISTS "${testDir}" )
45+
list( APPEND depList "${testDir}" )
46+
endif( )
47+
48+
# message( STATUS "depList: ${depList}" )
49+
50+
# This retrieves a list of shared library dependencies from the target; they are not full path names
51+
# Skip system dependencies and skip recursion
52+
get_prerequisites( ${fixedTestLocation} testDependencies 1 0 "" "${depList}" )
53+
54+
# Loop on queried library dependencies and copy them into package
55+
foreach( dep ${testDependencies} )
56+
# This converts the dependency into a full path
57+
gp_resolve_item( "${fixedTestLocation}" "${dep}" "" "${depList}" dep_test_path )
58+
59+
# In linux, the dep_test_path may point to a symbolic link, we also need to copy real file
60+
get_filename_component( dep_realpath "${dep_test_path}" REALPATH )
61+
get_filename_component( dep_name "${dep_test_path}" NAME )
62+
# message( STATUS "depName: ${dep_name}" )
63+
# message( STATUS "depFullPath: ${dep_test_path}" )
64+
# message( STATUS "dep_realpath: ${dep_realpath}" )
65+
66+
if( NOT EXISTS ${installPath}/${dep_name} )
67+
file( INSTALL ${dep_test_path} ${dep_realpath}
68+
USE_SOURCE_PERMISSIONS
69+
DESTINATION ${installPath}
70+
)
71+
endif( )
72+
endforeach( )

0 commit comments

Comments
 (0)