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 (108 lines) | stat: -rw-r--r-- 4,058 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
#=============================================================================
#   CMake build system files
#
#   Copyright (c) 2014 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.
#
#=============================================================================

separate_arguments(HOST_CLANG_FLAGS)
separate_arguments(HOST_LLC_FLAGS)

# these are hardcoded here b/c we want to build the library with latest OpenCL
add_definitions(-DCL_TARGET_OPENCL_VERSION=300 -DCL_HPP_TARGET_OPENCL_VERSION=300)
include_directories("${CMAKE_SOURCE_DIR}/include" "${CMAKE_SOURCE_DIR}/include/hpp")

cpack_add_component("lib")

set("CPACK_DEBIAN_LIB_PACKAGE_NAME" "libpocl2")
set(CPACK_DEBIAN_LIB_PACKAGE_DEPENDS "libgcc1;libc6")
if(ENABLE_HWLOC)
	if( LLVM_VERSION_MAJOR LESS 12)
		set(HWLOC_NUMBER_PART 5)
	else()
		set(HWLOC_NUMBER_PART 15)
	endif()
	list(APPEND CPACK_DEBIAN_LIB_PACKAGE_DEPENDS "libhwloc${HWLOC_NUMBER_PART} (>= ${Hwloc_VERSION}~)")
endif()
if(ENABLE_LLVM)
	list(APPEND CPACK_DEBIAN_LIB_PACKAGE_DEPENDS "libllvm${LLVM_VERSION_MAJOR} (>= ${LLVM_VERSION_MAJOR}~);clang-${LLVM_VERSION_MAJOR} (>= ${LLVM_VERSION_MAJOR}~)")
endif()
string(REPLACE ";" ", " CPACK_DEBIAN_LIB_PACKAGE_DEPENDS "${CPACK_DEBIAN_LIB_PACKAGE_DEPENDS}")
set(CPACK_DEBIAN_LIB_PACKAGE_RECOMMENDS "pocl-opencl-icd")
set(CPACK_DEBIAN_LIB_PACKAGE_BREAKS "libpocl1-common (<< 0.13-9)")
set(CPACK_DEBIAN_LIB_PACKAGE_REPLACES "libpocl1-common (<< 0.13-9)")
 

if (ENABLE_LLVM)
  add_subdirectory("kernel")
  add_subdirectory("llvmopencl")
endif()

add_subdirectory("CL")

#############################################################

# must be after adding lib/CL subdir b/c of libpocl target,
# but before poclu & examples & tests (they need these variables)

if(ENABLE_ICD)

  # -pthread makes gdb happier when debugging tests
  set(OPENCL_LIBS "${PTHREAD_LIBRARY};${OPENCL_LIBRARIES}")

  if(OPENCL_LIBRARIES)
    if (NOT OPENCL_LIBDIR)
      get_filename_component(OPENCL_LIBDIR "${OPENCL_LIBRARIES}" DIRECTORY)
    endif()
    get_filename_component(OPENCL_LIBNAME "${OPENCL_LIBRARIES}" NAME)
  endif()

else()

  # when we link pocl directly as libOpenCL.so,
  # llvm+clang libs are a transitive dependency of
  # executables (e.g. poclcc -> libOpenCL -> libLLVM)
  # and this must be specified on new systems,
  # otherwise linking fails.
  set(OPENCL_LIBS "${PTHREAD_LIBRARY};${POCL_LIBRARY_NAME};${POCL_TRANSITIVE_LIBS}")

  set(OPENCL_LIBDIR "$<TARGET_FILE_DIR:${POCL_LIBRARY_NAME}>")
  set(OPENCL_LIBNAME "$<TARGET_FILE_NAME:${POCL_LIBRARY_NAME}>")

endif()


if(SANITIZER_OPTIONS)
  list(INSERT OPENCL_LIBS 0 ${SANITIZER_LIBS})
endif()

set(OPENCL_CFLAGS "")

set(OPENCL_CFLAGS_STR "${OPENCL_CFLAGS}")
separate_arguments(OPENCL_CFLAGS)

set(OPENCL_LIBS "${OPENCL_LIBS}" PARENT_SCOPE)
set(OPENCL_CFLAGS "${OPENCL_CFLAGS}" PARENT_SCOPE)
set(OPENCL_CFLAGS_STR "${OPENCL_CFLAGS_STR}" PARENT_SCOPE)
set(OPENCL_LIBDIR "${OPENCL_LIBDIR}" PARENT_SCOPE)
set(OPENCL_LIBNAME "${OPENCL_LIBNAME}" PARENT_SCOPE)

pass_through_cpack_vars()