Skip to content

Commit

Permalink
Merge pull request #5398 from ChrisCatCP/msbuild
Browse files Browse the repository at this point in the history
set vs_toolset for msbuild
  • Loading branch information
waruqi authored Jul 26, 2024
2 parents a19560c + b9b4d6c commit db6f72c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions xmake/modules/package/tools/msbuild.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@

-- imports
import("core.base.option")
import("core.project.config")
import("core.project.project")
import("core.tool.toolchain")
import("lib.detect.find_tool")
import("private.utils.upgrade_vsproj")
import("private.utils.toolchain", {alias = "toolchain_utils"})

-- get the number of parallel jobs
function _get_parallel_njobs(opt)
Expand Down Expand Up @@ -65,6 +67,12 @@ function _get_configs(package, configs, opt)
if not configs_str:find("p:Platform=", 1, true) then
table.insert(configs, "-p:Platform=" .. _get_vsarch(package))
end
if not configs_str:find("p:PlatformToolset=", 1, true) then
local vs_toolset = toolchain_utils.get_vs_toolset_ver(_get_msvc(package):config("vs_toolset") or config.get("vs_toolset"))
if vs_toolset then
table.insert(configs, "/p:PlatformToolset=" .. vs_toolset)
end
end
if project.policy("package.msbuild.multi_tool_task") or package:policy("package.msbuild.multi_tool_task") then
table.insert(configs, "/p:UseMultiToolTask=true")
table.insert(configs, "/p:EnforceProcessCountAcrossBuilds=true")
Expand Down

0 comments on commit db6f72c

Please sign in to comment.