我想在我的项目配置中添加两个条件属性,以定位非默认的vcpkg三元组:https://github.com/microsoft/vcpkg/blob/master/docs/users/integration.md#with-msbuild
我的项目文件是由premake生成的。我该怎么办?
答案 0 :(得分:1)
您可以尝试从Visual Studio生成器中覆盖全局功能,诸如此类...未经测试...
local vs2010 = premake.vstudio.vs2010
function vcPkgOverride(prj)
-- go trough the configs and platforms and figure out which conditions to put
for _, cfg in pairs(prj.cfgs) do
local condition = vs2010.condition(cfg)
if cfg.platform == "Win32" then
vs2010.vc2010.element("VcpkgTriplet ", condition, "x86-windows-static")
else if cfg.platform == "x64" then
vs2010.vc2010.element("VcpkgTriplet ", condition, "x64-windows-static")
end
end
end
premake.override(vc2010.elements, "globals", function (oldfn, prj)
local elements = oldfn(prj)
elements = table.join(elements, {
vcPkgOverride
})
end
return elements
end)
答案 1 :(得分:0)
您是否尝试过使用CMake?这是一个复杂得多的构建系统,应该可以轻松地进行处理。