set(PROJECT_NAME Hazel)
project(${PROJECT_NAME})


add_subdirectory(vendor/spdlog)
add_subdirectory(vendor/GLAD)
add_subdirectory(vendor/glm)
add_subdirectory(vendor/yaml-cpp)
add_subdirectory(vendor/shaderc)
add_subdirectory(vendor/SPIRV-Cross)
add_subdirectory(vendor/box2d)

file(GLOB_RECURSE SOURCES "src/**.cpp")

# stb_image
set(STB_INCLUDE_DIR vendor/stb)
include_directories(${SRB_INCLUDE_DIR}/include)
#file(GLOB_RECURSE STB ${STB_INCLUDE_DIR}/include/*)

# entt
set(ENTT_INCLUDE_DIR vendor/entt)
include_directories(${ENTT_INCLUDE_DIR}/include)
#file(GLOB_RECURSE ENTT ${ENTT_INCLUDE_DIR}/include/*)

# imgui
set(IMGUI_INCLUDE_DIR vendor/imgui)
include_directories(${IMGUI_INCLUDE_DIR} ${IMGUI_INCLUDE_DIR}/backends)
file(GLOB IMGUI ${IMGUI_INCLUDE_DIR}/*.cpp
                ${IMGUI_INCLUDE_DIR}/backends/imgui_impl_opengl3.cpp
                ${IMGUI_INCLUDE_DIR}/backends/imgui_impl_sdl3.cpp)

# ImGuizmo
set(IMGUIZMO_INCLUDE_DIR vendor/ImGuizmo)
include_directories(${IMGUIZMO_INCLUDE_DIR})
file(GLOB IMGUIZMO ${IMGUIZMO_INCLUDE_DIR}/*.cpp)


# set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries" FORCE)
add_subdirectory(vendor/SDL)
#set(SDL3_SHARED ON CACHE BOOL "Build SDL as shared library" FORCE)

add_library(${PROJECT_NAME} STATIC
        ${SOURCES}
        ${IMGUI}
        ${IMGUIZMO}
)

target_include_directories(${PROJECT_NAME}
        PUBLIC
        ${CMAKE_CURRENT_SOURCE_DIR}/src  # 暴露头文件给其他项目
	    ${STB_INCLUDE_DIR}
        ${IMGUI_INCLUDE_DIR}
        ${ENTT_INCLUDE_DIR}
        ${IMGUIZMO_INCLUDE_DIR}
)


target_link_libraries(${PROJECT_NAME} PUBLIC
        spdlog::spdlog
        SDL3::SDL3
        glad
        opengl32
        glm::glm
        yaml-cpp::yaml-cpp
        shaderc
        spirv-cross-cpp
        spirv-cross-core
        box2d
)
# target_compile_definitions(${PROJECT_NAME} PRIVATE HZ_BUILD_DLL IMGUI_API=__declspec\(dllexport\) STB_IMAGE_IMPLEMENTATION)# 编译DLL时定义
target_compile_definitions(${PROJECT_NAME} PRIVATE STB_IMAGE_IMPLEMENTATION)

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
    target_compile_definitions(${PROJECT_NAME} PUBLIC HZ_PROFILE)# 编译DLL时定义
endif ()

if(WIN32)
    target_compile_definitions(${PROJECT_NAME} PUBLIC HZ_PLATFORM_WINDOWS)# 编译DLL时定义
    set(CMAKE_SHARED_LIBRARY_PREFIX "")
endif ()


