1

我现在使用premake 5工作了几天。我目前正在尝试将我们的 VS2015 解决方案(主要是 C++ 本机和 CLI 项目)移植到 premake 5 解决方案。到目前为止我没有任何问题,但现在我无法为我们将程序集本地化到的所有语言构建资源库。例如,如果我们有fres(法语和西班牙语),我们应该有这样的程序集拆分:

  • foo.dll(默认,英语),
  • 其他语言的卫星foo.resources.dll(当然在不同的文件夹中)。

但我无法(阅读:我不知道如何)正确编写 lua 脚本。

有人知道如何使用 premake5 生成本地化(AKA 卫星)程序集吗?

谢谢你的帮助!


编辑 1

我将此添加到我的 lua 脚本中:

files({"/**.resx"})

它将文件添加到.resx文件中,.vcxproj而不是像这样包含:

<EmbeddedResource Include="bar.resx"/>

它们是这样包含的:

<None Include="bar.resx"/>

这是怎么回事?


编辑 2

然后我补充说:

filter "files:**.resx"
    buildaction "Embed"

但它保持不变。我在 premake 5 doc中找到了buildaction仅在 C# 中受支持(我的代码在 C++/CLI 中)。如果这是真的(似乎是),有没有办法更深入地使用我的脚本将 XML 条目直接添加到.vcxproj?

4

1 回答 1

1

嗯……经过多次尝试,我找到了一种方法。我刚刚为EmbeddedResource添加了一个新的(文件)类别,如下所示:

premake.vstudio.vc2010.categories.EmbeddedResource = {
    name = "EmbeddedResource",
    extensions = {".resx"},
    priority = 50, -- arbitrary number, I saw priorities are 0, 1, 2...

    emitFiles = function(prj, group)
        premake.vstudio.vc2010.emitFiles(
            prj,
            group,
            "EmbeddedResource",
            {premake.vstudio.vc2010.generatedFile}    -- cannot explain this...
       )
    end,

    emitFilter = function(prj, group)
        premake.vstudio.vc2010.filterGroup(prj, group, "EmbeddedResource")
    end
}

希望它可以帮助...

于 2018-01-11T15:31:31.980 回答