local m = {}

local rootdir = path.join(path.getabsolute(path.getdirectory(_SCRIPT)), "../")
local sfml = require("build-sfml")

function m.generateproject(liboutdir, intdir)
    project"imgui-sfml"
        cppdialect"c++17"
        kind"staticLib"
        targetdir (liboutdir)
        objdir(intdir)
        warnings"Off"

        defines{"IMGUI_USER_CONFIG=\"imconfig-SFML.h\"", "SFML_STATIC"}

        files
        {
            path.join(rootdir, "imgui-sfml/imgui-SFML.cpp"),
        }
        
        includedirs
        {
            path.join(rootdir, "imgui-sfml"),
            path.join(rootdir, "imgui"),
            path.join(rootdir, "SFML/include"),
        }
        
        links {"sfml"}
end

function m.config() -- use this in build imgui instead of link() to avoid circular dependency

    defines { "IMGUI_USER_CONFIG=\"imconfig-SFML.h\"" }

    includedirs { path.join(rootdir, "imgui-sfml"), path.join(rootdir, "SFML/include") }
end

function m.link()
    links {"imgui-sfml"}
    m.config()
end

return m