cmake_minimum_required(VERSION 3.31)
project(BLPExtractor C)

# --- StormLib Config ---
set(STORMLIB_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/external/StormLib/src")
set(STORMLIB_LIB_DIR "${CMAKE_SOURCE_DIR}/external/lib")

# --- GLFW Config ---
set(GLFW_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/include")
set(GLFW_LIB_DIR "${CMAKE_SOURCE_DIR}/external/glfw/")

# --- GLAD Config ---
set(GLAD_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/include")

add_executable(BLPExtractor
        src/main.c
        src/logger/log.c
        src/util.c
        src/util.h
        src/wmo/wmo_structs.h
        src/wmo/wmo.c
        src/wmo/wmo.h
        src/mpq/mpq.c
        src/mpq/mpq.h
        src/renderer/mesh.c
        src/renderer/mesh.h
        src/glad.c
        src/logger/gl_log.c
        src/logger/gl_log.h
        src/renderer/shader.c
        src/renderer/shader.h
        src/renderer/matrix.c
        src/renderer/matrix.h
        src/renderer/vector.c
        src/renderer/vector.h
        src/renderer/texture.c
        src/renderer/texture.h
        src/renderer/render_types.h
)

# static C runtime /MTd (debug mode StormLibDUS.lib)
if(MSVC)
    target_compile_options(BLPExtractor PRIVATE
            $<$<CONFIG:Debug>:/MTd>)
endif()

set(CMAKE_CXX_STANDARD 11)

target_include_directories(BLPExtractor PRIVATE
        "${STORMLIB_INCLUDE_DIR}"
        "${GLFW_INCLUDE_DIR}"
        "${GLAD_INCLUDE_DIR}"
)

target_link_directories(BLPExtractor PRIVATE
        "${STORMLIB_LIB_DIR}"
        "${GLFW_LIB_DIR}")

target_link_libraries(BLPExtractor PRIVATE
        StormLibDAS
        glfw3
        opengl32
)
