#  Copyright (C) GridGain Systems. All Rights Reserved.
#  _________        _____ __________________        _____
#  __  ____/___________(_)______  /__  ____/______ ____(_)_______
#  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
#  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
#  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/

set(TARGET ${PROJECT_NAME}-extension)

set(SOURCES
    catalog/extension_catalog.cpp
    catalog/snapshot.cpp
    cursor.cpp
    detail/cursor_impl.cpp
    extension_client.cpp
    extension_index.cpp
    extension_indexes.cpp
    extension_table.cpp
    extension_tables.cpp
)

set(PUBLIC_HEADERS)

set(PRIVATE_HEADERS
    catalog/catalog_schema.h
    cursor.h
    detail/batch_collector.h
    detail/col_list.h
    detail/cursor_impl.h
    catalog/extension_catalog.h
    catalog/catalog_index.h
    catalog/catalog_table.h
    catalog/snapshot.h
    detail/index_parse.h
    detail/schema_parse.h
    detail/snapshot_data.h
    extension_client.h
    extension_index.h
    extension_indexes.h
    extension_table.h
    extension_tables.h
    key_value_view.h
    record_view.h
)

ignite_check_headers(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${PUBLIC_HEADERS} PRIVATE ${PRIVATE_HEADERS})

ignite_collect_public_headers(extension PUBLIC_HEADERS)

add_library(${TARGET} STATIC ${SOURCES})

target_link_libraries(${TARGET} PUBLIC
    gridgain::client-static
    gridgain-protocol
)

target_include_directories(${TARGET} INTERFACE
    $<BUILD_INTERFACE:${IGNITE_CMAKE_TOP_DIR}>
    $<INSTALL_INTERFACE:${IGNITE_INCLUDEDIR}>
)

ignite_install_headers(FILES ${PUBLIC_HEADERS} DESTINATION ${IGNITE_INCLUDEDIR}/extension COMPONENT client)
