<commit_before>cmake_minimum_required(VERSION 2.8)
project(CLUE)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "../parrotscmake")

## Compiler settings

message(STATUS "CMAKE_SYSTEM_NAME: " ${CMAKE_SYSTEM_NAME})
message(STATUS "CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID})

if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
    if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
        set(NEWCXX_ENABLED_FLAG "-std=c++11 -stdlib=libc++ -Wall -O2")
    else()
        set(NEWCXX_ENABLED_FLAG "-std=c++11 -Wall -Wno-mismatched-tags -O2")
    endif()
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
    set(NEWCXX_ENABLED_FLAG "-std=c++11 -Wall -O2")
else()
    message(FATAL_ERROR, "Only GCC and clang is supported for now.")
endif()

set(CMAKE_CXX_FLAGS ${NEWCXX_ENABLED_FLAG})
message(STATUS "CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")

enable_testing()

###################################
#
#  Dependencies
#
###################################

## Google Test

find_package(GTest REQUIRED)
if (GTEST_FOUND)
    include_directories(SYSTEM ${GTEST_INCLUDE_DIRS})
    message(STATUS "GTest Libraries: " ${GTEST_LIBRARIES})
endif()

# pthread library is required for Google Test to work properly
find_package(Threads REQUIRED)

###################################
#
#  Directories
#
###################################

include_directories(include)

set(TESTS tests)
set(EXECUTABLE_OUTPUT_PATH bin)

###################################
#
#  Unit testing
#
###################################

set(UNIT_TESTS
    test_optional
    test_string_view
    test_stringex
    test_formatting
    test_numformat
    test_string_builder
    test_value_range
    test_array_view
    test_reindexed_view
    test_meta
    test_meta_seq
    test_include_all
)

foreach (tname ${UNIT_TESTS})
    add_executable(${tname} ${TESTS}/${tname}.cpp)
    target_link_libraries(${tname} ${GTEST_BOTH_LIBRARIES})
    target_link_libraries(${tname} ${CMAKE_THREAD_LIBS_INIT})
    add_test(NAME ${tname} COMMAND ${tname})
endforeach()

set(THREADING_TESTS
    test_shared_mutex
)

foreach(tname ${THREADING_TESTS})
    add_executable(${tname} ${TESTS}/${tname}.cpp)
    add_test(NAME ${tname} COMMAND ${tname})
endforeach()


###################################
#
#  Examples
#
###################################

set(EXAMPLES
    ex_stopwatch
    ex_timing
    ex_strings
    ex_formatting
    ex_newformatter
)

foreach (name ${EXAMPLES})
    add_executable(${name} examples/${name}.cpp)
endforeach()

###################################
#
#  Performance evaluation
#
###################################

set(PERFS
    perf_strgrow
    perf_numfmt
)

foreach (name ${PERFS})
    add_executable(${name} perf/${name}.cpp)
endforeach()
<commit_msg>link to thread libs for shared_mutex<commit_after>cmake_minimum_required(VERSION 2.8)
project(CLUE)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "../parrotscmake")

## Compiler settings

message(STATUS "CMAKE_SYSTEM_NAME: " ${CMAKE_SYSTEM_NAME})
message(STATUS "CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID})

if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
    if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
        set(NEWCXX_ENABLED_FLAG "-std=c++11 -stdlib=libc++ -Wall -O2")
    else()
        set(NEWCXX_ENABLED_FLAG "-std=c++11 -Wall -Wno-mismatched-tags -O2")
    endif()
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
    set(NEWCXX_ENABLED_FLAG "-std=c++11 -Wall -O2")
else()
    message(FATAL_ERROR, "Only GCC and clang is supported for now.")
endif()

set(CMAKE_CXX_FLAGS ${NEWCXX_ENABLED_FLAG})
message(STATUS "CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")

enable_testing()

###################################
#
#  Dependencies
#
###################################

## Google Test

find_package(GTest REQUIRED)
if (GTEST_FOUND)
    include_directories(SYSTEM ${GTEST_INCLUDE_DIRS})
    message(STATUS "GTest Libraries: " ${GTEST_LIBRARIES})
endif()

# pthread library is required for Google Test to work properly
find_package(Threads REQUIRED)

###################################
#
#  Directories
#
###################################

include_directories(include)

set(TESTS tests)
set(EXECUTABLE_OUTPUT_PATH bin)

###################################
#
#  Unit testing
#
###################################

set(UNIT_TESTS
    test_optional
    test_string_view
    test_stringex
    test_formatting
    test_numformat
    test_string_builder
    test_value_range
    test_array_view
    test_reindexed_view
    test_meta
    test_meta_seq
    test_include_all
)

foreach (tname ${UNIT_TESTS})
    add_executable(${tname} ${TESTS}/${tname}.cpp)
    target_link_libraries(${tname} ${GTEST_BOTH_LIBRARIES})
    target_link_libraries(${tname} ${CMAKE_THREAD_LIBS_INIT})
    add_test(NAME ${tname} COMMAND ${tname})
endforeach()

set(THREADING_TESTS
    test_shared_mutex
)

foreach(tname ${THREADING_TESTS})
    add_executable(${tname} ${TESTS}/${tname}.cpp)
    target_link_libraries(${tname} ${CMAKE_THREAD_LIBS_INIT})
    add_test(NAME ${tname} COMMAND ${tname})    
endforeach()


###################################
#
#  Examples
#
###################################

set(EXAMPLES
    ex_stopwatch
    ex_timing
    ex_strings
    ex_formatting
    ex_newformatter
)

foreach (name ${EXAMPLES})
    add_executable(${name} examples/${name}.cpp)
endforeach()

###################################
#
#  Performance evaluation
#
###################################

set(PERFS
    perf_strgrow
    perf_numfmt
)

foreach (name ${PERFS})
    add_executable(${name} perf/${name}.cpp)
endforeach()

{'fraction_non_alphanumeric': 0.23139894487902493, 'fraction_numerical': 0.004002183008913953, 'mean_word_length': 5.721271393643032, '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': '7078755', 'n_tokens_mistral': 1971, 'n_tokens_neox': 1875, 'n_words': 315}