• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright © 2017-2018 Intel Corporation
2
3# Permission is hereby granted, free of charge, to any person obtaining a copy
4# of this software and associated documentation files (the "Software"), to deal
5# in the Software without restriction, including without limitation the rights
6# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7# copies of the Software, and to permit persons to whom the Software is
8# furnished to do so, subject to the following conditions:
9
10# The above copyright notice and this permission notice shall be included in
11# all copies or substantial portions of the Software.
12
13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19# SOFTWARE.
20
21clover_cpp_args = []
22clover_opencl_cpp_args = [
23  '-DCL_TARGET_OPENCL_VERSION=300',
24  '-DCL_USE_DEPRECATED_OPENCL_1_0_APIS',
25  '-DCL_USE_DEPRECATED_OPENCL_1_1_APIS',
26  '-DCL_USE_DEPRECATED_OPENCL_1_2_APIS',
27  '-DCL_USE_DEPRECATED_OPENCL_2_0_APIS',
28  '-DCL_USE_DEPRECATED_OPENCL_2_1_APIS',
29  '-DCL_USE_DEPRECATED_OPENCL_2_2_APIS',
30  '-DLIBCLC_INCLUDEDIR="@0@/"'.format(dep_clc.get_variable(pkgconfig : 'includedir')),
31  '-DLIBCLC_LIBEXECDIR="@0@/"'.format(dep_clc.get_variable(pkgconfig : 'libexecdir'))
32]
33clover_spirv_cpp_args = []
34clover_incs = [inc_include, inc_src, inc_gallium, inc_gallium_aux]
35
36# the CL header files declare attributes on the CL types. Compilers warn if
37# we use them as template arguments. Disable the warning as there isn't
38# anything we can do about it
39if cpp.has_argument('-Wno-ignored-attributes')
40   clover_cpp_args += '-Wno-ignored-attributes'
41endif
42
43if with_opencl_icd
44  clover_cpp_args += '-DHAVE_CLOVER_ICD'
45endif
46
47if with_opencl_spirv
48  clover_spirv_cpp_args += '-DHAVE_CLOVER_SPIRV'
49endif
50
51libclllvm = static_library(
52  'clllvm',
53  files(
54    'llvm/codegen/bitcode.cpp',
55    'llvm/codegen/common.cpp',
56    'llvm/codegen/native.cpp',
57    'llvm/codegen.hpp',
58    'llvm/compat.hpp',
59    'llvm/invocation.cpp',
60    'llvm/invocation.hpp',
61    'llvm/metadata.hpp',
62    'llvm/util.hpp',
63  ),
64  include_directories : clover_incs,
65  cpp_args : [
66    clover_cpp_args,
67    clover_opencl_cpp_args,
68    clover_spirv_cpp_args,
69    '-DCLANG_RESOURCE_DIR="@0@"'.format(join_paths(
70      dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir'), 'clang',
71      dep_llvm.version(), 'include',
72    )),
73  ],
74  gnu_symbol_visibility : 'hidden',
75  dependencies : [dep_llvm, dep_elf, dep_llvmspirvlib, idep_mesautil],
76)
77
78idep_opencl_spirv = null_dep
79if with_opencl_spirv
80  libclspirv = static_library(
81    'clspirv',
82    files('spirv/invocation.cpp', 'spirv/invocation.hpp'),
83    include_directories : clover_incs,
84    cpp_args : [clover_opencl_cpp_args, clover_spirv_cpp_args],
85    gnu_symbol_visibility : 'hidden',
86    dependencies : [dep_spirv_tools, idep_mesautil],
87  )
88
89  libclnir = static_library(
90    'clnir',
91    files('nir/invocation.cpp', 'nir/invocation.hpp'),
92    include_directories : [clover_incs, inc_mesa],
93    dependencies : [idep_nir, idep_vtn, idep_mesaclc],
94    cpp_args : [clover_opencl_cpp_args, clover_spirv_cpp_args],
95    gnu_symbol_visibility : 'hidden',
96  )
97
98  idep_opencl_spirv = declare_dependency(
99    dependencies : [idep_nir],
100    link_with : [libclspirv, libclnir],
101  )
102endif
103
104clover_files = files(
105  'api/context.cpp',
106  'api/device.cpp',
107  'api/dispatch.cpp',
108  'api/dispatch.hpp',
109  'api/event.cpp',
110  'api/interop.cpp',
111  'api/invalid.cpp',
112  'api/kernel.cpp',
113  'api/memory.cpp',
114  'api/platform.cpp',
115  'api/program.cpp',
116  'api/queue.cpp',
117  'api/sampler.cpp',
118  'api/transfer.cpp',
119  'api/util.hpp',
120  'core/binary.cpp',
121  'core/binary.hpp',
122  'core/compiler.hpp',
123  'core/context.cpp',
124  'core/context.hpp',
125  'core/device.cpp',
126  'core/device.hpp',
127  'core/error.hpp',
128  'core/event.cpp',
129  'core/event.hpp',
130  'core/format.cpp',
131  'core/format.hpp',
132  'core/kernel.cpp',
133  'core/kernel.hpp',
134  'core/memory.cpp',
135  'core/memory.hpp',
136  'core/object.hpp',
137  'core/platform.cpp',
138  'core/platform.hpp',
139  'core/printf.cpp',
140  'core/printf.hpp',
141  'core/program.cpp',
142  'core/program.hpp',
143  'core/property.hpp',
144  'core/queue.cpp',
145  'core/queue.hpp',
146  'core/resource.cpp',
147  'core/resource.hpp',
148  'core/sampler.cpp',
149  'core/sampler.hpp',
150  'core/timestamp.cpp',
151  'core/timestamp.hpp',
152  'util/adaptor.hpp',
153  'util/algebra.hpp',
154  'util/algorithm.hpp',
155  'util/compat.hpp',
156  'util/factor.hpp',
157  'util/functional.hpp',
158  'util/lazy.hpp',
159  'util/pointer.hpp',
160  'util/range.hpp',
161  'util/tuple.hpp',
162)
163
164libclover = static_library(
165  'clover',
166  [clover_files, sha1_h],
167  include_directories : clover_incs,
168  cpp_args : [
169    clover_opencl_cpp_args,
170    clover_spirv_cpp_args,
171    clover_cpp_args,
172  ],
173  gnu_symbol_visibility : 'hidden',
174  link_with : [libclllvm],
175  dependencies : [idep_mesautil, idep_nir, idep_opencl_spirv],
176)
177