<commit_before>include(ExternalProject)

find_package(libuuid REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(OpenSSL REQUIRED)

set(DAVIX_VERSION "0.6.7")
set(DAVIX_URL "http://grid-deployment.web.cern.ch/grid-deployment/dms/lcgutil/tar/davix")
set(DAVIX_URLHASH "SHA256=1694152a20a5c5e692c4bc545b2efbacec5274fb799e60725412ebae40cced3d")
set(DAVIX_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/DAVIX-prefix)
set(DAVIX_LIBNAME ${CMAKE_STATIC_LIBRARY_PREFIX}davix${CMAKE_STATIC_LIBRARY_SUFFIX})

foreach(lib davix neon)
  set(libname ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX})
  list(APPEND DAVIX_LIBRARIES ${DAVIX_PREFIX}/lib/${libname})
endforeach()

ExternalProject_Add(DAVIX
  URL ${DAVIX_URL}/${DAVIX_VERSION}/davix-embedded-${DAVIX_VERSION}.tar.gz
  URL_HASH ${DAVIX_URLHASH}
  CMAKE_CACHE_ARGS
    -DCMAKE_PREFIX_PATH:STRING=${OPENSSL_PREFIX}
    -DUUID_INCLUDE_DIR:STRING=${UUID_INCLUDE_DIR}
    -DUUID_LIBRARY:STRING=${UUID_LIBRARY}
    -DLIBXML2_INCLUDE_DIR:PATH=${LIBXML2_INCLUDE_DIR}
    -DLIBXML2_LIBRARY:PATH=${LIBXML2_LIBRARY}
    -DLIBXML2_LIBRARIES:PATH=${LIBXML2_LIBRARIES}
  CMAKE_ARGS
    -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
    -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
    -DENABLE_HTML_DOCS=OFF
    -DENABLE_IPV6=OFF
    -DSTATIC_LIBRARY=ON
    -DSHARED_LIBRARY=OFF
    -DENABLE_TOOLS=OFF
    -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
    -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
    -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}\ -fPIC
    -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
    -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
    -DLIB_SUFFIX=
  LOG_BUILD 1 LOG_CONFIGURE 1 LOG_DOWNLOAD 1 LOG_INSTALL 1
  BUILD_BYPRODUCTS ${DAVIX_LIBRARIES})

if(builtin_openssl)
  add_dependencies(DAVIX OPENSSL)
endif()

list(APPEND DAVIX_LIBRARIES uuid::uuid OpenSSL::SSL ${LIBXML2_LIBRARIES} ${CMAKE_DL_LIBS})

check_cxx_symbol_exists("clock_gettime" "time.h" _have_clock_gettime)

if(NOT _have_clock_gettime)
  check_library_exists(rt clock_gettime "" _have_rt_library)
  if(_have_rt_library)
    list(APPEND DAVIX_LIBRARIES rt)<commit_msg>builtins/davix: propagate all includes for libxml2<commit_after>include(ExternalProject)

find_package(libuuid REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(OpenSSL REQUIRED)

set(DAVIX_VERSION "0.6.7")
set(DAVIX_URL "http://grid-deployment.web.cern.ch/grid-deployment/dms/lcgutil/tar/davix")
set(DAVIX_URLHASH "SHA256=1694152a20a5c5e692c4bc545b2efbacec5274fb799e60725412ebae40cced3d")
set(DAVIX_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/DAVIX-prefix)
set(DAVIX_LIBNAME ${CMAKE_STATIC_LIBRARY_PREFIX}davix${CMAKE_STATIC_LIBRARY_SUFFIX})

foreach(lib davix neon)
  set(libname ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX})
  list(APPEND DAVIX_LIBRARIES ${DAVIX_PREFIX}/lib/${libname})
endforeach()

ExternalProject_Add(DAVIX
  URL ${DAVIX_URL}/${DAVIX_VERSION}/davix-embedded-${DAVIX_VERSION}.tar.gz
  URL_HASH ${DAVIX_URLHASH}
  CMAKE_CACHE_ARGS
    -DCMAKE_PREFIX_PATH:STRING=${OPENSSL_PREFIX}
    -DUUID_INCLUDE_DIR:STRING=${UUID_INCLUDE_DIR}
    -DUUID_LIBRARY:STRING=${UUID_LIBRARY}
    -DLIBXML2_INCLUDE_DIR:PATH=${LIBXML2_INCLUDE_DIR}
    -DLIBXML2_INCLUDE_DIRS:STRING=${LIBXML2_INCLUDE_DIRS}
    -DLIBXML2_LIBRARY:PATH=${LIBXML2_LIBRARY}
    -DLIBXML2_LIBRARIES:STRING=${LIBXML2_LIBRARIES}
  CMAKE_ARGS
    -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
    -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
    -DENABLE_HTML_DOCS=OFF
    -DENABLE_IPV6=OFF
    -DSTATIC_LIBRARY=ON
    -DSHARED_LIBRARY=OFF
    -DENABLE_TOOLS=OFF
    -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
    -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
    -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}\ -fPIC
    -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
    -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
    -DLIB_SUFFIX=
  LOG_BUILD 1 LOG_CONFIGURE 1 LOG_DOWNLOAD 1 LOG_INSTALL 1
  BUILD_BYPRODUCTS ${DAVIX_LIBRARIES})

if(builtin_openssl)
  add_dependencies(DAVIX OPENSSL)
endif()

list(APPEND DAVIX_LIBRARIES uuid::uuid OpenSSL::SSL ${LIBXML2_LIBRARIES} ${CMAKE_DL_LIBS})

check_cxx_symbol_exists("clock_gettime" "time.h" _have_clock_gettime)

if(NOT _have_clock_gettime)
  check_library_exists(rt clock_gettime "" _have_rt_library)
  if(_have_rt_library)
    list(APPEND DAVIX_LIBRARIES rt)
{'fraction_non_alphanumeric': 0.10626010626010626, 'fraction_numerical': 0.026565026565026566, 'mean_word_length': 7.540433925049309, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, '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': '96955', 'n_tokens_mistral': 2015, 'n_tokens_neox': 1813, 'n_words': 177}