<commit_before>
set (build "ini")
configure_file (version.c.in ${CMAKE_CURRENT_BINARY_DIR}/version.c)
add_custom_target (configure_version ALL
  COMMAND ${CMAKE_COMMAND}
    -D SRC_DIR=${CMAKE_CURRENT_SOURCE_DIR}
    -D BIN_DIR=${CMAKE_CURRENT_BINARY_DIR}
    -D PROJECT_VERSION=${PROJECT_VERSION}
    -D PROJECT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
    -D PROJECT_VERSION_MINOR=${PROJECT_VERSION_MINOR}
    -D PROJECT_VERSION_PATCH=${PROJECT_VERSION_PATCH}
    -P ${CMAKE_SOURCE_DIR}/cmake/configure_version.cmake
  DEPENDS
    ${CMAKE_CURRENT_SOURCE_DIR}/version.c.in
  COMMENT "Configuring version.c"
)

set (PROJECT_3PARTY_LIBDIR ${CMAKE_SOURCE_DIR}/3rdparty)
set (_LIBDISIR_3PARTY_LIB_SOURCES
  "${PROJECT_3PARTY_LIBDIR}/void-multimap/multimap.c"
  "${PROJECT_3PARTY_LIBDIR}/void-list/list.c"
  "${PROJECT_3PARTY_LIBDIR}/void-list/list_iterator.c"
)

set (_LIBDISIR_3PARTY_LIB_INCLUDEDIR
  ${PROJECT_3PARTY_LIBDIR}/void-multimap
  ${PROJECT_3PARTY_LIBDIR}/void-list/include
)

# Define all libdisir source files
set (_LIBDISIR_SOURCES
    "log.c"
    "util.c"
    "context.c"
    "context_default.c"
    "context_keyval.c"
    "context_mold.c"
    "context_util.c"
    "context_config.c"
    "context_section.c"
    "context_documentation.c"
    "context_value.c"
    "context_free_text.c"
    "context_restriction.c"
    "collection.c"
    "element_storage.c"
    "disir.c"
    "disir_config.c"
    "disir_entry.c"
    "disir_mold.c"
    "disir_plugin.c"
    "io/ini.c"
    "update.c"
    "validate.c"
    "compare.c"
    "${CMAKE_CURRENT_BINARY_DIR}/version.c"
    ${_LIBDISIR_3PARTY_LIB_SOURCES}
)

set (PROJECT_SO_LIBRARY disir
    CACHE INTERNAL "${PROJECT_NAME}: shared library" FORCE)
# Define shared library
add_library(${PROJECT_SO_LIBRARY} SHARED ${_LIBDISIR_SOURCES})
add_dependencies (${PROJECT_SO_LIBRARY} configure_version)

target_include_directories (${PROJECT_SO_LIBRARY} PRIVATE
  ${CMAKE_CURRENT_SOURCE_DIR}/include/
  ${_LIBDISIR_3PARTY_LIB_INCLUDEDIR}
)

target_include_directories (${PROJECT_SO_LIBRARY} PUBLIC
  $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include/>
  $<INSTALL_INTERFACE:include/>
)

set_target_properties (${PROJECT_SO_LIBRARY} PROPERTIES COMPILE_FLAGS "-fPIC")
set_property (TARGET ${PROJECT_SO_LIBRARY} PROPERTY CXX_STANDARD 11)
set_property (TARGET ${PROJECT_SO_LIBRARY} PROPERTY CXX_STANDARD_REQUIRED ON)

add_definitions ("-Wall")
add_definitions ("-Werror")
# TODO: Add check for gcc > 4.9
#add_definitions ("-fsanitize=undefined")
#add_definitions ("-fsanitize=shift")
#add_definitions ("-fsanitize=integer-divide-by-zero")
#add_definitions ("-fsanitize=unreachable")
#add_definitions ("-fsanitize=vla-bound")<commit_msg>chore: add toml fslib to build<commit_after>
set (build "ini")
configure_file (version.c.in ${CMAKE_CURRENT_BINARY_DIR}/version.c)
add_custom_target (configure_version ALL
  COMMAND ${CMAKE_COMMAND}
    -D SRC_DIR=${CMAKE_CURRENT_SOURCE_DIR}
    -D BIN_DIR=${CMAKE_CURRENT_BINARY_DIR}
    -D PROJECT_VERSION=${PROJECT_VERSION}
    -D PROJECT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
    -D PROJECT_VERSION_MINOR=${PROJECT_VERSION_MINOR}
    -D PROJECT_VERSION_PATCH=${PROJECT_VERSION_PATCH}
    -P ${CMAKE_SOURCE_DIR}/cmake/configure_version.cmake
  DEPENDS
    ${CMAKE_CURRENT_SOURCE_DIR}/version.c.in
  COMMENT "Configuring version.c"
)

set (PROJECT_3PARTY_LIBDIR ${CMAKE_SOURCE_DIR}/3rdparty)
set (_LIBDISIR_3PARTY_LIB_SOURCES
  "${PROJECT_3PARTY_LIBDIR}/void-multimap/multimap.c"
  "${PROJECT_3PARTY_LIBDIR}/void-list/list.c"
  "${PROJECT_3PARTY_LIBDIR}/void-list/list_iterator.c"
)

set (_LIBDISIR_3PARTY_LIB_INCLUDEDIR
  ${PROJECT_3PARTY_LIBDIR}/void-multimap
  ${PROJECT_3PARTY_LIBDIR}/void-list/include
  ${PROJECT_3PARTY_LIBDIR}/boost_fdstream
  ${PROJECT_3PARTY_LIBDIR}
)

set (FSLIB_SOURCES
  "${CMAKE_CURRENT_SOURCE_DIR}/fslib/toml.cc"
  "${CMAKE_CURRENT_SOURCE_DIR}/fslib/toml_serialize.cc"
  "${CMAKE_CURRENT_SOURCE_DIR}/fslib/toml_unserialize.cc"
)

# Define all libdisir source files
set (_LIBDISIR_SOURCES
    "log.c"
    "util.c"
    "context.c"
    "context_default.c"
    "context_keyval.c"
    "context_mold.c"
    "context_util.c"
    "context_config.c"
    "context_section.c"
    "context_documentation.c"
    "context_value.c"
    "context_free_text.c"
    "context_restriction.c"
    "collection.c"
    "element_storage.c"
    "disir.c"
    "disir_config.c"
    "disir_entry.c"
    "disir_mold.c"
    "disir_plugin.c"
    "io/ini.c"
    "update.c"
    "validate.c"
    "compare.c"
    "${CMAKE_CURRENT_BINARY_DIR}/version.c"
    ${_LIBDISIR_3PARTY_LIB_SOURCES}
    ${FSLIB_SOURCES}
)

set (PROJECT_SO_LIBRARY disir
    CACHE INTERNAL "${PROJECT_NAME}: shared library" FORCE)
# Define shared library
add_library(${PROJECT_SO_LIBRARY} SHARED ${_LIBDISIR_SOURCES})
add_dependencies (${PROJECT_SO_LIBRARY} configure_version)

target_include_directories (${PROJECT_SO_LIBRARY} PRIVATE
  ${CMAKE_CURRENT_SOURCE_DIR}/include/
  ${_LIBDISIR_3PARTY_LIB_INCLUDEDIR}
)

target_include_directories (${PROJECT_SO_LIBRARY} PUBLIC
  $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include/>
  $<INSTALL_INTERFACE:include/>
)

set_target_properties (${PROJECT_SO_LIBRARY} PROPERTIES COMPILE_FLAGS "-fPIC")
set_property (TARGET ${PROJECT_SO_LIBRARY} PROPERTY CXX_STANDARD 11)
set_property (TARGET ${PROJECT_SO_LIBRARY} PROPERTY CXX_STANDARD_REQUIRED ON)

add_definitions ("-Wall")
add_definitions ("-Werror")
# TODO: Add check for gcc > 4.9
#add_definitions ("-fsanitize=undefined")
#add_definitions ("-fsanitize=shift")
#add_definitions ("-fsanitize=integer-divide-by-zero")
#add_definitions ("-fsanitize=unreachable")
#add_definitions ("-fsanitize=vla-bound")
{'fraction_non_alphanumeric': 0.12240184757505773, 'fraction_numerical': 0.005684846331497601, 'mean_word_length': 5.6548463356974, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '611988', 'n_tokens_mistral': 2304, 'n_tokens_neox': 2241, 'n_words': 294}