Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set vs_toolset for msbuild #5398

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tools.cmake 里已经走 CMAKE_GENERATOR_TOOLSET 配置过了,这里再传,会冲突么?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不会冲突,命令行的优先级更高

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的

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
Loading