<commit_before>cmake_minimum_required(VERSION 3.0.0)
project(helpers C CXX)

# The version number.
set(helpers_VERSION_MAJOR 0)
set(helpers_VERSION_MINOR 2)
set(helpers_VERSION_PATCH 0)
set(helpers_VERSION $(helpers_VERSION_MAJOR).$(helpers_VERSION_MINOR).$(helpers_VERSION_PATCH))

# CMake config
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
link_directories(${PROJECT_BINARY_DIR})

configure_file (
    include/version.h.in
    ${PROJECT_BINARY_DIR}/version.h
)

# Deps
add_subdirectory(deps/gmock)
add_subdirectory(deps/glog)
add_subdirectory(deps/websocketpp)

# Include paths
include_directories(include ${PROJECT_BINARY_DIR})
include_directories(SYSTEM ${GLOG_INCLUDE_DIR} ${WSPP_INCLUDE_DIR})

# Setup git
message(STATUS "Checking for Git...")
find_package(Git REQUIRED)

# Setup ProtoBuf
message(STATUS "Checking for Protobuf...")
find_package(Protobuf REQUIRED)

if(${PREFER_STATIC_LINK})
    find_library(PROTOBUF_LIBRARY NAMES libprotobuf.a protobuf)
endif(${PREFER_STATIC_LINK})

include_directories(SYSTEM ${PROTOBUF_INCLUDE_DIR})

# Setup OpenSSL
message(STATUS "Checking for OpenSSL...")
find_package(OpenSSL REQUIRED)

if(${PREFER_STATIC_LINK})
    find_library(SSL_LIBRARY NAMES libssl.a ssl)
    find_library(CRYPTO_LIBRARY NAMES libcrypto.a crypto)
    find_library(KRB5_LIBRARY krb5)

    if(${KRB5_LIBRARY} MATCHES KRB5_LIBRARY-NOTFOUND)
        set(OPENSSL_LIBRARIES ${SSL_LIBRARY} ${CRYPTO_LIBRARY})
    else(NOT ${KRB5_LIBRARY} MATCHES KRB5_LIBRARY-NOTFOUND)
        set(OPENSSL_LIBRARIES ${SSL_LIBRARY} ${CRYPTO_LIBRARY} ${KRB5_LIBRARY})
    endif(${KRB5_LIBRARY} MATCHES KRB5_LIBRARY-NOTFOUND)
endif(${PREFER_STATIC_LINK})

include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR})

# Setup pthreads
message(STATUS "Checking for pthreads...")
find_package(Threads REQUIRED)

# Setup fuse
message(STATUS "Checking for FUSE...")
find_package(FUSE REQUIRED)
include_directories(SYSTEM ${FUSE_INCLUDE_DIRS})

# Setup Boost
if(${PREFER_STATIC_LINK})
    set(Boost_USE_STATIC_LIBS       ON)
else(NOT ${PREFER_STATIC_LINK})
    set(Boost_USE_STATIC_LIBS       OFF)
endif(${PREFER_STATIC_LINK})

set(Boost_USE_MULTITHREADED      ON)
set(Boost_USE_STATIC_RUNTIME    OFF)
find_package(Boost COMPONENTS thread filesystem system random REQUIRED)

link_directories(${Boost_LIBRARY_DIRS})
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})

# Utility libs
if(${PREFER_STATIC_LINK})
    find_library(LTDL_LIBRARY NAMES libltdl.a ltdl)
    find_library(ZLIB_LIBRARY NAMES libz.a z)
else(NOT ${PREFER_STATIC_LINK})
    find_library(LTDL_LIBRARY ltdl)
    find_library(ZLIB_LIBRARY z)
endif(${PREFER_STATIC_LINK})

find_library(RT_LIBRARY rt)
find_library(DL_LIBRARY dl)

# Pull git submodules
message(STATUS "Pulling submodules using git...")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule init
                WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update
                WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
execute_process(COMMAND ${GIT_EXECUTABLE} submodule foreach git checkout
                WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})

# Compile .proto files
file(GLOB PROTO_FILES clproto/proto/*.proto)
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${PROTO_FILES})
include_directories(${CMAKE_CURRENT_BINARY_DIR})

# Setup sources
file(GLOB_RECURSE HELPER_SOURCES src/*.cc include/*.h)

# Setup compile flags
if(${PREFER_STATIC_LINK}) # Try to link libstdc++.a
    execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libstdc++.a OUTPUT_VARIABLE LIBSTD_NAME)
    string(STRIP ${LIBSTD_NAME} LIBSTD_NAME)
    if(EXISTS ${LIBSTD_NAME})
        execute_process(COMMAND ${CMAKE_PATH} -E create_symlink ${LIBSTD_NAME} WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
    endif(EXISTS ${LIBSTD_NAME})
endif(${PREFER_STATIC_LINK})

set(PLATFORM_EXTRA_LIBS ${CMAKE_THREAD_LIBS_INIT} ${LTDL_LIBRARY} ${ZLIB_LIBRARY} ${DL_LIBRARY})

if(APPLE)<commit_msg>Fix copying libstdc++ to the binary dir.<commit_after>cmake_minimum_required(VERSION 3.0.0)
project(helpers C CXX)

# The version number.
set(helpers_VERSION_MAJOR 0)
set(helpers_VERSION_MINOR 2)
set(helpers_VERSION_PATCH 0)
set(helpers_VERSION $(helpers_VERSION_MAJOR).$(helpers_VERSION_MINOR).$(helpers_VERSION_PATCH))

# CMake config
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
link_directories(${PROJECT_BINARY_DIR})

configure_file (
    include/version.h.in
    ${PROJECT_BINARY_DIR}/version.h
)

# Deps
add_subdirectory(deps/gmock)
add_subdirectory(deps/glog)
add_subdirectory(deps/websocketpp)

# Include paths
include_directories(include ${PROJECT_BINARY_DIR})
include_directories(SYSTEM ${GLOG_INCLUDE_DIR} ${WSPP_INCLUDE_DIR})

# Setup git
message(STATUS "Checking for Git...")
find_package(Git REQUIRED)

# Setup ProtoBuf
message(STATUS "Checking for Protobuf...")
find_package(Protobuf REQUIRED)

if(${PREFER_STATIC_LINK})
    find_library(PROTOBUF_LIBRARY NAMES libprotobuf.a protobuf)
endif(${PREFER_STATIC_LINK})

include_directories(SYSTEM ${PROTOBUF_INCLUDE_DIR})

# Setup OpenSSL
message(STATUS "Checking for OpenSSL...")
find_package(OpenSSL REQUIRED)

if(${PREFER_STATIC_LINK})
    find_library(SSL_LIBRARY NAMES libssl.a ssl)
    find_library(CRYPTO_LIBRARY NAMES libcrypto.a crypto)
    find_library(KRB5_LIBRARY krb5)

    if(${KRB5_LIBRARY} MATCHES KRB5_LIBRARY-NOTFOUND)
        set(OPENSSL_LIBRARIES ${SSL_LIBRARY} ${CRYPTO_LIBRARY})
    else(NOT ${KRB5_LIBRARY} MATCHES KRB5_LIBRARY-NOTFOUND)
        set(OPENSSL_LIBRARIES ${SSL_LIBRARY} ${CRYPTO_LIBRARY} ${KRB5_LIBRARY})
    endif(${KRB5_LIBRARY} MATCHES KRB5_LIBRARY-NOTFOUND)
endif(${PREFER_STATIC_LINK})

include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR})

# Setup pthreads
message(STATUS "Checking for pthreads...")
find_package(Threads REQUIRED)

# Setup fuse
message(STATUS "Checking for FUSE...")
find_package(FUSE REQUIRED)
include_directories(SYSTEM ${FUSE_INCLUDE_DIRS})

# Setup Boost
if(${PREFER_STATIC_LINK})
    set(Boost_USE_STATIC_LIBS       ON)
else(NOT ${PREFER_STATIC_LINK})
    set(Boost_USE_STATIC_LIBS       OFF)
endif(${PREFER_STATIC_LINK})

set(Boost_USE_MULTITHREADED      ON)
set(Boost_USE_STATIC_RUNTIME    OFF)
find_package(Boost COMPONENTS thread filesystem system random REQUIRED)

link_directories(${Boost_LIBRARY_DIRS})
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})

# Utility libs
if(${PREFER_STATIC_LINK})
    find_library(LTDL_LIBRARY NAMES libltdl.a ltdl)
    find_library(ZLIB_LIBRARY NAMES libz.a z)
else(NOT ${PREFER_STATIC_LINK})
    find_library(LTDL_LIBRARY ltdl)
    find_library(ZLIB_LIBRARY z)
endif(${PREFER_STATIC_LINK})

find_library(RT_LIBRARY rt)
find_library(DL_LIBRARY dl)

# Pull git submodules
message(STATUS "Pulling submodules using git...")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule init
                WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update
                WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
execute_process(COMMAND ${GIT_EXECUTABLE} submodule foreach git checkout
                WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})

# Compile .proto files
file(GLOB PROTO_FILES clproto/proto/*.proto)
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${PROTO_FILES})
include_directories(${CMAKE_CURRENT_BINARY_DIR})

# Setup sources
file(GLOB_RECURSE HELPER_SOURCES src/*.cc include/*.h)

# Setup compile flags
if(${PREFER_STATIC_LINK}) # Try to link libstdc++.a
    execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libstdc++.a OUTPUT_VARIABLE LIBSTD_NAME)
    string(STRIP ${LIBSTD_NAME} LIBSTD_NAME)
    if(EXISTS ${LIBSTD_NAME})
        execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${LIBSTD_NAME} ${PROJECT_BINARY_DIR}/libstdc++.a)
    endif(EXISTS ${LIBSTD_NAME})
endif(${PREFER_STATIC_LINK})

set(PLATFORM_EXTRA_LIBS ${CMAKE_THREAD_LIBS_INIT} ${LTDL_LIBRARY} ${ZLIB_LIBRARY} ${DL_LIBRARY})

if(APPLE)
{'fraction_non_alphanumeric': 0.10354049923586348, 'fraction_numerical': 0.0038206826286296485, 'mean_word_length': 6.72173058013766, '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': '3459734', 'n_tokens_mistral': 3074, 'n_tokens_neox': 2851, 'n_words': 484}