cmake_minimum_required(VERSION 3.22)
project(kariokaEngine LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_mixer REQUIRED)

# Python
set(PYBIND11_FINDPYTHON ON)
add_subdirectory(third_party/pybind11)

# EnTT
include_directories(third_party/entt/single_include)

# ImGui
add_library(imgui STATIC
	third_party/imgui/imgui.cpp
	third_party/imgui/imgui_draw.cpp
	third_party/imgui/imgui_tables.cpp
	third_party/imgui/imgui_widgets.cpp
	third_party/imgui/backends/imgui_impl_sdl2.cpp
	third_party/imgui/backends/imgui_impl_sdlrenderer2.cpp
)
target_include_directories(imgui PUBLIC
	third_party/imgui
	third_party/imgui/backends
)

target_link_libraries(imgui SDL2::SDL2)

add_executable(kariokaEngine
	# Core
	src/main.cpp
	src/Engine.cpp

	# States
	src/states/StateManager.cpp
	src/states/MainMenuState.cpp

	# Systems

	# Components

	# etc
)

target_link_libraries(kariokaEngine PRIVATE
    pybind11::embed
	SDL2::SDL2
	SDL2_image::SDL2_image
	SDL2_mixer::SDL2_mixer
	imgui
)

target_compile_definitions(kariokaEngine PRIVATE SDL_MAIN_HANDLED)

if(MINGW)
	target_link_libraries(kariokaEngine PRIVATE mingw32)
endif()

add_custom_command(TARGET kariokaEngine POST_BUILD COMMAND
	${CMAKE_COMMAND} -E copy_directory
	${CMAKE_SOURCE_DIR}/assets
	$<TARGET_FILE_DIR:kariokaEngine>/assets
)