<commit_before>include_directories("${PROJECT_SOURCE_DIR}/inc" "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/common")


#compile protobuf-c
set(PROTO_NAME sysrepo)
set(PROTO_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${PROTO_NAME}.proto")
set(GENERATED_PROTO  "${PROTO_NAME}.pb-c.c")

get_filename_component(ABS_PATH ${PROTO_FILE} PATH)
add_custom_command(
    OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${PROTO_NAME}.pb-c.c"
    "${CMAKE_CURRENT_SOURCE_DIR}/${PROTO_NAME}.pb-c.h"
   COMMAND  ${PROTOBUFC_PROTOC_EXECUTABLE}
   ARGS --c_out  ${CMAKE_CURRENT_SOURCE_DIR} -I ${ABS_PATH} ${PROTO_FILE}
   DEPENDS ${PROTO_FILE}
   COMMENT "Running C protocol buffer compiler on ${PROTO_FILE}"
   VERBATIM )

add_custom_target(proto DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PROTO_NAME}.pb-c.c)

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/common/sr_constants.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/common/sr_constants.h" ESCAPE_QUOTES @ONLY)

#setup library sources
set(SYSREPO-SOURCES
    ${GENERATED_PROTO}
    client_library.c
    common/sr_common.c
    common/sr_btree.c
    common/sr_logger.c
)

set(SYSREPO-ENGINE-SOURCES
    ${GENERATED_PROTO}
    connection_manager.c
    session_manager.c
    request_processor.c
    rp_dt_xpath.c
    rp_dt_lookup.c
    rp_dt_get.c
    rp_dt_edit.c
    rp_node_stack.c
    data_manager.c
    xpath_processor.c
    common/sr_common.c
    common/sr_btree.c
    common/sr_logger.c
)

set(HEADERS "${PROJECT_SOURCE_DIR}/inc/sysrepo.h")

# shared and static library<commit_msg>Moved generated proto files to common<commit_after>set(COMMON_DIR "${CMAKE_CURRENT_SOURCE_DIR}/common")

include_directories("${PROJECT_SOURCE_DIR}/inc" "${CMAKE_CURRENT_SOURCE_DIR}" "${COMMON_DIR}")

#compile protobuf-c
set(PROTO_NAME sysrepo)
set(PROTO_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${PROTO_NAME}.proto")
set(GENERATED_PROTO "${COMMON_DIR}/${PROTO_NAME}.pb-c.c")

get_filename_component(ABS_PATH ${PROTO_FILE} PATH)
add_custom_command(
    OUTPUT "${COMMON_DIR}/${PROTO_NAME}.pb-c.c"
    "${COMMON_DIR}/${PROTO_NAME}.pb-c.h"
   COMMAND  ${PROTOBUFC_PROTOC_EXECUTABLE}
   ARGS --c_out ${COMMON_DIR} -I ${ABS_PATH} ${PROTO_FILE}
   DEPENDS ${PROTO_FILE}
   COMMENT "Running C protocol buffer compiler on ${PROTO_FILE}"
   VERBATIM )

add_custom_target(proto DEPENDS ${COMMON_DIR}/${PROTO_NAME}.pb-c.c)

configure_file("${COMMON_DIR}/sr_constants.h.in" "${COMMON_DIR}/sr_constants.h" ESCAPE_QUOTES @ONLY)

#setup library sources
set(SYSREPO-SOURCES
    ${GENERATED_PROTO}
    client_library.c
    common/sr_common.c
    common/sr_btree.c
    common/sr_logger.c
)

set(SYSREPO-ENGINE-SOURCES
    ${GENERATED_PROTO}
    connection_manager.c
    session_manager.c
    request_processor.c
    rp_dt_xpath.c
    rp_dt_lookup.c
    rp_dt_get.c
    rp_dt_edit.c
    rp_node_stack.c
    data_manager.c
    xpath_processor.c
    common/sr_common.c
    common/sr_btree.c
    common/sr_logger.c
)

set(HEADERS "${PROJECT_SOURCE_DIR}/inc/sysrepo.h")

# shared and static library
{'fraction_non_alphanumeric': 0.12567385444743936, 'fraction_numerical': 0.0, 'mean_word_length': 4.949899799599199, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2440349', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1136, 'n_words': 154}