<commit_before>cmake_minimum_required(VERSION 3.4.1)
project(simdee)

# Options
set(SIMDEE_INSTRUCTION_SET "default" CACHE STRING "Instruction set used to produce SIMD-accelerated code")
set(SIMDEE_BUILD_TESTS OFF CACHE BOOL "Build test runner executable")
set(SIMDEE_BUILD_BENCHMARKS OFF CACHE BOOL "Build benchmark runner executable")
set_property(CACHE SIMDEE_INSTRUCTION_SET PROPERTY STRINGS "default" "SSE2" "AVX" "AVX2")

# Add a target for the header-only library
add_library(simdee INTERFACE)
target_include_directories(simdee INTERFACE include)
target_compile_features(simdee INTERFACE cxx_defaulted_functions cxx_deleted_functions cxx_delegating_constructors)

# Enable selected instruction set for library users
if(${SIMDEE_INSTRUCTION_SET} STREQUAL "default")
    # No flags added
elseif(${SIMDEE_INSTRUCTION_SET} STREQUAL "SSE2")
    if(MSVC)
        target_compile_options(simdee INTERFACE "/arch:SSE2")
    else()
        target_compile_options(simdee INTERFACE "-msse2")
    endif()
elseif(${SIMDEE_INSTRUCTION_SET} STREQUAL "AVX")
    if(MSVC)
        target_compile_options(simdee INTERFACE "/arch:AVX")
        target_compile_definitions(simdee INTERFACE "__AVX__") # Fixes MSVC code highlighting
    else()
        target_compile_options(simdee INTERFACE "-mavx")
    endif()
elseif(${SIMDEE_INSTRUCTION_SET} STREQUAL "AVX2")
    if(MSVC)
        target_compile_options(simdee INTERFACE "/arch:AVX2")
        target_compile_definitions(simdee INTERFACE "__AVX__" "__AVX2__") # Fixes MSVC code highlighting
    else()
        target_compile_options(simdee INTERFACE "-mavx2")
    endif()
else()
    message(FATAL_ERROR "SIMDEE_INSTRUCTION_SET has an unexpected value")
endif()

# Build executables
if(SIMDEE_BUILD_TESTS)
    add_subdirectory(test)
endif()
if(SIMDEE_BUILD_BENCHMARKS)
    add_subdirectory(bench)
endif()<commit_msg>Add an option to enable NEON via CMake #10<commit_after>cmake_minimum_required(VERSION 3.4.1)
project(simdee)

# Options
set(SIMDEE_INSTRUCTION_SET "default" CACHE STRING "Instruction set used to produce SIMD-accelerated code")
set(SIMDEE_BUILD_TESTS OFF CACHE BOOL "Build test runner executable")
set(SIMDEE_BUILD_BENCHMARKS OFF CACHE BOOL "Build benchmark runner executable")
set(SIMDEE_AARCH64 OFF CACHE BOOL "Set this option when the target architecture is AArch64, as opposed to 32-bit ARM (determines how NEON is enabled via compiler switches)")
set_property(CACHE SIMDEE_INSTRUCTION_SET PROPERTY STRINGS "default" "SSE2" "AVX" "AVX2" "NEON")

# Add a target for the header-only library
add_library(simdee INTERFACE)
target_include_directories(simdee INTERFACE include)
target_compile_features(simdee INTERFACE cxx_defaulted_functions cxx_deleted_functions cxx_delegating_constructors)

# Enable selected instruction set for library users
if(${SIMDEE_INSTRUCTION_SET} STREQUAL "default")
    # No flags added
elseif(${SIMDEE_INSTRUCTION_SET} STREQUAL "SSE2")
    if(MSVC)
        target_compile_options(simdee INTERFACE "/arch:SSE2")
    else()
        target_compile_options(simdee INTERFACE "-msse2")
    endif()
elseif(${SIMDEE_INSTRUCTION_SET} STREQUAL "AVX")
    if(MSVC)
        target_compile_options(simdee INTERFACE "/arch:AVX")
        target_compile_definitions(simdee INTERFACE "__AVX__") # Fixes MSVC code highlighting
    else()
        target_compile_options(simdee INTERFACE "-mavx")
    endif()
elseif(${SIMDEE_INSTRUCTION_SET} STREQUAL "AVX2")
    if(MSVC)
        target_compile_options(simdee INTERFACE "/arch:AVX2")
        target_compile_definitions(simdee INTERFACE "__AVX__" "__AVX2__") # Fixes MSVC code highlighting
    else()
        target_compile_options(simdee INTERFACE "-mavx2")
    endif()
elseif(${SIMDEE_INSTRUCTION_SET} STREQUAL "NEON")
    if(NOT SIMDEE_AARCH64)
        target_compile_options(simdee INTERFACE "-mfpu=neon")
    endif()
else()
    message(FATAL_ERROR "SIMDEE_INSTRUCTION_SET has an unexpected value")
endif()

# Build executables
if(SIMDEE_BUILD_TESTS)
    add_subdirectory(test)
endif()
if(SIMDEE_BUILD_BENCHMARKS)
    add_subdirectory(bench)
endif()
{'fraction_non_alphanumeric': 0.08421571041615365, 'fraction_numerical': 0.008372322088155627, 'mean_word_length': 5.691927512355848, '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': '6762854', 'n_tokens_mistral': 1464, 'n_tokens_neox': 1362, 'n_words': 315}