diff --git a/scripts/env/find_msvc.lua b/scripts/env/find_msvc.lua index 050e2e5..1fb89df 100644 --- a/scripts/env/find_msvc.lua +++ b/scripts/env/find_msvc.lua @@ -257,6 +257,14 @@ local function ucrtpath(arch, optimize) return redist end +local function llvmpath() + local path = installpath().."/VC/Tools/Llvm/x64/lib/clang/" + for p in fs.pairs(path) do + local version = p:filename():string() + return path .. version .."/lib/windows/" + end +end + return { installpath = installpath, toolspath = toolspath, @@ -265,5 +273,6 @@ return { binpath = binpath, vcrtpath = vcrtpath, ucrtpath = ucrtpath, - findwinsdk = findwinsdk + findwinsdk = findwinsdk, + llvmpath = llvmpath, } diff --git a/scripts/env/msvc.lua b/scripts/env/msvc.lua index 0b7b5bc..97e92a2 100644 --- a/scripts/env/msvc.lua +++ b/scripts/env/msvc.lua @@ -106,5 +106,6 @@ end m.binpath = find_msvc.binpath m.vcrtpath = find_msvc.vcrtpath m.ucrtpath = find_msvc.ucrtpath +m.llvmpath = find_msvc.llvmpath return m diff --git a/scripts/writer.lua b/scripts/writer.lua index b40eab5..47c20d2 100644 --- a/scripts/writer.lua +++ b/scripts/writer.lua @@ -707,10 +707,12 @@ function GEN.msvc_copydll(attribute, name) end end elseif attribute.type == "asan" then - local inputdir = msvc.binpath(archalias) local filename = ("clang_rt.asan_dynamic-%s.dll"):format( attribute.arch == "x86_64" and "x86_64" or "i386" ) + local inputdir = globals.cc == "clang-cl" + and msvc.llvmpath() + or msvc.binpath(archalias) for _, outputdir in ipairs(attributeOutputs) do inputs[#inputs+1] = fsutil.join(inputdir, filename) outputs[#outputs+1] = fsutil.join(outputdir, filename)