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