mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-20 18:40:39 +02:00
compiler/clc: grab opencl-c.h from the system path by default
By default we use the header installed opencl-c.h header. But in the case Mesa is compiled for microsoft clon12 we keep the injected file. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9156>
This commit is contained in:
parent
8490766f53
commit
d2264489ce
2 changed files with 22 additions and 1 deletions
|
|
@ -53,8 +53,10 @@
|
|||
|
||||
#include "spirv.h"
|
||||
|
||||
#ifdef USE_STATIC_OPENCL_C_H
|
||||
#include "opencl-c.h.h"
|
||||
#include "opencl-c-base.h.h"
|
||||
#endif
|
||||
|
||||
#include "clc_helpers.h"
|
||||
|
||||
|
|
@ -785,6 +787,8 @@ clc_compile_to_llvm_module(const struct clc_compile_args *args,
|
|||
c->getDiagnostics(), c->getInvocation().TargetOpts));
|
||||
|
||||
c->getFrontendOpts().ProgramAction = clang::frontend::EmitLLVMOnly;
|
||||
|
||||
#ifdef USE_STATIC_OPENCL_C_H
|
||||
c->getHeaderSearchOpts().UseBuiltinIncludes = false;
|
||||
c->getHeaderSearchOpts().UseStandardSystemIncludes = false;
|
||||
|
||||
|
|
@ -806,6 +810,18 @@ clc_compile_to_llvm_module(const struct clc_compile_args *args,
|
|||
c->getPreprocessorOpts().addRemappedFile(system_header_path.str(),
|
||||
::llvm::MemoryBuffer::getMemBuffer(llvm::StringRef(opencl_c_base_source, ARRAY_SIZE(opencl_c_base_source) - 1)).release());
|
||||
}
|
||||
#else
|
||||
c->getHeaderSearchOpts().UseBuiltinIncludes = true;
|
||||
c->getHeaderSearchOpts().UseStandardSystemIncludes = true;
|
||||
c->getHeaderSearchOpts().ResourceDir = CLANG_RESOURCE_DIR;
|
||||
|
||||
// Add opencl-c generic search path
|
||||
c->getHeaderSearchOpts().AddPath(CLANG_RESOURCE_DIR,
|
||||
clang::frontend::Angled,
|
||||
false, false);
|
||||
// Add opencl include
|
||||
c->getPreprocessorOpts().Includes.push_back("opencl-c.h");
|
||||
#endif
|
||||
|
||||
if (args->num_headers) {
|
||||
::llvm::SmallString<128> tmp_header_path;
|
||||
|
|
|
|||
|
|
@ -39,13 +39,18 @@ files_libclc = files(
|
|||
'clc_helpers.cpp',
|
||||
)
|
||||
|
||||
_libclc_cpp_args = ['-DCLANG_RESOURCE_DIR="@0@"'.format(clang_resource_dir)]
|
||||
if with_microsoft_clc
|
||||
_libclc_cpp_args += ['-DUSE_STATIC_OPENCL_C_H=1']
|
||||
endif
|
||||
|
||||
_libclc = static_library(
|
||||
'libclc',
|
||||
files_libclc,
|
||||
opencl_c_h,
|
||||
opencl_c_base_h,
|
||||
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_compiler, inc_spirv],
|
||||
cpp_args : ['-DCLANG_RESOURCE_DIR="@0@"'.format(clang_resource_dir)],
|
||||
cpp_args : _libclc_cpp_args,
|
||||
dependencies: [idep_nir_headers, dep_clang, dep_llvm, dep_llvmspirvlib,
|
||||
idep_mesautil, idep_nir, dep_spirv_tools]
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue