<commit_before>cmake_minimum_required (VERSION 2.8)
project (R2D2-NXT)

list(APPEND CMAKE_FIND_ROOT_PATH
 ${CMAKE_SOURCE_DIR}/cmake/modules)

include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)

check_c_compiler_flag(-Wall C_HAS_WALL)
if (C_HAS_WALL)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
endif()

check_cxx_compiler_flag(-Wall CXX_HAS_WALL)
if (CXX_HAS_WALL)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()

check_cxx_compiler_flag(--std=c++0x HAS_STD_CPP0X)
if (HAS_STD_CPP0X)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++0x")
endif()

check_cxx_compiler_flag(-std=c++11 HAS_STD_CPP11)
if (HAS_STD_CPP11)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_NO_CXX11_NUMERIC_LIMITS -stdlib=libc++ -std=c++11")
endif()

# Set library path to ports path on Mac OSX
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
    set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /opt/local/lib)
    set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} /opt/local/include)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
    find_package(Boost COMPONENTS thread system REQUIRED)
else()
    find_package(Boost COMPONENTS thread REQUIRED)
endif()

include_directories(${Boost_INCLUDE_DIRS})
set(R2D2LIBS ${R2D2LIBS} ${Boost_LIBRARIES})

find_package(LIBUSB REQUIRED)
include_directories(${LIBUSB_INCLUDE_DIRS})
set(R2D2LIBS ${R2D2LIBS} ${LIBUSB_LIBRARIES})

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
    find_package(BLUETOOTH REQUIRED)
    include_directories(${LIBBLUETOOTH_INCLUDE_DIRS})
    set(R2D2LIBS ${R2D2LIBS} ${LIBBLUETOOTH_LIBRARIES})
endif()

include_directories(include)
add_subdirectory(src)
add_subdirectory(examples)<commit_msg>Clean up and comment CMakeLists.txt<commit_after>cmake_minimum_required (VERSION 2.8)
project (R2D2-NXT)

# Add project's CMake modules
list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)

include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)

check_c_compiler_flag(-Wall C_HAS_WALL)
if (C_HAS_WALL)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
endif()

check_cxx_compiler_flag(-Wall CXX_HAS_WALL)
if (CXX_HAS_WALL)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()

# Check that the C++ compiler supports C++11, or at least C++0x
check_cxx_compiler_flag(--std=c++0x HAS_STD_CPP0X)
if (HAS_STD_CPP0X)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++0x")
endif()

check_cxx_compiler_flag(-std=c++11 HAS_STD_CPP11)
if (HAS_STD_CPP11)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()

if(NOT(HAS_STD_CPP11 OR HAS_STD_CPP0X))
    message("${PROJECT_NAME} requires a compiler that supports C++11")
    return()
endif()

# Set library path to ports path on Mac OSX
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
    set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /opt/local/lib)
    set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} /opt/local/include)

    # Use Clang's libc++ on Mac OSX
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
    # Work around Boost bug #7671 (https://svn.boost.org/trac/boost/ticket/7671)
    if(${Boost_VERSION} STREQUAL "105200")
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_NO_CXX11_NUMERIC_LIMITS")
    endif()
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

# Mac OSX requires boost.system
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
    find_package(Boost COMPONENTS thread system REQUIRED)
else()
    find_package(Boost COMPONENTS thread REQUIRED)
endif()

# Require Boost
include_directories(${Boost_INCLUDE_DIRS})
set(R2D2LIBS ${R2D2LIBS} ${Boost_LIBRARIES})

# Require libusb-1.0
find_package(LIBUSB REQUIRED)
include_directories(${LIBUSB_INCLUDE_DIRS})
set(R2D2LIBS ${R2D2LIBS} ${LIBUSB_LIBRARIES})

# Add the Bluetooth libraries on Linux only
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
    find_package(BLUETOOTH REQUIRED)
    include_directories(${LIBBLUETOOTH_INCLUDE_DIRS})
    set(R2D2LIBS ${R2D2LIBS} ${LIBBLUETOOTH_LIBRARIES})
endif()

include_directories(include)
add_subdirectory(src)

# TODO: make the examples optional
add_subdirectory(examples)
{'fraction_non_alphanumeric': 0.11704771371769383, 'fraction_numerical': 0.020874751491053677, 'mean_word_length': 7.164300202839756, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '452490', 'n_tokens_mistral': 1798, 'n_tokens_neox': 1601, 'n_words': 274}