File: CMakeLists.txt

package info (click to toggle)
pocl 6.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,320 kB
  • sloc: lisp: 149,513; ansic: 103,778; cpp: 54,947; python: 1,513; sh: 949; ruby: 255; pascal: 226; tcl: 180; makefile: 175; java: 72; xml: 49
file content (123 lines) | stat: -rw-r--r-- 5,412 bytes parent folder | download | duplicates (2)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#=============================================================================
#   CMake build system files
#
#   Copyright (c) 2015 pocl developers
#
#   Permission is hereby granted, free of charge, to any person obtaining a copy
#   of this software and associated documentation files (the "Software"), to deal
#   in the Software without restriction, including without limitation the rights
#   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#   copies of the Software, and to permit persons to whom the Software is
#   furnished to do so, subject to the following conditions:
#
#   The above copyright notice and this permission notice shall be included in
#   all copies or substantial portions of the Software.
#
#   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#   THE SOFTWARE.
#
#=============================================================================

set(TS_NAME "PyOpenCL")
set(TS_BASEDIR "${TESTSUITE_BASEDIR}/${TS_NAME}")
set(TS_BUILDDIR "${TS_BASEDIR}/src/${TS_NAME}-build")
set(TS_SRCDIR "${TS_BASEDIR}/src/${TS_NAME}")

# TODO for whatever reason, compyte (required for running tests)
# is not included in pyopencl release tars. For now force using git
set(EXAMPLES_USE_GIT_MASTER 1)

if(EXAMPLES_USE_GIT_MASTER)
  set(FETCH_SOURCE
    GIT_REPOSITORY "https://github.com/inducer/pyopencl.git"
    GIT_TAG v2024.1
    ${GIT_OPTIONS}
    GIT_SUBMODULES "pyopencl/compyte")
else()
  set(FETCH_SOURCE URL "https://github.com/inducer/pyopencl/archive/v2024.1.tar.gz")
endif()

if(NOT TESTS_USE_ICD)
  message(STATUS "Disabling testsuite ${TS_NAME}, requires ocl-icd")
elseif(NOT BASH)
  message(STATUS "Disabling testsuite ${TS_NAME}, can't find bash shell")
else()

find_program(VIRTUALENV NAMES "virtualenv")
find_package(Python3 3.8 COMPONENTS Interpreter Development)
if(NOT Python3_FOUND)
  message(STATUS "Disabling testsuite ${TS_NAME}, can't find suitable python3")
  return()
else()
  message(STATUS "Using Python3: ${Python3_EXECUTABLE}")
  set(PYTHON_INTERP "${Python3_EXECUTABLE}")
endif()

if(VIRTUALENV)

  message(STATUS "Enabling testsuite ${TS_NAME}")
  list(APPEND ACTUALLY_ENABLED_TESTSUITES "${TS_NAME}")
  set(ACTUALLY_ENABLED_TESTSUITES ${ACTUALLY_ENABLED_TESTSUITES} PARENT_SCOPE)

  ExternalProject_Add(
    ${TS_NAME}
    PREFIX "${TS_BASEDIR}"
    ${FETCH_SOURCE}

    # have to use external scripts, because CMake has /bin/sh hardcoded,
    # and /bin/sh on Ubuntu is dash, which doesn't support "source"
    # command.
    CONFIGURE_COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/configure.sh"
      "${TS_BASEDIR}"
      "${TS_BUILDDIR}"
      "${TS_SRCDIR}"
      "${VIRTUALENV}"
      "${PYTHON_INTERP}"

    BUILD_COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/build.sh"
      "${TS_BASEDIR}"
      "${TS_BUILDDIR}"
      "${TS_SRCDIR}"

    INSTALL_COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/install.sh"
      "${TS_BASEDIR}"
      "${TS_BUILDDIR}"
      "${TS_SRCDIR}"
  )


  set_target_properties(${TS_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE)
  add_dependencies(prepare_examples ${TS_NAME})

#  add_test(NAME "PyOpenCL_" COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh" "${TS_BASEDIR}" "${TS_BUILDDIR}" "${TS_SRCDIR}"  )
  add_test(NAME "PyOpenCL_test_algorithm" COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh" "${TS_BASEDIR}" "${TS_BUILDDIR}" "${TS_SRCDIR}" test_algorithm.py )
  add_test(NAME "PyOpenCL_test_array" COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh" "${TS_BASEDIR}" "${TS_BUILDDIR}" "${TS_SRCDIR}" test_array.py )
  add_test(NAME "PyOpenCL_test_arrays_in_structs" COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh" "${TS_BASEDIR}" "${TS_BUILDDIR}" "${TS_SRCDIR}" test_arrays_in_structs.py )
  add_test(NAME "PyOpenCL_test_clmath" COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh" "${TS_BASEDIR}" "${TS_BUILDDIR}" "${TS_SRCDIR}" test_clmath.py )
  add_test(NAME "PyOpenCL_test_clrandom" COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh" "${TS_BASEDIR}" "${TS_BUILDDIR}" "${TS_SRCDIR}" test_clrandom.py )
  add_test(NAME "PyOpenCL_test_enqueue_copy" COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh" "${TS_BASEDIR}" "${TS_BUILDDIR}" "${TS_SRCDIR}" test_enqueue_copy.py )
# The wrapper test seems to be broken. Tests an AMD topology constructor
# which is not found. Doesn't seem to have anything to do with PoCL-
#  add_test(NAME "PyOpenCL_test_wrapper" COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh" "${TS_BASEDIR}" "${TS_BUILDDIR}" "${TS_SRCDIR}" test_wrapper.py )

  set_tests_properties("PyOpenCL_test_algorithm"
    "PyOpenCL_test_array" "PyOpenCL_test_arrays_in_structs"
    "PyOpenCL_test_clmath" "PyOpenCL_test_clrandom"
    "PyOpenCL_test_enqueue_copy" #"PyOpenCL_test_wrapper"
    PROPERTIES
      ENVIRONMENT "PYOPENCL_NO_CACHE=1;PYOPENCL_TEST=portable"
      COST 400.0
      LABELS "PyOpenCL")

else()

  message(STATUS "Disabling testsuite ${TS_NAME}, requires python virtualenv")

endif()

endif()