1bf215546Sopenharmony_ci# Copyright © 2017 Broadcom
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_cifiles_libv3d = files(
22bf215546Sopenharmony_ci  'v3d_blit.c',
23bf215546Sopenharmony_ci  'v3d_bufmgr.c',
24bf215546Sopenharmony_ci  'v3d_bufmgr.h',
25bf215546Sopenharmony_ci  'v3d_cl.c',
26bf215546Sopenharmony_ci  'v3d_cl.h',
27bf215546Sopenharmony_ci  'v3d_context.c',
28bf215546Sopenharmony_ci  'v3d_context.h',
29bf215546Sopenharmony_ci  'v3d_disk_cache.c',
30bf215546Sopenharmony_ci  'v3d_fence.c',
31bf215546Sopenharmony_ci  'v3d_formats.c',
32bf215546Sopenharmony_ci  'v3d_job.c',
33bf215546Sopenharmony_ci  'v3d_program.c',
34bf215546Sopenharmony_ci  'v3d_query.c',
35bf215546Sopenharmony_ci  'v3d_query.h',
36bf215546Sopenharmony_ci  'v3d_query_pipe.c',
37bf215546Sopenharmony_ci  'v3d_query_perfcnt.c',
38bf215546Sopenharmony_ci  'v3d_resource.c',
39bf215546Sopenharmony_ci  'v3d_resource.h',
40bf215546Sopenharmony_ci  'v3d_screen.c',
41bf215546Sopenharmony_ci  'v3d_screen.h',
42bf215546Sopenharmony_ci  'v3d_uniforms.c',
43bf215546Sopenharmony_ci)
44bf215546Sopenharmony_ci
45bf215546Sopenharmony_cifiles_per_version = files(
46bf215546Sopenharmony_ci  'v3dx_draw.c',
47bf215546Sopenharmony_ci  'v3dx_emit.c',
48bf215546Sopenharmony_ci  'v3dx_format_table.c',
49bf215546Sopenharmony_ci  'v3dx_job.c',
50bf215546Sopenharmony_ci  'v3dx_rcl.c',
51bf215546Sopenharmony_ci  'v3dx_state.c',
52bf215546Sopenharmony_ci)
53bf215546Sopenharmony_ci
54bf215546Sopenharmony_civ3d_args = ['-DV3D_BUILD_NEON']
55bf215546Sopenharmony_ci
56bf215546Sopenharmony_cidep_v3dv3 = dependency('v3dv3', required: false)
57bf215546Sopenharmony_ciif dep_v3dv3.found()
58bf215546Sopenharmony_ci  v3d_args += '-DUSE_V3D_SIMULATOR'
59bf215546Sopenharmony_ciendif
60bf215546Sopenharmony_ci
61bf215546Sopenharmony_civ3d_versions = ['33', '41']
62bf215546Sopenharmony_ci
63bf215546Sopenharmony_ciper_version_libs = []
64bf215546Sopenharmony_ciforeach ver : v3d_versions
65bf215546Sopenharmony_ci  per_version_libs += static_library(
66bf215546Sopenharmony_ci    'v3d-v' + ver,
67bf215546Sopenharmony_ci    [files_per_version, v3d_xml_pack],
68bf215546Sopenharmony_ci    include_directories : [
69bf215546Sopenharmony_ci      inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_broadcom,
70bf215546Sopenharmony_ci      inc_gallium_drivers,
71bf215546Sopenharmony_ci    ],
72bf215546Sopenharmony_ci    c_args : [v3d_args, '-DV3D_VERSION=' + ver],
73bf215546Sopenharmony_ci    gnu_symbol_visibility : 'hidden',
74bf215546Sopenharmony_ci    dependencies : [dep_v3dv3, dep_libdrm, dep_valgrind, idep_nir_headers],
75bf215546Sopenharmony_ci)
76bf215546Sopenharmony_ci
77bf215546Sopenharmony_ciendforeach
78bf215546Sopenharmony_ci
79bf215546Sopenharmony_civ3d_neon_c_args = []
80bf215546Sopenharmony_ciif host_machine.cpu_family() == 'arm'
81bf215546Sopenharmony_ci    v3d_neon_c_args = '-mfpu=neon'
82bf215546Sopenharmony_ciendif
83bf215546Sopenharmony_ci
84bf215546Sopenharmony_cilibv3d = static_library(
85bf215546Sopenharmony_ci  'v3d',
86bf215546Sopenharmony_ci  [
87bf215546Sopenharmony_ci    files_libv3d,
88bf215546Sopenharmony_ci    v3d_xml_pack,
89bf215546Sopenharmony_ci  ],
90bf215546Sopenharmony_ci  include_directories : [
91bf215546Sopenharmony_ci    inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_broadcom,
92bf215546Sopenharmony_ci    inc_simulator, inc_gallium_drivers,
93bf215546Sopenharmony_ci  ],
94bf215546Sopenharmony_ci  c_args : [v3d_args],
95bf215546Sopenharmony_ci  cpp_args : [v3d_args],
96bf215546Sopenharmony_ci  gnu_symbol_visibility : 'hidden',
97bf215546Sopenharmony_ci  dependencies : [dep_v3dv3, dep_libdrm, dep_valgrind, idep_nir_headers],
98bf215546Sopenharmony_ci  link_with: [per_version_libs],
99bf215546Sopenharmony_ci)
100bf215546Sopenharmony_ci
101bf215546Sopenharmony_cidriver_v3d = declare_dependency(
102bf215546Sopenharmony_ci  compile_args : '-DGALLIUM_V3D',
103bf215546Sopenharmony_ci  link_with : [libv3d, libv3dwinsys, libbroadcom_cle, libbroadcom_v3d],
104bf215546Sopenharmony_ci  dependencies : idep_nir,
105bf215546Sopenharmony_ci)
106