diff --git a/premake5.lua b/premake5.lua index 6a6b7642..dc44a15a 100644 --- a/premake5.lua +++ b/premake5.lua @@ -1,3 +1,9 @@ +-- Option to allow copying the DLL file to a custom folder after build +newoption { + trigger = "copy-to", + description = "Optionally copy the DLL to a custom folder after build, define the path here if wanted." +} + solution "iw4x" location ("./build") configurations { "Normal" } @@ -11,3 +17,10 @@ solution "iw4x" configuration "Normal" defines { "NDEBUG" } flags { "Optimize", "MultiProcessorCompile", "Symbols" } + + if _OPTIONS["copy-to"] then + saneCopyToPath = string.gsub(_OPTIONS["copy-to"] .. "\\", "\\\\", "\\") + postbuildcommands { + "copy /y \"$(TargetPath)\" \"" .. saneCopyToPath .. "\"" + } + end