2
votes

I have a Premake 5 project that builds a static library (primarily via the gmake2 or vs2017 actions). I'd like to create a build target for the release material itself: the library zipped up with some text and header files.

How do I do this with Premake? I tried something like:

project "thing_export"

    kind "Utility"

    os.mkdir "Release"
    -- etc

...but of course the os... functions are executed when Premake runs, they don't end up in the build files.

I also tried using custom build commands:

project "thing_export"

    kind "Utility"

    buildmessage "Creating release"
    buildcommands { "{copy} README.md '%{prj.location}'" }
    buildoutputs { "'%{prj.location}/README.md'" }

The makefile generated by the gmake or gmake2 actions is the same as for an empty project. No actions are generated for it.

How can I use Premake to create my releases?

1

1 Answers

0
votes

Depending on what you need to do, you might be able to make that approach work. What I usually do (and what Premake itself does) is write a Lua script to automate the release packaging, and use a custom Premake action to run it.

Have a look at Premake's package.lua script to see how it automates the packaging. And here is the custom action that calls package.lua:

newaction {
    trigger = "package",
    description = "Creates source and binary packages",
    execute = function ()
        include (path.join(corePath, "scripts/package.lua"))
    end
}