meson.build revision 7ec681f3
17ec681f3Smrg# Copyright © Microsoft Corporation 27ec681f3Smrg 37ec681f3Smrg# Permission is hereby granted, free of charge, to any person obtaining a 47ec681f3Smrg# copy of this software and associated documentation files (the "Software"), 57ec681f3Smrg# to deal in the Software without restriction, including without limitation 67ec681f3Smrg# the rights to use, copy, modify, merge, publish, distribute, sublicense, 77ec681f3Smrg# and/or sell copies of the Software, and to permit persons to whom the 87ec681f3Smrg# Software is furnished to do so, subject to the following conditions: 97ec681f3Smrg 107ec681f3Smrg# The above copyright notice and this permission notice (including the next 117ec681f3Smrg# paragraph) shall be included in all copies or substantial portions of the 127ec681f3Smrg# Software. 137ec681f3Smrg 147ec681f3Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 157ec681f3Smrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 167ec681f3Smrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 177ec681f3Smrg# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 187ec681f3Smrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 197ec681f3Smrg# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 207ec681f3Smrg# IN THE SOFTWARE. 217ec681f3Smrg 227ec681f3Smrgclang_resource_dir = join_paths(llvm_libdir, 'clang', dep_llvm.version(), 'include') 237ec681f3Smrg 247ec681f3Smrgopencl_c_h = custom_target( 257ec681f3Smrg 'opencl-c.h', 267ec681f3Smrg input : [files_xxd, join_paths(clang_resource_dir, 'opencl-c.h')], 277ec681f3Smrg output : 'opencl-c.h.h', 287ec681f3Smrg command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'opencl_c_source'], 297ec681f3Smrg) 307ec681f3Smrgopencl_c_base_h = custom_target( 317ec681f3Smrg 'opencl-c-base.h', 327ec681f3Smrg input : [files_xxd, join_paths(clang_resource_dir, 'opencl-c-base.h')], 337ec681f3Smrg output : 'opencl-c-base.h.h', 347ec681f3Smrg command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'opencl_c_base_source'], 357ec681f3Smrg) 367ec681f3Smrg 377ec681f3Smrgfiles_libclc = files( 387ec681f3Smrg 'clc.c', 397ec681f3Smrg 'clc_helpers.cpp', 407ec681f3Smrg) 417ec681f3Smrg 427ec681f3Smrg_libclc_cpp_args = ['-DCLANG_RESOURCE_DIR="@0@"'.format(clang_resource_dir)] 437ec681f3Smrgif with_microsoft_clc 447ec681f3Smrg _libclc_cpp_args += ['-DUSE_STATIC_OPENCL_C_H=1'] 457ec681f3Smrgendif 467ec681f3Smrg 477ec681f3Smrg# Supported added for SPIRV 1.4 in a version that required LLVM 14. 487ec681f3Smrgif dep_llvm.version().version_compare('>= 14.0') 497ec681f3Smrg _libclc_cpp_args += ['-DHAS_SPIRV_1_4=1'] 507ec681f3Smrgendif 517ec681f3Smrg 527ec681f3Smrg_libclc = static_library( 537ec681f3Smrg 'libclc', 547ec681f3Smrg files_libclc, 557ec681f3Smrg opencl_c_h, 567ec681f3Smrg opencl_c_base_h, 577ec681f3Smrg include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_compiler, inc_spirv], 587ec681f3Smrg cpp_args : _libclc_cpp_args, 597ec681f3Smrg dependencies: [idep_nir_headers, dep_clang, dep_llvm, dep_llvmspirvlib, 607ec681f3Smrg idep_mesautil, idep_nir, dep_spirv_tools] 617ec681f3Smrg) 627ec681f3Smrg 637ec681f3Smrgidep_clc = declare_dependency( 647ec681f3Smrg link_with : _libclc, 657ec681f3Smrg include_directories : include_directories('.'), 667ec681f3Smrg) 67