Skip to content

Commit

Permalink
add clang-cl for ninja #6052
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Jan 22, 2025
1 parent debf039 commit e2fb624
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions xmake/plugins/project/ninja/build_ninja.lua
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ function _add_rules_for_compiler_clang(ninjafile, sourcekind, program)
return _add_rules_for_compiler_gcc(ninjafile, sourcekind, program)
end

-- add rules for complier (clang-cl)
function _add_rules_for_compiler_clang_cl(ninjafile, sourcekind, program)
ninjafile:print("rule %s", sourcekind)
ninjafile:print(" command = %s -showIncludes -c $ARGS $in -Fo$out", program)
ninjafile:print(" deps = msvc")
ninjafile:print(" description = compiling.%s $in", config.mode())
ninjafile:print("")
end

-- add rules for complier (msvc/cl)
function _add_rules_for_compiler_msvc_cl(ninjafile, sourcekind, program)
ninjafile:print("rule %s", sourcekind)
Expand Down Expand Up @@ -203,16 +212,17 @@ function _add_rules_for_compiler(ninjafile)
end
local add_compiler_rules =
{
gcc = _add_rules_for_compiler_gcc,
gxx = _add_rules_for_compiler_gcc,
clang = _add_rules_for_compiler_clang,
clangxx = _add_rules_for_compiler_clang,
cl = _add_rules_for_compiler_msvc_cl,
ml = _add_rules_for_compiler_msvc_ml,
ml64 = _add_rules_for_compiler_msvc_ml,
rc = _add_rules_for_compiler_msvc_rc,
windres = _add_rules_for_compiler_windres,
nvcc = _add_rules_for_compiler_nvcc
gcc = _add_rules_for_compiler_gcc,
gxx = _add_rules_for_compiler_gcc,
clang = _add_rules_for_compiler_clang,
clangxx = _add_rules_for_compiler_clang,
cl = _add_rules_for_compiler_msvc_cl,
clang_cl = _add_rules_for_compiler_clang_cl,
ml = _add_rules_for_compiler_msvc_ml,
ml64 = _add_rules_for_compiler_msvc_ml,
rc = _add_rules_for_compiler_msvc_rc,
windres = _add_rules_for_compiler_windres,
nvcc = _add_rules_for_compiler_nvcc
}
for sourcekind, _ in pairs(language.sourcekinds()) do
local program, toolname = platform.tool(sourcekind)
Expand Down Expand Up @@ -468,3 +478,4 @@ function make(outputdir)
-- leave project directory
os.cd(oldir)
end

0 comments on commit e2fb624

Please sign in to comment.