require "ecc/ecc"
require "ninja/ninja"
local ogg = require("vendor/ogg/build-ogg")
local sfml = require("vendor/sfml/build-sfml")
local flac = require("vendor/flac/build-flac")
local vorbis = require("vendor/vorbis/build-vorbis")
local freetype = require("vendor/freetype/build-freetype")
local imguisfml = require("vendor/imgui-sfml/build-imgui-sfml")

local snake = require("project")

workspace "snake"
	architecture "x64"
	startproject"snake"
	staticruntime"off"

	location "build"

    configurations{"Debug", "Release"}

	filter"system:linux"
		pic"On" -- fix warning when statically linking <relocation against ... in read-only section .text>
	filter""


	output_dir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
	intdir = "intermediate-files/"
	bindir = "bin/" .. output_dir
	liboutdir = "lib/" .. output_dir

	externalwarnings "Off"

	filter "configurations:debug"
		defines {"LOG_ENABLE", "GAME_DEBUG"}
		symbols "on"
		runtime "Debug"
		warnings "Extra"

	filter "configurations:release"
		defines {"GAME_RELEASE"}
		optimize "Speed"
		inlining "Auto"
		symbols "off"
		runtime "Release"
	filter""

	group"Dependencies"
		ogg.generateproject(liboutdir, intdir)
		sfml.generateproject(liboutdir, intdir)
		flac.generateproject(liboutdir, intdir)
		vorbis.generateproject(liboutdir, intdir)
		freetype.generateproject(liboutdir, intdir)
		imguisfml.generateproject(liboutdir, intdir)
	group""

	snake.generateproject(bindir, intdir)
