Search code examples
luapost-build-eventpremake

In a premake script, how do you get the "kind" of a project?


I am trying to add a post-build step which runs an executable on the project after it compiles. To do this, the compiler needs to know if it an .exe or a .dll before hand. How can I find the extension of a project (or premake 'kind') during the premake step? I am using premake 4.3 and visual studio 2010. Thanks!


Solution

  • In Premake4 there is no great way to do that. Your best bet will probably be duplicating the commands with configuration filters.

    configuration { "ConsoleApp or WindowedApp" }
       postbuildcommands { "thecmd --kind=exe" }
    configuration { "StaticLib or SharedLib" }
       postbuildcommands { "thecmd --kind=lib" }
    

    In Premake5 you could use tokens.

    postbuildcommands { 
       "thecmd --kind=%{iif(cfg.kind:endswith("App"), "exe", "lib")}" 
    }