<commit_before>CMAKE_MINIMUM_REQUIRED (VERSION 2.8)

# Disable in source build
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
    MESSAGE(FATAL_ERROR "In-source builds not allowed. Please make a new directory and run CMake from there.")
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})

PROJECT (vSMC C CXX)

# User configurations
IF (EXISTS ${PROJECT_SOURCE_DIR}/user_options.cmake)
    INCLUDE (${PROJECT_SOURCE_DIR}/user_options.cmake)
ENDIF (EXISTS ${PROJECT_SOURCE_DIR}/user_options.cmake)

# Options
OPTION (VSMC_ENABLE_EXAMPLE             "Enable building examples"  ON)
OPTION (VSMC_ENABLE_CXX11LIB_CHRONO     "Enable C++11 <chrono>"     ON)
OPTION (VSMC_ENABLE_CXX11LIB_FUNCTIONAL "Enable C++11 <functional>" ON)
OPTION (VSMC_ENABLE_CXX11LIB_RANDOM     "Enable C++11 <random>"     ON)
OPTION (VSMC_ENABLE_CXX11LIB_THREAD     "Enable C++11 <thread>"     ON)
OPTION (VSMC_ENABLE_CXX11LIB_TUPLE      "Enable C++11 <tuple>"      ON)
OPTION (VSMC_ENABLE_CXX11LIB_FUTURE     "Enable C++11 <future>"     OFF)
OPTION (VSMC_ENABLE_MPI                 "Enable MPI"                OFF)

# Configuration files
FILE (READ ${PROJECT_SOURCE_DIR}/README.markdown README)
SET (DOC_SOURCE  ${PROJECT_SOURCE_DIR}/doc)
SET (DOC_INCLUDE ${PROJECT_SOURCE_DIR}/include)
CONFIGURE_FILE (
    ${PROJECT_SOURCE_DIR}/Doxyfile.in
    ${PROJECT_BINARY_DIR}/Doxyfile)
CONFIGURE_FILE (
    ${PROJECT_SOURCE_DIR}/doc/main.markdown.in
    ${PROJECT_SOURCE_DIR}/doc/main.markdown)

IF (NOT VSMC_INSTALL_INC_DIR)
    SET (VSMC_INSTALL_INC_DIR include)
ENDIF (NOT VSMC_INSTALL_INC_DIR)

# Installation
INSTALL (FILES include/vsmc.hpp DESTINATION ${VSMC_INSTALL_INC_DIR})
INSTALL (DIRECTORY include/vsmc/ DESTINATION ${VSMC_INSTALL_INC_DIR}/vsmc
    PATTERN ".DS_Store" EXCLUDE PATTERN "*.swp" EXCLUDE)

# Documentations
INCLUDE (FindDoxygen)
FILE (GLOB_RECURSE DOC_SOURCE_FILES      ${PROJECT_SOURCE_DIR}/doc/*.*)
FILE (GLOB_RECURSE DOC_INCLUDE_FILES_C   ${PROJECT_SOURCE_DIR}/include/*.h)
FILE (GLOB_RECURSE DOC_INCLUDE_FILES_CPP ${PROJECT_SOURCE_DIR}/include/*.hpp)
IF (DOXYGEN_FOUND)
    ADD_CUSTOM_COMMAND (
        OUTPUT  ${PROJECT_BINARY_DIR}/doc
        DEPENDS ${PROJECT_BINARY_DIR}/Doxyfile
        ${DOC_SOURCE_FILES} ${DOC_INCLUDE_FILES_C} ${DOC_INCLUDE_FILES_CPP}
        WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
        COMMAND ${DOXYGEN_EXECUTABLE} ARGS Doxyfile)
    ADD_CUSTOM_TARGET(docs DEPENDS ${PROJECT_BINARY_DIR}/doc)
ENDIF (DOXYGEN_FOUND)

# Finish here if we disable example
IF (NOT VSMC_ENABLE_EXAMPLE)
    RETURN ()
ENDIF (NOT VSMC_ENABLE_EXAMPLE)

# Module path and vSMC cmake functions
SET (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
INCLUDE (vSMCFunctions)

# Required Includes
SET (VSMC_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
SET (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${VSMC_INCLUDE_DIR})
INCLUDE_DIRECTORIES (${VSMC_INCLUDE_DIR})

# Boost
SET (Boost_NO_BOOST_CMAKE ON)
SET (Boost_ADDITIONAL_VERSIONS
    "1.49" "1.49.0"
    "1.50" "1.50.0"
    "1.51" "1.51.0"
    "1.52" "1.52.0"
    "1.53" "1.53.0"
    "1.54" "1.54.0")
IF (NOT Boost_FOUND)
    INCLUDE (FindBoost)
ENDIF (NOT Boost_FOUND)
IF (Boost_FOUND)
    INCLUDE_DIRECTORIES (SYSTEM ${Boost_INCLUDE_DIRS})
    SET (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES}
        ${Boost_INCLUDE_DIRS})
ENDIF (Boost_FOUND)

# C++11 libs flags
INCLUDE (vSMCFindFunctional)
IF (VSMC_FUNCTIONAL_STD_FOUND)
    ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_FUNCTIONAL=1)
    SET (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
        -DVSMC_HAS_CXX11LIB_FUNCTIONAL=1)
ELSE (VSMC_FUNCTIONAL_STD_FOUND)
    ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_FUNCTIONAL=0)
    SET (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
        -DVSMC_HAS_CXX11LIB_FUNCTIONAL=0)
ENDIF (VSMC_FUNCTIONAL_STD_FOUND)

INCLUDE (vSMCFindRandom)
IF (VSMC_RANDOM_STD_FOUND)
    ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_RANDOM=1)
    SET (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
        -DVSMC_HAS_CXX11LIB_RANDOM=1)
ELSE (VSMC_RANDOM_STD_FOUND)
    ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_RANDOM=0)
    SET (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
        -DVSMC_HAS_CXX11LIB_RANDOM=0)
ENDIF (VSMC_RANDOM_STD_FOUND)
IF (VSMC_RANDOM123_FOUND)
    INCLUDE_DIRECTORIES (${Random123_INCLUDE_DIR})
    ADD_DEFINITIONS (-DVSMC_USE_RANDOM123=1)
ELSE (VSMC_RANDOM123_FOUND)
    ADD_DEFINITIONS (-DVSMC_USE_RANDOM123=0)
ENDIF (VSMC_RANDOM123_FOUND)

IF (VSMC_FUNCTIONAL_FOUND AND VSMC_RANDOM_FOUND)
    INCLUDE (vSMCFindSTDTBB)
    IF (VSMC_STDTBB_FOUND)
        SET (VSMC_USE_STD TRUE)
        IF (VSMC_FUTURE_FOUND)
            ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_FUTURE=1)
        ELSE (VSMC_FUTURE_FOUND)
            ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_FUTURE=0)
        ENDIF (VSMC_FUTURE_FOUND)
    ELSE (VSMC_STDTBB_FOUND)
        SET (VSMC_USE_STD FALSE)
    ENDIF (VSMC_STDTBB_FOUND)

    INCLUDE (vSMCFindTuple)

    # Third-patry features
    IF (${CMAKE_CXX_COMPILER_ID} MATCHES "Intel")
        INCLUDE (FindCilk)
    ENDIF (${CMAKE_CXX_COMPILER_ID} MATCHES "Intel")

    INCLUDE (vSMCFindGCD)
    IF (VSMC_GCD_FOUND)
        INCLUDE_DIRECTORIES (SYSTEM ${GCD_INCLUDE_DIR})
    ENDIF (VSMC_GCD_FOUND)

    IF (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
        INCLUDE (vSMCFindOpenMP)
    ENDIF (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")

    IF (NOT DEFINED VSMC_PPL_FOUND)
        IF (MSVC_VERSION GREATER 1599)
            MESSAGE (STATUS "Found Microsoft PPL support")
            SET (VSMC_PPL_FOUND TRUE CACHE BOOL "Found PPL")
        ELSE (MSVC_VERSION GREATER 1599)
            SET (VSMC_PPL_FOUND FALSE CACHE BOOL "NOT Found PPL")
        ENDIF (MSVC_VERSION GREATER 1599)
    ENDIF (NOT DEFINED VSMC_PPL_FOUND)

    INCLUDE (FindTBB)
    IF (TBB_FOUND)
        INCLUDE_DIRECTORIES (SYSTEM ${TBB_INCLUDE_DIR})
        ADD_DEFINITIONS (${TBB_DEFINITIONS})
    ENDIF (TBB_FOUND)

    INCLUDE (vSMCFindOpenCL)
    IF (VSMC_OPENCL_FOUND)
        INCLUDE_DIRECTORIES (SYSTEM ${OpenCL_INCLUDE_DIR})
        SET (VSMC_CL_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
    ENDIF (VSMC_OPENCL_FOUND)

    IF (VSMC_ENABLE_MPI)
        INCLUDE (vSMCFindMPI)
    ENDIF (VSMC_ENABLE_MPI)
    IF (VSMC_MPI_FOUND)
        INCLUDE_DIRECTORIES (SYSTEM ${MPI_CXX_INCLUDE_PATH})
    ENDIF (VSMC_MPI_FOUND)

    # Timing
    INCLUDE (vSMCFindChrono)
    IF (VSMC_CHRONO_FOUND)
        ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_CHRONO=1)
    ELSE (VSMC_CHRONO_FOUND)
        ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_CHRONO=0)
    ENDIF (VSMC_CHRONO_FOUND)

    IF (UNIX AND NOT APPLE)
        UNSET (LINUX_LIBRT CACHE)
        FIND_LIBRARY (LINUX_LIBRT rt)
        IF (NOT LINUX_LIBRT)
            ADD_DEFINITIONS (-DVSMC_HAS_NATIVE_TIME_LIBRARY=0)
        ENDIF (NOT LINUX_LIBRT)
    ENDIF (UNIX AND NOT APPLE)

    # Special math functions
    INCLUDE (FindCXXMathLgamma)
    IF (CXX_MATH_LGAMMA_C99_FOUND)
        ADD_DEFINITIONS (-DVSMC_USE_C99_LGAMMA=1)
    ELSEIF (CXX_MATH_LGAMMA_STD_FOUND)
        ADD_DEFINITIONS (-DVSMC_USE_STD_LGAMMA=1)
    ELSEIF (CXX_MATH_LGAMMA_BOOST_FOUND)
        ADD_DEFINITIONS (-DVSMC_USE_BOOST_LGAMMA=1)
    ENDIF (CXX_MATH_LGAMMA_C99_FOUND)
    IF (CXX_MATH_LGAMMA_FOUND)
        ADD_DEFINITIONS (-DVSMC_HAS_LGAMMA=1)
    ENDIF (CXX_MATH_LGAMMA_FOUND)

    # Make sure __STDC_CONSTANT_MACROS is defined
    ADD_DEFINITIONS (-D__STDC_CONSTANT_MACROS)

    # Workaround for vanilla GCC on Mac OS X
    IF (APPLE)
        ADD_DEFINITIONS (-U__OBJC__)
        ADD_DEFINITIONS (-U__OBJC2__)
    ENDIF (APPLE)

    # Disable MSVC iterator warning. Callers are responsible for checking bounds!
    IF (MSVC)
        ADD_DEFINITIONS (-D_SCL_SECURE_NO_WARNINGS)
    ENDIF (MSVC)

    # SMP backends
    MESSAGE (STATUS "Enable Sequential")
    SET (SMP_EXECUTABLES seq)
    ADD_CUSTOM_TARGET (buildseq)

    IF (TBB_FOUND)
        MESSAGE (STATUS "Enable Intel Threading Building Blocks")
        SET (SMP_EXECUTABLES ${SMP_EXECUTABLES} tbb)
        ADD_CUSTOM_TARGET (buildtbb)
    ENDIF (TBB_FOUND)

    IF (VSMC_OPENMP_FOUND)
        MESSAGE (STATUS "Enable OpenMP")
        SET (SMP_EXECUTABLES ${SMP_EXECUTABLES} omp)
        ADD_CUSTOM_TARGET (buildomp)
    ENDIF (VSMC_OPENMP_FOUND)

    IF (CILK_FOUND)
        MESSAGE (STATUS "Enable Intel Cilk Plus")
        SET (SMP_EXECUTABLES ${SMP_EXECUTABLES} cilk)
        ADD_CUSTOM_TARGET (buildcilk)
    ENDIF (CILK_FOUND)

    IF (VSMC_GCD_FOUND)
        MESSAGE (STATUS "Enable Apple Grand Central Dispatch")
        SET (SMP_EXECUTABLES ${SMP_EXECUTABLES} gcd)
        ADD_CUSTOM_TARGET (buildgcd)
    ENDIF (VSMC_GCD_FOUND)

    IF (VSMC_PPL_FOUND)
        MESSAGE (STATUS "Enable Microsoft Parallel Pattern Library")
        SET (SMP_EXECUTABLES ${SMP_EXECUTABLES} ppl)
        ADD_CUSTOM_TARGET (buildppl)
    ENDIF (VSMC_PPL_FOUND)

    IF (VSMC_STDTBB_FOUND)
        MESSAGE (STATUS "Enable C++11 concurrency")
        SET (SMP_EXECUTABLES ${SMP_EXECUTABLES} std)
        ADD_CUSTOM_TARGET (buildstd)
    ENDIF (VSMC_STDTBB_FOUND)

    IF (VSMC_OPENCL_FOUND)
        MESSAGE (STATUS "Enable OpenCL")
    ENDIF (VSMC_OPENCL_FOUND)

    IF (VSMC_MPI_FOUND)
        MESSAGE (STATUS "Enable MPI")
    ENDIF (VSMC_MPI_FOUND)

    IF (VSMC_FUTURE_FOUND)
        MESSAGE (STATUS "Enable C++11 <future>")
    ELSEIF (VSMC_THREAD_FOUND)
        MESSAGE (STATUS "Enable C++11 <thread>")
    ENDIF (VSMC_FUTURE_FOUND)

    IF (VSMC_TUPLE_FOUND)
        MESSAGE (STATUS "Enable C++11 <tuple>")
    ENDIF (VSMC_TUPLE_FOUND)

    IF (VSMC_CHRONO_FOUND)
        MESSAGE (STATUS "Enable C++11 <chrono>")
    ENDIF (VSMC_CHRONO_FOUND)

    MESSAGE (STATUS "Build example")
    ADD_CUSTOM_TARGET (buildexample)
    ADD_SUBDIRECTORY (vSMCExample EXCLUDE_FROM_ALL)
ENDIF (VSMC_FUNCTIONAL_FOUND AND VSMC_RANDOM_FOUND)
<commit_msg>add 1.55 to boost additional versions<commit_after>CMAKE_MINIMUM_REQUIRED (VERSION 2.8)

# Disable in source build
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
    MESSAGE(FATAL_ERROR "In-source builds not allowed. Please make a new directory and run CMake from there.")
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})

PROJECT (vSMC C CXX)

# User configurations
IF (EXISTS ${PROJECT_SOURCE_DIR}/user_options.cmake)
    INCLUDE (${PROJECT_SOURCE_DIR}/user_options.cmake)
ENDIF (EXISTS ${PROJECT_SOURCE_DIR}/user_options.cmake)

# Options
OPTION (VSMC_ENABLE_EXAMPLE             "Enable building examples"  ON)
OPTION (VSMC_ENABLE_CXX11LIB_CHRONO     "Enable C++11 <chrono>"     ON)
OPTION (VSMC_ENABLE_CXX11LIB_FUNCTIONAL "Enable C++11 <functional>" ON)
OPTION (VSMC_ENABLE_CXX11LIB_RANDOM     "Enable C++11 <random>"     ON)
OPTION (VSMC_ENABLE_CXX11LIB_THREAD     "Enable C++11 <thread>"     ON)
OPTION (VSMC_ENABLE_CXX11LIB_TUPLE      "Enable C++11 <tuple>"      ON)
OPTION (VSMC_ENABLE_CXX11LIB_FUTURE     "Enable C++11 <future>"     OFF)
OPTION (VSMC_ENABLE_MPI                 "Enable MPI"                OFF)

# Configuration files
FILE (READ ${PROJECT_SOURCE_DIR}/README.markdown README)
SET (DOC_SOURCE  ${PROJECT_SOURCE_DIR}/doc)
SET (DOC_INCLUDE ${PROJECT_SOURCE_DIR}/include)
CONFIGURE_FILE (
    ${PROJECT_SOURCE_DIR}/Doxyfile.in
    ${PROJECT_BINARY_DIR}/Doxyfile)
CONFIGURE_FILE (
    ${PROJECT_SOURCE_DIR}/doc/main.markdown.in
    ${PROJECT_SOURCE_DIR}/doc/main.markdown)

IF (NOT VSMC_INSTALL_INC_DIR)
    SET (VSMC_INSTALL_INC_DIR include)
ENDIF (NOT VSMC_INSTALL_INC_DIR)

# Installation
INSTALL (FILES include/vsmc.hpp DESTINATION ${VSMC_INSTALL_INC_DIR})
INSTALL (DIRECTORY include/vsmc/ DESTINATION ${VSMC_INSTALL_INC_DIR}/vsmc
    PATTERN ".DS_Store" EXCLUDE PATTERN "*.swp" EXCLUDE)

# Documentations
INCLUDE (FindDoxygen)
FILE (GLOB_RECURSE DOC_SOURCE_FILES      ${PROJECT_SOURCE_DIR}/doc/*.*)
FILE (GLOB_RECURSE DOC_INCLUDE_FILES_C   ${PROJECT_SOURCE_DIR}/include/*.h)
FILE (GLOB_RECURSE DOC_INCLUDE_FILES_CPP ${PROJECT_SOURCE_DIR}/include/*.hpp)
IF (DOXYGEN_FOUND)
    ADD_CUSTOM_COMMAND (
        OUTPUT  ${PROJECT_BINARY_DIR}/doc
        DEPENDS ${PROJECT_BINARY_DIR}/Doxyfile
        ${DOC_SOURCE_FILES} ${DOC_INCLUDE_FILES_C} ${DOC_INCLUDE_FILES_CPP}
        WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
        COMMAND ${DOXYGEN_EXECUTABLE} ARGS Doxyfile)
    ADD_CUSTOM_TARGET(docs DEPENDS ${PROJECT_BINARY_DIR}/doc)
ENDIF (DOXYGEN_FOUND)

# Finish here if we disable example
IF (NOT VSMC_ENABLE_EXAMPLE)
    RETURN ()
ENDIF (NOT VSMC_ENABLE_EXAMPLE)

# Module path and vSMC cmake functions
SET (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
INCLUDE (vSMCFunctions)

# Required Includes
SET (VSMC_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
SET (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${VSMC_INCLUDE_DIR})
INCLUDE_DIRECTORIES (${VSMC_INCLUDE_DIR})

# Boost
SET (Boost_NO_BOOST_CMAKE ON)
SET (Boost_ADDITIONAL_VERSIONS
    "1.49" "1.49.0"
    "1.50" "1.50.0"
    "1.51" "1.51.0"
    "1.52" "1.52.0"
    "1.53" "1.53.0"
    "1.54" "1.54.0"
    "1.55" "1.55.0")
IF (NOT Boost_FOUND)
    INCLUDE (FindBoost)
ENDIF (NOT Boost_FOUND)
IF (Boost_FOUND)
    INCLUDE_DIRECTORIES (SYSTEM ${Boost_INCLUDE_DIRS})
    SET (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES}
        ${Boost_INCLUDE_DIRS})
ENDIF (Boost_FOUND)

# C++11 libs flags
INCLUDE (vSMCFindFunctional)
IF (VSMC_FUNCTIONAL_STD_FOUND)
    ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_FUNCTIONAL=1)
    SET (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
        -DVSMC_HAS_CXX11LIB_FUNCTIONAL=1)
ELSE (VSMC_FUNCTIONAL_STD_FOUND)
    ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_FUNCTIONAL=0)
    SET (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
        -DVSMC_HAS_CXX11LIB_FUNCTIONAL=0)
ENDIF (VSMC_FUNCTIONAL_STD_FOUND)

INCLUDE (vSMCFindRandom)
IF (VSMC_RANDOM_STD_FOUND)
    ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_RANDOM=1)
    SET (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
        -DVSMC_HAS_CXX11LIB_RANDOM=1)
ELSE (VSMC_RANDOM_STD_FOUND)
    ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_RANDOM=0)
    SET (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
        -DVSMC_HAS_CXX11LIB_RANDOM=0)
ENDIF (VSMC_RANDOM_STD_FOUND)
IF (VSMC_RANDOM123_FOUND)
    INCLUDE_DIRECTORIES (${Random123_INCLUDE_DIR})
    ADD_DEFINITIONS (-DVSMC_USE_RANDOM123=1)
ELSE (VSMC_RANDOM123_FOUND)
    ADD_DEFINITIONS (-DVSMC_USE_RANDOM123=0)
ENDIF (VSMC_RANDOM123_FOUND)

IF (VSMC_FUNCTIONAL_FOUND AND VSMC_RANDOM_FOUND)
    INCLUDE (vSMCFindSTDTBB)
    IF (VSMC_STDTBB_FOUND)
        SET (VSMC_USE_STD TRUE)
        IF (VSMC_FUTURE_FOUND)
            ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_FUTURE=1)
        ELSE (VSMC_FUTURE_FOUND)
            ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_FUTURE=0)
        ENDIF (VSMC_FUTURE_FOUND)
    ELSE (VSMC_STDTBB_FOUND)
        SET (VSMC_USE_STD FALSE)
    ENDIF (VSMC_STDTBB_FOUND)

    INCLUDE (vSMCFindTuple)

    # Third-patry features
    IF (${CMAKE_CXX_COMPILER_ID} MATCHES "Intel")
        INCLUDE (FindCilk)
    ENDIF (${CMAKE_CXX_COMPILER_ID} MATCHES "Intel")

    INCLUDE (vSMCFindGCD)
    IF (VSMC_GCD_FOUND)
        INCLUDE_DIRECTORIES (SYSTEM ${GCD_INCLUDE_DIR})
    ENDIF (VSMC_GCD_FOUND)

    IF (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
        INCLUDE (vSMCFindOpenMP)
    ENDIF (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")

    IF (NOT DEFINED VSMC_PPL_FOUND)
        IF (MSVC_VERSION GREATER 1599)
            MESSAGE (STATUS "Found Microsoft PPL support")
            SET (VSMC_PPL_FOUND TRUE CACHE BOOL "Found PPL")
        ELSE (MSVC_VERSION GREATER 1599)
            SET (VSMC_PPL_FOUND FALSE CACHE BOOL "NOT Found PPL")
        ENDIF (MSVC_VERSION GREATER 1599)
    ENDIF (NOT DEFINED VSMC_PPL_FOUND)

    INCLUDE (FindTBB)
    IF (TBB_FOUND)
        INCLUDE_DIRECTORIES (SYSTEM ${TBB_INCLUDE_DIR})
        ADD_DEFINITIONS (${TBB_DEFINITIONS})
    ENDIF (TBB_FOUND)

    INCLUDE (vSMCFindOpenCL)
    IF (VSMC_OPENCL_FOUND)
        INCLUDE_DIRECTORIES (SYSTEM ${OpenCL_INCLUDE_DIR})
        SET (VSMC_CL_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
    ENDIF (VSMC_OPENCL_FOUND)

    IF (VSMC_ENABLE_MPI)
        INCLUDE (vSMCFindMPI)
    ENDIF (VSMC_ENABLE_MPI)
    IF (VSMC_MPI_FOUND)
        INCLUDE_DIRECTORIES (SYSTEM ${MPI_CXX_INCLUDE_PATH})
    ENDIF (VSMC_MPI_FOUND)

    # Timing
    INCLUDE (vSMCFindChrono)
    IF (VSMC_CHRONO_FOUND)
        ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_CHRONO=1)
    ELSE (VSMC_CHRONO_FOUND)
        ADD_DEFINITIONS (-DVSMC_HAS_CXX11LIB_CHRONO=0)
    ENDIF (VSMC_CHRONO_FOUND)

    IF (UNIX AND NOT APPLE)
        UNSET (LINUX_LIBRT CACHE)
        FIND_LIBRARY (LINUX_LIBRT rt)
        IF (NOT LINUX_LIBRT)
            ADD_DEFINITIONS (-DVSMC_HAS_NATIVE_TIME_LIBRARY=0)
        ENDIF (NOT LINUX_LIBRT)
    ENDIF (UNIX AND NOT APPLE)

    # Special math functions
    INCLUDE (FindCXXMathLgamma)
    IF (CXX_MATH_LGAMMA_C99_FOUND)
        ADD_DEFINITIONS (-DVSMC_USE_C99_LGAMMA=1)
    ELSEIF (CXX_MATH_LGAMMA_STD_FOUND)
        ADD_DEFINITIONS (-DVSMC_USE_STD_LGAMMA=1)
    ELSEIF (CXX_MATH_LGAMMA_BOOST_FOUND)
        ADD_DEFINITIONS (-DVSMC_USE_BOOST_LGAMMA=1)
    ENDIF (CXX_MATH_LGAMMA_C99_FOUND)
    IF (CXX_MATH_LGAMMA_FOUND)
        ADD_DEFINITIONS (-DVSMC_HAS_LGAMMA=1)
    ENDIF (CXX_MATH_LGAMMA_FOUND)

    # Make sure __STDC_CONSTANT_MACROS is defined
    ADD_DEFINITIONS (-D__STDC_CONSTANT_MACROS)

    # Workaround for vanilla GCC on Mac OS X
    IF (APPLE)
        ADD_DEFINITIONS (-U__OBJC__)
        ADD_DEFINITIONS (-U__OBJC2__)
    ENDIF (APPLE)

    # Disable MSVC iterator warning. Callers are responsible for checking bounds!
    IF (MSVC)
        ADD_DEFINITIONS (-D_SCL_SECURE_NO_WARNINGS)
    ENDIF (MSVC)

    # SMP backends
    MESSAGE (STATUS "Enable Sequential")
    SET (SMP_EXECUTABLES seq)
    ADD_CUSTOM_TARGET (buildseq)

    IF (TBB_FOUND)
        MESSAGE (STATUS "Enable Intel Threading Building Blocks")
        SET (SMP_EXECUTABLES ${SMP_EXECUTABLES} tbb)
        ADD_CUSTOM_TARGET (buildtbb)
    ENDIF (TBB_FOUND)

    IF (VSMC_OPENMP_FOUND)
        MESSAGE (STATUS "Enable OpenMP")
        SET (SMP_EXECUTABLES ${SMP_EXECUTABLES} omp)
        ADD_CUSTOM_TARGET (buildomp)
    ENDIF (VSMC_OPENMP_FOUND)

    IF (CILK_FOUND)
        MESSAGE (STATUS "Enable Intel Cilk Plus")
        SET (SMP_EXECUTABLES ${SMP_EXECUTABLES} cilk)
        ADD_CUSTOM_TARGET (buildcilk)
    ENDIF (CILK_FOUND)

    IF (VSMC_GCD_FOUND)
        MESSAGE (STATUS "Enable Apple Grand Central Dispatch")
        SET (SMP_EXECUTABLES ${SMP_EXECUTABLES} gcd)
        ADD_CUSTOM_TARGET (buildgcd)
    ENDIF (VSMC_GCD_FOUND)

    IF (VSMC_PPL_FOUND)
        MESSAGE (STATUS "Enable Microsoft Parallel Pattern Library")
        SET (SMP_EXECUTABLES ${SMP_EXECUTABLES} ppl)
        ADD_CUSTOM_TARGET (buildppl)
    ENDIF (VSMC_PPL_FOUND)

    IF (VSMC_STDTBB_FOUND)
        MESSAGE (STATUS "Enable C++11 concurrency")
        SET (SMP_EXECUTABLES ${SMP_EXECUTABLES} std)
        ADD_CUSTOM_TARGET (buildstd)
    ENDIF (VSMC_STDTBB_FOUND)

    IF (VSMC_OPENCL_FOUND)
        MESSAGE (STATUS "Enable OpenCL")
    ENDIF (VSMC_OPENCL_FOUND)

    IF (VSMC_MPI_FOUND)
        MESSAGE (STATUS "Enable MPI")
    ENDIF (VSMC_MPI_FOUND)

    IF (VSMC_FUTURE_FOUND)
        MESSAGE (STATUS "Enable C++11 <future>")
    ELSEIF (VSMC_THREAD_FOUND)
        MESSAGE (STATUS "Enable C++11 <thread>")
    ENDIF (VSMC_FUTURE_FOUND)

    IF (VSMC_TUPLE_FOUND)
        MESSAGE (STATUS "Enable C++11 <tuple>")
    ENDIF (VSMC_TUPLE_FOUND)

    IF (VSMC_CHRONO_FOUND)
        MESSAGE (STATUS "Enable C++11 <chrono>")
    ENDIF (VSMC_CHRONO_FOUND)

    MESSAGE (STATUS "Build example")
    ADD_CUSTOM_TARGET (buildexample)
    ADD_SUBDIRECTORY (vSMCExample EXCLUDE_FROM_ALL)
ENDIF (VSMC_FUNCTIONAL_FOUND AND VSMC_RANDOM_FOUND)

{'fraction_non_alphanumeric': 0.08693881706199735, 'fraction_numerical': 0.0167973124300112, 'mean_word_length': 3.948866498740554, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '54058', 'n_tokens_mistral': 8558, 'n_tokens_neox': 7883, 'n_words': 1425}