Source

winsock-sniffer / premake4.lua

Full commit
function copy(src, dst)
  local action = "\"" ..  path.join(os.getcwd(), "copy-data.py")  .. "\""
  src = "\"" .. src .. "\""
  dst = "\"" .. dst .. "\""
  cwd = "\"" .. os.getcwd() .. "\""
  postbuildcommands { action .. " " .. cwd .. " " .. src .. " " .. dst }
end

function resource(proj, src, dst)
  copy(src, path.join("build", dst))
  if proj == nil then
    copy(src, path.join("bin", dst))
  else
    copy(src, path.join(path.join("bin", proj), dst))
  end
end

newaction {
  trigger = 'clean',
  description = 'Cleans up the project.',
  shortname = "clean",
  
  execute = function()
    os.rmdir("bin")
    os.rmdir("build")
  end
}

solution "dll-injection"
    configurations { "debug", "release" }
    platforms { "x32", "x64" }

    location "build"
    targetdir "bin"
    
    includedirs { "inc" }
    
    configuration { "debug" }
      defines { "DEBUG" }
      flags { "Symbols", "FatalWarnings", "NoRTTI", "StaticRuntime" }

    configuration { "release" }
      defines { "NDEBUG" }
      flags { "Optimize", "FatalWarnings", "NoRTTI", "StaticRuntime" }
        
    configuration { "windows" }
      includedirs { "inc/win32" }
      defines { "WIN32", "_WIN32" }
      defines { "_CRT_SECURE_NO_WARNINGS", "_CRT_NONSTDC_NO_DEPRECATE" }
    
    project "winsock-sniffer"
      kind "ConsoleApp"
      language "C++"
      
      files { "src/winsock-sniffer/**.cpp",
              "src/winsock-sniffer/**.hpp" }
    
    project "winsock-sniffer-dll"
      kind "SharedLib"
      language "C++"
      includedirs { "src" }
      
      files { "src/winsock-sniffer-dll/**.cpp",
              "src/winsock-sniffer-dll/**.hpp",
              "src/winsock-sniffer-dll/**.def" }
      
      links "mhook"
      links "ws2_32"
    
    project "disasm"
      kind "StaticLib"
      language "C"
      includedirs { "src" }
        
      files { "src/disasm/**.c",
              "src/disasm/**.h" }
    
    project "mhook"
      kind "StaticLib"
      language "C++"
      includedirs { "src" }      
      
      links { "disasm" }
      
      files { "src/mhook/**.cpp",
              "src/mhook/**.hpp" }