dom_beau
dom_beau

Reputation: 2507

Using premake with multi localizations

I work with premake 5 for few days now. I'm currently trying to port our VS2015 solution (mainly C++ native and CLI projects) to a premake 5 solution. I had no problem so far but now I'm not able to build resource libraries for all languages we localize our assemblies to. For example, if we have fr and es (for French and Spanich), we should have an assembly split like this:

But I'm not able (read: I don't know how) to write the lua script correctly.

Does someone know how to generate localized (AKA satellite) assemblies with premake5?

Thanks for your help!


EDIT 1

I added this to my lua script:

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

It added the .resx files to the .vcxproj file but rather than being included like this:

<EmbeddedResource Include="bar.resx"/>

they are included like this:

<None Include="bar.resx"/>

What's going on?


EDIT 2

I then added:

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

But it remains the same. I found in premake 5 doc that buildaction was only supported in C# (my code is in C++/CLI). If this is true (it seems to be) is there a way to go deeper with my script to add, say, XML entries directly to the .vcxproj?

Upvotes: 1

Views: 222

Answers (1)

dom_beau
dom_beau

Reputation: 2507

Well... after a lot of tries, I found a way. I just added a new (file) category for EmbeddedResource like this:

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
}

Hope it can help...

Upvotes: 1

Related Questions