workspace "SakuraVNE"
    architecture "x64"
    startproject "SakuraVNE"

    configurations{
        "Debug",
        "Release"
    }

    outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"

    IncludeDir = {}
    IncludeDir["ImGui"] = "/libs/imgui"

    include "libs/imgui"

--engine project
project "SakuraVNE" --project under solution
    location "SakuraVNE"
    kind "ConsoleApp"
    language "C++"
    cppdialect "C++20"

    ignoredefaultlibraries { "MSVCRT" }

    targetdir ("bin/" .. outputdir .. "/%{prj.name}")
    objdir ("bin-int/" ..outputdir .. "/%{prj.name}")

    files{
        "%{prj.name}/src/**.h",
        "%{prj.name}/src/**.cpp"
    }

    includedirs{
        "%{prj.name}/src",
        "libs/spdlog/include",
        "libs/imgui",
        "libs/imgui/misc",
        "libs/imgui/backends"
    }

    libdirs{
        "libs/imgui/bin/" .. outputdir .. "/ImGui"
    }
    links{ --reference
        "ImGui"
    }

    links{
        "ImGui"
    }

    filter "system:windows"
        system "windows"
        cppdialect "C++20"
        staticruntime "off"
        runtime "Release"
        systemversion "latest"

        defines{
            "PLATFORM_WINDOWS"
        }

        includedirs{
            "libs/sdl/windows/include"
        }
        links {
            "SDL2",
            "SDL2main"
        }
        libdirs{
            "libs/sdl/windows/lib/x64/"       
        }

        postbuildcommands{
            ("{COPY} ../libs/sdl/windows/lib/x64/SDL2.dll ../bin/" .. outputdir .. "/SakuraVNE")
        }       

    filter "system:linux"
        system "linux"
        cppdialect "C++20"
        staticruntime "off"
        runtime "Release"
        systemversion "latest"

        defines{
            "PLATFORM_LINUX"
        }

	includedirs{
	    "/usr/include/SDL2"
	}
        
        -- TELL THE LINKER TO USE SYSTEM LIBS
        links {
            "SDL2",
            "GL",       -- OpenGL is usually required for ImGui/SDL apps
            "dl",       -- Dynamic linking loader (often needed)
            "pthread"   -- POSIX threads (often needed)
        }    

    filter "configurations:Debug"
        defines "DEBUG"
        symbols "On"

    filter "configurations:Release"
        defines "RELEASE"
        optimize "On"
        symbols "off"
