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

workspace "ray-casting-demos"
	architecture "x64"
	
	configurations
	{
		"debug",
		"release"
	}

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_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"

project "Game"
	language "C++"
	cppdialect "C++17"
	systemversion "latest"
	targetname "Game"

	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 on windows--
  filter {"not action:vs*", "system:windows"}
    targetdir (bindir)
    objdir (intdir)
    includedirs 
    {
			"src",
      include_dir, 
			sfmldir .. "/include", 
      imguidir 
    }

		libdirs {sfmldir .."/lib"}

	filter{"system:windows"}
	  defines "SFML_STATIC"
		defines "PLATFORM_WINDOWS"
		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",
			"openal32",
			"flac",
			"vorbisfile",
			"vorbis",
			"ogg",
			"sfml-system-s",
			"winmm"
		}

	filter {"system:linux"}
		targetdir (bindir)
		objdir (intdir)
		defines "PLATFORM_LINUX"
		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"
		kind "ConsoleApp"

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