• 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_native
48  clover_spirv_cpp_args += '-DHAVE_CLOVER_NATIVE'
49endif
50
51if with_opencl_spirv
52  clover_spirv_cpp_args += '-DHAVE_CLOVER_SPIRV'
53endif
54
55libclllvm = static_library(
56  'clllvm',
57  files(
58    'llvm/codegen/bitcode.cpp',
59    'llvm/codegen/common.cpp',
60    'llvm/codegen/native.cpp',
61    'llvm/codegen.hpp',
62    'llvm/compat.hpp',
63    'llvm/invocation.cpp',
64    'llvm/invocation.hpp',
65    'llvm/metadata.hpp',
66    'llvm/util.hpp',
67  ),
68  include_directories : clover_incs,
69  cpp_args : [
70    clover_cpp_args,
71    clover_opencl_cpp_args,
72    clover_spirv_cpp_args,
73    '-DCLANG_RESOURCE_DIR="@0@"'.format(join_paths(
74      dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir'), 'clang',
75      dep_llvm.version(), 'include',
76    )),
77  ],
78  gnu_symbol_visibility : 'hidden',
79  dependencies : [dep_llvm, dep_elf, dep_llvmspirvlib, idep_mesautil],
80)
81
82libclspirv = static_library(
83  'clspirv',
84  files('spirv/invocation.cpp', 'spirv/invocation.hpp'),
85  include_directories : clover_incs,
86  cpp_args : [clover_opencl_cpp_args, clover_spirv_cpp_args],
87  gnu_symbol_visibility : 'hidden',
88  dependencies : [dep_spirv_tools, idep_mesautil],
89)
90
91libclnir = static_library(
92  'clnir',
93  files('nir/invocation.cpp', 'nir/invocation.hpp'),
94  include_directories : [clover_incs, inc_mesa],
95  dependencies : idep_nir,
96  cpp_args : [clover_opencl_cpp_args, clover_spirv_cpp_args],
97  gnu_symbol_visibility : 'hidden',
98)
99
100clover_files = files(
101  'api/context.cpp',
102  'api/device.cpp',
103  'api/dispatch.cpp',
104  'api/dispatch.hpp',
105  'api/event.cpp',
106  'api/interop.cpp',
107  'api/invalid.cpp',
108  'api/kernel.cpp',
109  'api/memory.cpp',
110  'api/platform.cpp',
111  'api/program.cpp',
112  'api/queue.cpp',
113  'api/sampler.cpp',
114  'api/transfer.cpp',
115  'api/util.hpp',
116  'core/binary.cpp',
117  'core/binary.hpp',
118  'core/compiler.hpp',
119  'core/context.cpp',
120  'core/context.hpp',
121  'core/device.cpp',
122  'core/device.hpp',
123  'core/error.hpp',
124  'core/event.cpp',
125  'core/event.hpp',
126  'core/format.cpp',
127  'core/format.hpp',
128  'core/kernel.cpp',
129  'core/kernel.hpp',
130  'core/memory.cpp',
131  'core/memory.hpp',
132  'core/object.hpp',
133  'core/platform.cpp',
134  'core/platform.hpp',
135  'core/printf.cpp',
136  'core/printf.hpp',
137  'core/program.cpp',
138  'core/program.hpp',
139  'core/property.hpp',
140  'core/queue.cpp',
141  'core/queue.hpp',
142  'core/resource.cpp',
143  'core/resource.hpp',
144  'core/sampler.cpp',
145  'core/sampler.hpp',
146  'core/timestamp.cpp',
147  'core/timestamp.hpp',
148  'util/adaptor.hpp',
149  'util/algebra.hpp',
150  'util/algorithm.hpp',
151  'util/compat.hpp',
152  'util/factor.hpp',
153  'util/functional.hpp',
154  'util/lazy.hpp',
155  'util/pointer.hpp',
156  'util/range.hpp',
157  'util/tuple.hpp',
158)
159
160libclover = static_library(
161  'clover',
162  [clover_files, sha1_h],
163  include_directories : clover_incs,
164  cpp_args : [
165    clover_opencl_cpp_args,
166    clover_spirv_cpp_args,
167    clover_cpp_args,
168  ],
169  gnu_symbol_visibility : 'hidden',
170  link_with : [libclllvm, libclspirv, libclnir],
171  dependencies : idep_mesautil,
172)
173