<commit_before># Kitchen Sync is all C++, but Threads requires C to be enabled to figure out what options to use
project(kitchen_sync CXX C)

cmake_minimum_required(VERSION 2.6)

# suppress warnings about using c++11 features such as variadic templates
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
CHECK_CXX_COMPILER_FLAG("-stdlib=libc++" COMPILER_SUPPORTS_STDLIB)
if(COMPILER_SUPPORTS_CXX14)
	ADD_DEFINITIONS("-std=c++14")
elseif(COMPILER_SUPPORTS_CXX11)
	ADD_DEFINITIONS("-std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
	ADD_DEFINITIONS("-std=c++0x")
endif()
if(COMPILER_SUPPORTS_STDLIB)
	ADD_DEFINITIONS("-stdlib=libc++")
endif()

# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)

# we will need to be linked against pthreads on most platforms, but note that we don't use REQUIRED
# here because Threads was broken (http://www.cmake.org/Bug/view.php?id=15058).
find_package(Threads)

# boost for a couple of algorithm and utility includes
set(Boost_USE_MULTITHREADED ON)
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})

# yaml-cpp for filter files
include(FindPkgConfig)
pkg_check_modules(YamlCPP yaml-cpp)
if(YamlCPP_FOUND)
    include_directories(${YamlCPP_INCLUDE_DIRS})
    link_directories(${YamlCPP_LIBDIR})
else()
    set(YAML_CPP_BUILD_TESTS OFF CACHE BOOL "disable yaml tests")
    set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "disable yaml tools")
    set(YAML_CPP_BUILD_CONTRIB OFF CACHE BOOL "disable yaml contrib")
    add_subdirectory(src/yaml-cpp EXCLUDE_FROM_ALL)
    include_directories(src/yaml-cpp/include)
    set(YamlCPP_LIBRARIES yaml-cpp)
endif()

# the main program knows nothing but how to hook up the endpoints
set(ks_SRCS src/ks.cpp src/db_url.cpp src/process.cpp src/unidirectional_pipe.cpp)
add_executable(ks ${ks_SRCS})
target_link_libraries(ks ${CMAKE_THREAD_LIBS_INIT})
install(TARGETS ks RUNTIME DESTINATION bin)

# the endpoints normally hash data using OpenSSL; on macOS we use Apple's Common Crypto fork instead
if(NOT APPLE)
	find_package(OpenSSL REQUIRED)
	include_directories(${OPENSSL_INCLUDE_DIRS})
endif()

# is backtrace in libc?
if(NOT APPLE)
	find_package(Backtrace)
endif()

if(Backtrace_FOUND OR APPLE)
	ADD_DEFINITIONS("-DUSE_BACKTRACE")
endif()

# the endpoints do the actual work
set(ks_endpoint_SRCS src/schema.cpp src/filters.cpp src/abortable_barrier.cpp src/xxHash/xxhash.cpp)
set(ks_endpoint_LIBS ${OPENSSL_LIBRARIES} ${YamlCPP_LIBRARIES} ${Boost_LIBRARIES})

# turn on debugging symbols
set(CMAKE_BUILD_TYPE Debug)<commit_msg>always use the vendored version of yaml-cpp; neither it nor PkgConfig should be installed as build dependencies any more<commit_after># Kitchen Sync is all C++, but Threads requires C to be enabled to figure out what options to use
project(kitchen_sync CXX C)

cmake_minimum_required(VERSION 2.6)

# suppress warnings about using c++11 features such as variadic templates
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
CHECK_CXX_COMPILER_FLAG("-stdlib=libc++" COMPILER_SUPPORTS_STDLIB)
if(COMPILER_SUPPORTS_CXX14)
	ADD_DEFINITIONS("-std=c++14")
elseif(COMPILER_SUPPORTS_CXX11)
	ADD_DEFINITIONS("-std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
	ADD_DEFINITIONS("-std=c++0x")
endif()
if(COMPILER_SUPPORTS_STDLIB)
	ADD_DEFINITIONS("-stdlib=libc++")
endif()

# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)

# we will need to be linked against pthreads on most platforms, but note that we don't use REQUIRED
# here because Threads was broken (http://www.cmake.org/Bug/view.php?id=15058).
find_package(Threads)

# boost for a couple of algorithm and utility includes
set(Boost_USE_MULTITHREADED ON)
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})

# vendored-in version of yaml-cpp for filter files
set(YAML_CPP_BUILD_TESTS OFF CACHE BOOL "disable yaml tests")
set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "disable yaml tools")
set(YAML_CPP_BUILD_CONTRIB OFF CACHE BOOL "disable yaml contrib")
add_subdirectory(src/yaml-cpp EXCLUDE_FROM_ALL)
include_directories(src/yaml-cpp/include)
set(YamlCPP_LIBRARIES yaml-cpp)

# the main program knows nothing but how to hook up the endpoints
set(ks_SRCS src/ks.cpp src/db_url.cpp src/process.cpp src/unidirectional_pipe.cpp)
add_executable(ks ${ks_SRCS})
target_link_libraries(ks ${CMAKE_THREAD_LIBS_INIT})
install(TARGETS ks RUNTIME DESTINATION bin)

# the endpoints normally hash data using OpenSSL; on macOS we use Apple's Common Crypto fork instead
if(NOT APPLE)
	find_package(OpenSSL REQUIRED)
	include_directories(${OPENSSL_INCLUDE_DIRS})
endif()

# is backtrace in libc?
if(NOT APPLE)
	find_package(Backtrace)
endif()

if(Backtrace_FOUND OR APPLE)
	ADD_DEFINITIONS("-DUSE_BACKTRACE")
endif()

# the endpoints do the actual work
set(ks_endpoint_SRCS src/schema.cpp src/filters.cpp src/abortable_barrier.cpp src/xxHash/xxhash.cpp)
set(ks_endpoint_LIBS ${OPENSSL_LIBRARIES} ${YamlCPP_LIBRARIES} ${Boost_LIBRARIES})

# turn on debugging symbols
set(CMAKE_BUILD_TYPE Debug)
{'fraction_non_alphanumeric': 0.09322811525050467, 'fraction_numerical': 0.010644154890805653, 'mean_word_length': 7.346094946401225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1248280', 'n_tokens_mistral': 2075, 'n_tokens_neox': 1965, 'n_words': 464}