

package.path = package.path .. ";../third-party/premake-scripts/?.lua"

require "ecc/ecc"
require "ninja/ninja"

local ogg = require("build-ogg")
local sfml = require("build-sfml")
local flac = require("build-flac")
local imgui = require("build-imgui")
local vorbis = require("build-vorbis")
local freetype = require("build-freetype")
local imguisfml = require("build-imgui-sfml")

local snake = require("project")

local rootdir = "../"

workspace "snake"
	architecture "x64"
	startproject"snake"
	configurations{"Debug", "Release"}
	location (rootdir .. "build")

	filter"system:linux"
		staticruntime"Off"

	filter"system:windows"
		staticruntime"On"
	filter""

	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 = rootdir .. "intermediate-files/"
	bindir = rootdir .. "bin/" .. output_dir
	liboutdir = rootdir.. "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)
		imgui.generateproject(liboutdir, intdir)
		vorbis.generateproject(liboutdir, intdir)
		freetype.generateproject(liboutdir, intdir)
		imguisfml.generateproject(liboutdir, intdir)
	group""

	snake.generateproject(bindir, intdir)
