add_rules("mode.debug", "mode.release")

add_requires("gperf")
add_packages("gperf")

add_requires("libdom")
add_packages("libdom")

target("svgtiny")
    set_kind("$(kind)")
    add_files("src/*.c")
    add_includedirs("include")
    add_headerfiles("include/(*.h)")

    if is_plat("windows") and is_kind("shared") then
        add_rules("utils.symbols.export_all")
    end

    before_build(function (target)
        local gperf
        if is_subhost("windows") then
            gperf = path.join(target:pkg("gperf"):installdir(), "bin/gperf.exe")
        else
            gperf = "gperf"
        end
        os.vrunv(gperf, {"src/colors.gperf", "--output-file=src/autogenerated_colors.c"})
    end)
