project(GryphnLoader)

# 1. Collect sources
file(GLOB_RECURSE LOADER_SOURCES CONFIGURE_DEPENDS "src/*.c")

# 2. Build the library
add_library(GryphnLoader STATIC ${LOADER_SOURCES})

# 3. FIX: Add BOTH the include folder (for the API) and src (for internal headers)
# We use CMAKE_SOURCE_DIR to get back to the root 'include' folder
target_include_directories(GryphnLoader PUBLIC
    "${CMAKE_CURRENT_SOURCE_DIR}/src"
    "${CMAKE_CURRENT_SOURCE_DIR}/src/instance"
)

if(APPLE)
    target_compile_definitions(GryphnLoader PUBLIC GN_PLATFORM_MACOS)
endif()
if (UNIX AND NOT APPLE)
    target_compile_definitions(GryphnLoader PUBLIC GN_PLATFORM_LINUX)
endif()

# 4. Links
if(UNIX AND NOT APPLE)
    target_link_libraries(GryphnLoader PRIVATE dl)
endif()
