6704f8567bb9d888111823e4a1298981b30ea7fc
[mesa.git] / src / gallium / state_trackers / clover / meson.build
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
21 clover_cpp_args = []
22 clover_spirv_cpp_args = []
23 clover_incs = [inc_include, inc_src, inc_gallium, inc_gallium_aux]
24
25 # the CL header files declare attributes on the CL types. Compilers warn if
26 # we use them as template arguments. Disable the warning as there isn't
27 # anything we can do about it
28 if cpp.has_argument('-Wno-ignored-attributes')
29 clover_cpp_args += '-Wno-ignored-attributes'
30 endif
31
32 if with_opencl_icd
33 clover_cpp_args += '-DHAVE_CLOVER_ICD'
34 endif
35
36 if with_opencl_spirv
37 clover_spirv_cpp_args += '-DHAVE_CLOVER_SPIRV'
38 endif
39
40 libclllvm = static_library(
41 'clllvm',
42 files(
43 'llvm/codegen/bitcode.cpp',
44 'llvm/codegen/common.cpp',
45 'llvm/codegen/native.cpp',
46 'llvm/codegen.hpp',
47 'llvm/compat.hpp',
48 'llvm/invocation.cpp',
49 'llvm/invocation.hpp',
50 'llvm/metadata.hpp',
51 'llvm/util.hpp',
52 ),
53 include_directories : clover_incs,
54 cpp_args : [
55 clover_cpp_args,
56 clover_spirv_cpp_args,
57 cpp_vis_args,
58 '-DLIBCLC_INCLUDEDIR="@0@/"'.format(dep_clc.get_pkgconfig_variable('includedir')),
59 '-DLIBCLC_LIBEXECDIR="@0@/"'.format(dep_clc.get_pkgconfig_variable('libexecdir')),
60 '-DCLANG_RESOURCE_DIR="@0@"'.format(join_paths(
61 dep_llvm.get_configtool_variable('libdir'), 'clang',
62 dep_llvm.version(), 'include',
63 )),
64 ],
65 dependencies : [dep_llvm, dep_elf, dep_llvmspirvlib],
66 override_options : clover_cpp_std,
67 )
68
69 libclspirv = static_library(
70 'clspirv',
71 files('spirv/invocation.cpp', 'spirv/invocation.hpp'),
72 include_directories : clover_incs,
73 cpp_args : [clover_spirv_cpp_args, cpp_vis_args],
74 dependencies : [dep_spirv_tools],
75 override_options : clover_cpp_std,
76 )
77
78 libclnir = static_library(
79 'clnir',
80 [files('nir/invocation.cpp', 'nir/invocation.hpp'), nir_opcodes_h],
81 include_directories : [clover_incs, inc_mesa],
82 cpp_args : [clover_spirv_cpp_args, cpp_vis_args],
83 link_with : [libnir],
84 override_options : clover_cpp_std,
85 )
86
87 clover_files = files(
88 'api/context.cpp',
89 'api/device.cpp',
90 'api/dispatch.cpp',
91 'api/dispatch.hpp',
92 'api/event.cpp',
93 'api/interop.cpp',
94 'api/kernel.cpp',
95 'api/memory.cpp',
96 'api/platform.cpp',
97 'api/program.cpp',
98 'api/queue.cpp',
99 'api/sampler.cpp',
100 'api/transfer.cpp',
101 'api/util.hpp',
102 'core/compiler.hpp',
103 'core/context.cpp',
104 'core/context.hpp',
105 'core/device.cpp',
106 'core/device.hpp',
107 'core/error.hpp',
108 'core/event.cpp',
109 'core/event.hpp',
110 'core/format.cpp',
111 'core/format.hpp',
112 'core/kernel.cpp',
113 'core/kernel.hpp',
114 'core/memory.cpp',
115 'core/memory.hpp',
116 'core/module.cpp',
117 'core/module.hpp',
118 'core/object.hpp',
119 'core/platform.cpp',
120 'core/platform.hpp',
121 'core/program.cpp',
122 'core/program.hpp',
123 'core/property.hpp',
124 'core/queue.cpp',
125 'core/queue.hpp',
126 'core/resource.cpp',
127 'core/resource.hpp',
128 'core/sampler.cpp',
129 'core/sampler.hpp',
130 'core/timestamp.cpp',
131 'core/timestamp.hpp',
132 'util/adaptor.hpp',
133 'util/algebra.hpp',
134 'util/algorithm.hpp',
135 'util/factor.hpp',
136 'util/functional.hpp',
137 'util/lazy.hpp',
138 'util/pointer.hpp',
139 'util/range.hpp',
140 'util/tuple.hpp',
141 )
142
143 libclover = static_library(
144 'clover',
145 [clover_files, sha1_h],
146 include_directories : clover_incs,
147 cpp_args : [clover_spirv_cpp_args, clover_cpp_args, cpp_vis_args],
148 link_with : [libclllvm, libclspirv, libclnir],
149 override_options : clover_cpp_std,
150 )