local m = {}

local scriptdir = path.getabsolute(path.getdirectory(_SCRIPT))
local ogg = require("vendor/ogg/build-ogg")
function m.generateproject(liboutdir, intdir)
	project"vorbis"
	language"C" -- c++ will mangle names and sfml wont build
	kind"staticLib"
	targetdir (liboutdir)
	objdir(intdir)
	warnings"Off"

	ogg.link()

	includedirs
	{
		path.join(scriptdir, "include"),
		path.join(scriptdir, "lib"),
	}

	files
	{
		path.join(scriptdir, "lib/envelope.h"),
		path.join(scriptdir, "lib/lpc.h"),
		path.join(scriptdir, "lib/lsp.h"),
		path.join(scriptdir, "lib/codebook.h"),
		path.join(scriptdir, "lib/misc.h"),
		path.join(scriptdir, "lib/psy.h"),
		path.join(scriptdir, "lib/masking.h"),
		path.join(scriptdir, "lib/os.h"),
		path.join(scriptdir, "lib/mdct.h"),
		path.join(scriptdir, "lib/smallft.h"),
		path.join(scriptdir, "lib/highlevel.h"),
		path.join(scriptdir, "lib/registry.h"),
		path.join(scriptdir, "lib/scales.h"),
		path.join(scriptdir, "lib/window.h"),
		path.join(scriptdir, "lib/lookup.h"),
		path.join(scriptdir, "lib/lookup_data.h"),
		path.join(scriptdir, "lib/codec_internal.h"),
		path.join(scriptdir, "lib/backends.h"),
		path.join(scriptdir, "lib/bitrate.h"),
		path.join(scriptdir, "lib/mdct.c"),
		path.join(scriptdir, "lib/smallft.c"),
		path.join(scriptdir, "lib/block.c"),
		path.join(scriptdir, "lib/envelope.c"),
		path.join(scriptdir, "lib/window.c"),
		path.join(scriptdir, "lib/lsp.c"),
		path.join(scriptdir, "lib/lpc.c"),
		path.join(scriptdir, "lib/analysis.c"),
		path.join(scriptdir, "lib/synthesis.c"),
		path.join(scriptdir, "lib/psy.c"),
		path.join(scriptdir, "lib/info.c"),
		path.join(scriptdir, "lib/floor1.c"),
		path.join(scriptdir, "lib/floor0.c"),
		path.join(scriptdir, "lib/res0.c"),
		path.join(scriptdir, "lib/mapping0.c"),
		path.join(scriptdir, "lib/registry.c"),
		path.join(scriptdir, "lib/codebook.c"),
		path.join(scriptdir, "lib/sharedbook.c"),
		path.join(scriptdir, "lib/lookup.c"),
		path.join(scriptdir, "lib/bitrate.c"),
		path.join(scriptdir, "lib/vorbisfile.c"),
		path.join(scriptdir, "lib/vorbisenc.c"),
	}


	filter""
end

function m.link()
	links {"vorbis", "ogg"}
	externalincludedirs
	{
		path.join(scriptdir, "include"),
		path.join(scriptdir, "lib"),
		path.join(scriptdir, "../ogg/include")
	}
end

return m