<commit_before>cmake_minimum_required(VERSION 3.6.0)

#preventing in source build
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
        message( FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt." )
    endif()

#compile database
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )

#including utils function, this will cascade to all subsequent included cmakes
include (cmakeutils/code_gen.txt)

#setupping clang tidy
init_clang_tidy()

SET(MAIN_LIB_NAME "babycpp")

#enable c++ 17
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

#check the compiler
MESSAGE(STATUS "compiler id ${CMAKE_CXX_COMPILER_ID} ${MSVC}")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  # using Clang
  set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -g3 -O0 -Wall -pedantic -Wextra -m64 -mavx2 -mfma -ffast-math -fno-exception")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  # using GCC
  set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS}   -Wall -pedantic -Wextra -m64 -mavx2 -mfma -ffast-math")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
  # using Intel C++
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
  # using Visual Studio C++
  set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS}  /std:c++14 /W4 /arch:AVX2 /fp:fast")
endif()

find_package(LLVM REQUIRED CONFIG)
#options
option(BUILD_TESTS "Wheter or not to build the tests" ON)
option(BUILD_JIT   "Wheter or not to build the jit engine" ON)
option(BUILD_REPL  "Wheter or not to build the interpreter" ON)

message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")

#just an overal log of the passed options
MESSAGE( STATUS "LLVM PATH :                   " ${LLVM_DIR})
MESSAGE( STATUS "Building with the following options")
MESSAGE( STATUS "BUILD JIT:                    " ${BUILD_JIT})
MESSAGE( STATUS "BUILD REPL:                   " ${BUILD_REPL})
MESSAGE( STATUS "BUILD TESTS:                  " ${BUILD_TESTS})<commit_msg>fixed typo in cmake<commit_after>cmake_minimum_required(VERSION 3.6.0)

#preventing in source build
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
        message( FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt." )
    endif()

#compile database
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )

#including utils function, this will cascade to all subsequent included cmakes
include (cmakeutils/code_gen.txt)

#setupping clang tidy
init_clang_tidy()

SET(MAIN_LIB_NAME "babycpp")

#enable c++ 17
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

#check the compiler
MESSAGE(STATUS "compiler id ${CMAKE_CXX_COMPILER_ID} ${MSVC}")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  # using Clang
  set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -g3 -O0 -Wall -pedantic -Wextra -m64 -mavx2 -mfma -ffast-math -fno-exception")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  # using GCC
  set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS}   -Wall -pedantic -Wextra -m64 -mavx2 -mfma -ffast-math")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
  # using Intel C++
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
  # using Visual Studio C++
  set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS}  /std:c++14 /W4 /arch:AVX2 /fp:fast")
endif()

find_package(LLVM REQUIRED CONFIG)
#options
option(BUILD_TESTS "Whether or not to build the tests" ON)
option(BUILD_JIT   "Whether or not to build the jit engine" ON)
option(BUILD_REPL  "Whether or not to build the interpreter" ON)

message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")

#just an overal log of the passed options
MESSAGE( STATUS "LLVM PATH :                   " ${LLVM_DIR})
MESSAGE( STATUS "Building with the following options")
MESSAGE( STATUS "BUILD JIT:                    " ${BUILD_JIT})
MESSAGE( STATUS "BUILD REPL:                   " ${BUILD_REPL})
MESSAGE( STATUS "BUILD TESTS:                  " ${BUILD_TESTS})
{'fraction_non_alphanumeric': 0.11028172405490007, 'fraction_numerical': 0.009150012039489525, 'mean_word_length': 4.598382749326146, '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': '7098279', 'n_tokens_mistral': 1572, 'n_tokens_neox': 1476, 'n_words': 420}