

package.path = package.path .. ";../vendor/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 vorbis = require("build-vorbis")
local freetype = require("build-freetype")

local pong = require("project")

local rootdir = "../"

workspace "pong"
	architecture "x64"
	startproject"pong"
	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)
		vorbis.generateproject(liboutdir, intdir)
		freetype.generateproject(liboutdir, intdir)
	group""

	pong.generateproject(bindir, intdir)
