Skip to content

Commit

Permalink
Adds basic support for using clang in-place of cl on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
leidegre committed Nov 11, 2023
1 parent ea89e10 commit ae8569a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scripts/tundra/tools/msvc-clang.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module(..., package.seeall)

local vslatest = require "tundra.tools.msvc-latest"

function apply(env, options)
local extra = {
Clang = true
}

vslatest.apply(env, options, extra)

env:set_many{
["CC"] = "clang-cl",
["CXX"] = "clang-cl",
["LD"] = "lld-link"
}
end
13 changes: 13 additions & 0 deletions scripts/tundra/tools/msvc-latest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,19 @@ function apply(env, options, extra)
env_lib[#env_lib + 1] = native_path.join(vc_tools_dir, "lib\\onecore\\" .. target_arch)
end

if extra.Clang then
-- file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio/2022/BuildTools/VC/Tools/Llvm
if target_arch == "x64" then
env_path[#env_path + 1] = native_path.join(vs_install_dir, "VC\\Tools\\Llvm\\x64\\bin")
elseif target_arch == "arm64" then
env_path[#env_path + 1] = native_path.join(vs_install_dir, "VC\\Tools\\Llvm\\ARM64\\bin")
elseif target_arch == "x86" then
env_path[#env_path + 1] = native_path.join(vs_install_dir, "VC\\Tools\\Llvm\\bin")
else
error("msvc-clang: target architecutre '" .. target_arch .. "' not supported")
end
end

-- Force MSPDBSRV.EXE (fix for issue with cl.exe running in parallel and otherwise corrupting PDB files)
-- These options where added to Visual C++ in Visual Studio 2013. They do not exist in older versions.
env:set("CCOPTS", "/FS")
Expand Down

0 comments on commit ae8569a

Please sign in to comment.