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

workspace "breakout"
	architecture "x64"

	output_dir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
	vs_intdir = "!$(SolutionDir)intermediate-files/" .. output_dir
	intdir = "%{wks.location}/intermediate-files/" .. output_dir
	vs_bindir = "$(SolutionDir)bin/" .. output_dir 
	bindir = "%{wks.location}/bin/" .. output_dir
	vs_coreinclude_dir = "$(SolutionDir)include"
	vs_sfmldir = "$(SolutionDir)vendor/SFML"
	sfmldir = "%{wks.location}/vendor/SFML"
	vs_imguidir = "$(SolutionDir)vendor/imgui"
	imguidir = "%{wks.location}/vendor/imgui"
	vs_include_dir = "$(SolutionDir)include"
	include_dir = "%{wks.location}/include"

	configurations
	{
		"Debug",
		"Release"
	}

	project "breakout"
		language "C++"
		cppdialect "C++17"
		cdialect "C17"
		systemversion "latest"
		kind "WindowedApp"
		targetname "breakout"

		files 
		{
			"src/**.cpp",
			"include/**.h",
			"include/**.hpp",
			"vendor/imgui/imgui.cpp",
			"vendor/imgui/imgui_draw.cpp",
			"vendor/imgui/imgui_tables.cpp",
			"vendor/imgui/imgui_widgets.cpp",
			"vendor/imgui/imgui-SFML.cpp"
		}
		
	--visual studio--
		filter {"action:vs*", "system:windows"}
			targetdir (vs_bindir)
			objdir (vs_intdir)
			includedirs 
			{
				"src",
				vs_include_dir, 
				vs_sfmldir .. "/include", 
				vs_imguidir
			}

			libdirs {vs_sfmldir .."/lib"}

		--not visual studio --
		filter {"not action:vs*", "system:windows"}
			targetdir (bindir)
			objdir (intdir)
			includedirs 
			{
				"src",
				include_dir, 
				sfmldir .. "/include", 
				imguidir 
			}

			libdirs {sfmldir .."/lib"}

		--windows specific settings--
		filter{"system:windows"}
			defines {"PLATFORM_WINDOWS", "SFML_STATIC"}
			staticruntime "on"

		filter {"system:windows", "configurations:debug"}
			defines{"_DEBUG", "_CONSOLE"}
			links 
			{
				"sfml-main-d",
				"sfml-graphics-s-d",
				"sfml-window-s-d",
				"opengl32",
				"gdi32",
				"freetype",
				"sfml-audio-s-d",
				"flac",
				"vorbisfile",
				"vorbis",
				"ogg",
				"sfml-system-s-d",
				"winmm"
			}
			
		filter {"system:windows", "configurations:release"}
			defines{"NDEBUG"}
			links 
			{
				"sfml-main",
				"sfml-graphics-s",
				"sfml-window-s",
				"opengl32",
				"gdi32",
				"freetype",
				"sfml-audio-s",
				"flac",
				"vorbisfile",
				"vorbis",
				"ogg",
				"sfml-system-s",
				"winmm"
			}


		--linux specific settings--
		filter {"system:linux"}
			defines {"PLATFORM_LINUX"}
			targetdir (bindir)
			objdir (intdir)
			includedirs 
			{
				"src",
				include_dir, 
				imguidir 
			}
			
			links 
			{
				"sfml-graphics",
				"sfml-window",
				"sfml-audio",
				"sfml-system",
				"OpenGL",
			}

			
		--config settings--
		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"