1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#!/bin/sh
# Copyright 2015 Ghislain Antony Vaillant
#
# This file is part of the autopkgtest testsuite for clFFT.
set -e
# Presence of $ADTTMP implies that someone will handle cleanup for us, so we
# can avoid duplicating the effort (signal handling, etc.) here.
if [ -z "$ADTTMP" ]
then
echo "Required envvar \"$ADTTMP\"is not set" >&2
exit 1
fi
# Copy example source code.
cp -a /usr/share/doc/libclfft-doc/examples/* "$ADTTMP"
cd "$ADTTMP"
# Create the CMake project.
cat <<EOF > CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(dummy)
find_package(OpenCL REQUIRED)
find_package(clFFT REQUIRED)
include_directories(\${CLFFT_INCLUDE_DIRS})
link_directories(\${CLFFT_LIBRARY_DIRS})
file(GLOB EXAMPLE_FILES "*.c")
set_source_files_properties(\${EXAMPLE_FILES} PROPERTIES LANGUAGE CXX)
foreach(FILE \${EXAMPLE_FILES})
get_filename_component(EXAMPLE \${FILE} NAME_WE)
set(EXAMPLE_NAME example_\${EXAMPLE})
add_executable(\${EXAMPLE_NAME} \${FILE})
target_link_libraries(\${EXAMPLE_NAME}
\${CLFFT_LIBRARIES}
\${OpenCL_LIBRARIES}
\${CMAKE_DL_LIBS}
)
endforeach()
EOF
# Configure and build.
mkdir build && cd build
cmake ./..
echo "configure: OK"
make
echo "build: OK"
|