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