cmake_minimum_required(VERSION 3.1)
project(ImGui)
include(ExternalProject)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

find_package(SDL2 REQUIRED)
set(SDL2_INCDIR ${SDL2_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIR} ${SDL2_TTF_INCLUDE_DIR} ${SDL2_MIXER_INCLUDE_DIR})

add_library(ImGui STATIC)
target_include_directories(ImGui PUBLIC ${SDL2_INCDIR})
target_include_directories(ImGui PUBLIC external/imgui)
target_include_directories(ImGui PUBLIC external/imgui/backends)

file(GLOB ImG_SOURCES external/imgui/*.cpp external/imgui/backends/imgui_impl_sdl.cpp)
file(GLOB ImG_HEADERS external/imgui/*.h external/imgui/backends/imgui_impl_sdl.h)

target_sources(ImGui PRIVATE ${ImG_SOURCES} ${ImG_HEADERS})


add_library(ImGuiSDL STATIC)
message("SDL Dir: ${SDL2_INCDIR}")
target_include_directories(ImGuiSDL PUBLIC ${SDL2_INCDIR})
target_include_directories(ImGuiSDL PUBLIC external/imgui_sdl)
target_include_directories(ImGuiSDL PUBLIC external/imgui)

set(ImGSDL_SOURCES external/imgui_sdl/imgui_sdl.cpp)
file(GLOB ImGSLD_HEADERS external/imgui_sdl/*.h)

target_sources(ImGuiSDL PRIVATE ${ImGSDL_SOURCES} ${ImGSDL_HEADERS})
