<commit_before>set(GENERATE_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated_source)
file(MAKE_DIRECTORY ${GENERATE_DIR})

set(GENREGSCRIPT ${CMAKE_SOURCE_DIR}/etc/genregistry.py)
set(GENREGCOMMAND
    ${GENREGSCRIPT}
    ${CMAKE_SOURCE_DIR}/etc/registry_config.py
    ${CMAKE_BINARY_DIR}/include/tudocomp/config.h
    ${GENERATE_DIR}
    --group 20
)

execute_process(
    COMMAND ${GENREGCOMMAND} --print_deps
    OUTPUT_VARIABLE OUTPUTS
    RESULT_VARIABLE RETURN_VALUE
)
if (NOT RETURN_VALUE EQUAL 0)
    message(FATAL_ERROR "Error in genregistry.py")
endif()

add_custom_command(
    COMMAND ${GENREGCOMMAND} --generate_files
    DEPENDS ${GENREGSCRIPT}
    OUTPUT ${OUTPUTS}
    COMMENT "Generating the registry..."
)

add_library(
    tudocomp_algorithms
    ${OUTPUTS}
)
target_link_libraries(
    tudocomp_algorithms

    tudocomp_stat
    tudocomp
    glog
    sdsl
)

cotire(tudocomp_algorithms)

configure_file(${GENREGSCRIPT} ${GENERATE_DIR}/trash COPYONLY)<commit_msg>Add cmake dependency for algorithm registry config<commit_after>set(GENERATE_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated_source)
file(MAKE_DIRECTORY ${GENERATE_DIR})

set(GENREGCONFIG ${CMAKE_SOURCE_DIR}/etc/registry_config.py)
set(GENREGSCRIPT ${CMAKE_SOURCE_DIR}/etc/genregistry.py)
set(GENREGCOMMAND
    ${GENREGSCRIPT}
    ${GENREGCONFIG}
    ${CMAKE_BINARY_DIR}/include/tudocomp/config.h
    ${GENERATE_DIR}
    --group 20
)

execute_process(
    COMMAND ${GENREGCOMMAND} --print_deps
    OUTPUT_VARIABLE OUTPUTS
    RESULT_VARIABLE RETURN_VALUE
)
if (NOT RETURN_VALUE EQUAL 0)
    message(FATAL_ERROR "Error in genregistry.py")
endif()

add_custom_command(
    COMMAND ${GENREGCOMMAND} --generate_files
    DEPENDS ${GENREGSCRIPT} ${GENREGCONFIG}
    OUTPUT ${OUTPUTS}
    COMMENT "Generating the registry..."
)

add_library(
    tudocomp_algorithms
    ${OUTPUTS}
)
target_link_libraries(
    tudocomp_algorithms

    tudocomp_stat
    tudocomp
    glog
    sdsl
)

cotire(tudocomp_algorithms)

configure_file(${GENREGSCRIPT} ${GENERATE_DIR}/trash1 COPYONLY)
configure_file(${GENREGCONFIG} ${GENERATE_DIR}/trash2 COPYONLY)
{'fraction_non_alphanumeric': 0.10038058991436727, 'fraction_numerical': 0.003805899143672693, 'mean_word_length': 4.974431818181818, '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': '2461996', 'n_tokens_mistral': 804, 'n_tokens_neox': 785, 'n_words': 123}