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

add_subdirectory(plugins)

add_executable(sr_get_item_example sr_get_item_example.c)
add_executable(sr_get_items_example sr_get_items_example.c)
add_executable(sr_get_items_iter_example sr_get_items_iter_example.c)
add_executable(sr_set_item_example sr_set_item_example.c)
add_executable(sr_delete_item_example sr_delete_item_example.c)
add_executable(sr_get_changes_iter_example sr_get_changes_iter_example.c)
add_executable(application_example application_example.c)
add_executable(application_changes_example application_changes_example.c)

target_link_libraries(sr_get_item_example sysrepo)
target_link_libraries(sr_get_items_example sysrepo)
target_link_libraries(sr_get_items_iter_example sysrepo)
target_link_libraries(sr_set_item_example sysrepo)
target_link_libraries(sr_delete_item_example sysrepo)
target_link_libraries(sr_get_changes_iter_example sysrepo)
target_link_libraries(application_example sysrepo)
target_link_libraries(application_changes_example sysrepo)

macro(INSTALL_EXAMPLE_YANG MODULE_NAME REVISION)
    # install the YANG module
    set(CMD "${CMAKE_BINARY_DIR}/src/sysrepoctl --install --yang=${CMAKE_CURRENT_SOURCE_DIR}/yang/${MODULE_NAME}${REVISION}.yang --permissions=666")
    install(CODE "execute_process(COMMAND ${CMD} OUTPUT_QUIET)")
    # import data into module
    set(CMD "${CMAKE_BINARY_DIR}/src/sysrepocfg --import=${CMAKE_CURRENT_SOURCE_DIR}/yang/${MODULE_NAME}.data.xml --format=xml ${MODULE_NAME}")
    install(CODE "execute_process(COMMAND ${CMD} OUTPUT_QUIET)")
endmacro(INSTALL_EXAMPLE_YANG)

INSTALL_EXAMPLE_YANG("turing-machine" "")
INSTALL_EXAMPLE_YANG("iana-if-type" "")
INSTALL_EXAMPLE_YANG("ietf-ip" "@2014-06-16")
INSTALL_EXAMPLE_YANG("ietf-interfaces" "@2014-05-08")<commit_msg>fix example data import<commit_after>include_directories("${PROJECT_SOURCE_DIR}/inc")

add_subdirectory(plugins)

add_executable(sr_get_item_example sr_get_item_example.c)
add_executable(sr_get_items_example sr_get_items_example.c)
add_executable(sr_get_items_iter_example sr_get_items_iter_example.c)
add_executable(sr_set_item_example sr_set_item_example.c)
add_executable(sr_delete_item_example sr_delete_item_example.c)
add_executable(sr_get_changes_iter_example sr_get_changes_iter_example.c)
add_executable(application_example application_example.c)
add_executable(application_changes_example application_changes_example.c)

target_link_libraries(sr_get_item_example sysrepo)
target_link_libraries(sr_get_items_example sysrepo)
target_link_libraries(sr_get_items_iter_example sysrepo)
target_link_libraries(sr_set_item_example sysrepo)
target_link_libraries(sr_delete_item_example sysrepo)
target_link_libraries(sr_get_changes_iter_example sysrepo)
target_link_libraries(application_example sysrepo)
target_link_libraries(application_changes_example sysrepo)

macro(INSTALL_EXAMPLE_YANG MODULE_NAME REVISION)
    # install the YANG module
    set(CMD "${CMAKE_BINARY_DIR}/src/sysrepoctl --install --yang=${CMAKE_CURRENT_SOURCE_DIR}/yang/${MODULE_NAME}${REVISION}.yang --permissions=666")
    install(CODE "execute_process(COMMAND ${CMD} OUTPUT_QUIET)")
    # import data into module
    set(CMD "${CMAKE_BINARY_DIR}/src/sysrepocfg --import=${CMAKE_CURRENT_SOURCE_DIR}/yang/${MODULE_NAME}.data.xml --datastore=startup --format=xml ${MODULE_NAME}")
    install(CODE "execute_process(COMMAND ${CMD} OUTPUT_QUIET)")
endmacro(INSTALL_EXAMPLE_YANG)

INSTALL_EXAMPLE_YANG("turing-machine" "")
INSTALL_EXAMPLE_YANG("iana-if-type" "")
INSTALL_EXAMPLE_YANG("ietf-ip" "@2014-06-16")
INSTALL_EXAMPLE_YANG("ietf-interfaces" "@2014-05-08")
{'fraction_non_alphanumeric': 0.09388766519823788, 'fraction_numerical': 0.010462555066079295, 'mean_word_length': 11.570934256055363, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '4297222', 'n_tokens_mistral': 1333, 'n_tokens_neox': 1264, 'n_words': 143}