cmake_minimum_required(VERSION 4.1)
project(b_engine VERSION 0.0.2 LANGUAGES CXX C)

set(CMAKE_CXX_STANDARD 20)

set (GLAD_SOURCE_DIR _ThirdParty/glad/src)
set (GLAD_INCLUDE_DIR _ThirdParty/glad/include)
include_directories(${GLAD_INCLUDE_DIR})

set (GLFW_BUILD_EXAMPLES OFF)
set (GLFW_BUILD_TESTS OFF)
set (GLFW_BUILD_DOCS OFF)
add_subdirectory(_ThirdParty/glfw)

add_subdirectory(_ThirdParty/spdlog)

set (ASSIMP_INSTALL OFF)
add_subdirectory(_ThirdParty/assimp)

add_subdirectory(_ThirdParty/glm)

add_subdirectory(_ThirdParty/entt)

add_executable(${PROJECT_NAME}
        src/main.cpp
        ${GLAD_SOURCE_DIR}/gl.c
        src/Mesh.cpp
        src/Mesh.h
        src/Model.h
        src/Material.h
        src/ModelManager.cpp
        src/ModelManager.h
        src/ShaderProgram.cpp
        src/ShaderProgram.h
        src/Texture.h
        src/TextureManager.cpp
        src/TextureManager.h
        src/ShaderManager.cpp
        src/ShaderManager.h
        src/FreeCamera.cpp
        src/FreeCamera.h
        src/InputManager.cpp
        src/InputManager.h
        src/Components.h
        src/Scene.cpp
        src/Scene.h)

add_custom_target(copy_resources
        COMMAND ${CMAKE_COMMAND} -E copy_directory
        "${CMAKE_CURRENT_SOURCE_DIR}/resources"
        "${CMAKE_CURRENT_BINARY_DIR}/resources"
        COMMENT "Copying resources..."
)

target_link_libraries(${PROJECT_NAME} glfw spdlog assimp glm EnTT)
target_include_directories(${PROJECT_NAME} PRIVATE ${ASSIMP_INCLUDE_INSTALL_DIR})
