<commit_before>CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
GET_FILENAME_COMPONENT(SF1RENGINE_ROOT "${CMAKE_SOURCE_DIR}" PATH)

##################################################
# Find extra cmake modules dirs
#
# You can clone all modules from https://ssl.izenesoft.cn/projects/cmake
#
# Clone it and set environment variable EXTRA_CMAKE_MODULES_DIRS point to it.
#
SET(ENV_EXTRA_CMAKE_MODULES_DIRS $ENV{EXTRA_CMAKE_MODULES_DIRS})
IF(ENV_EXTRA_CMAKE_MODULES_DIRS)
  SET(EXTRA_CMAKE_MODULES_DIRS ${EXTRA_CMAKE_MODULES_DIRS} ${ENV_EXTRA_CMAKE_MODULES_DIRS})
ENDIF(ENV_EXTRA_CMAKE_MODULES_DIRS)
IF(NOT EXTRA_CMAKE_MODULES_DIRS)
  MESSAGE(FATAL_ERROR
    "Cannot find EXTRA_CMAKE_MODULES_DIRS.
1. Please clone it from https://ssl.izenesoft.cn/cmake.
2. Then set EXTRA_CMAKE_MODULES_DIRS through environment variable

       export EXTRA_CMAKE_MODULES_DIRS=/path/to/cmake

   You can put it in your .bashrc so it is loaded automatically.

   or cmake options

       cmake  -DEXTRA_CMAKE_MODULES_DIRS=/path/to/cmake (other options)
")
ENDIF(NOT EXTRA_CMAKE_MODULES_DIRS)
SET(CMAKE_MODULE_PATH ${EXTRA_CMAKE_MODULES_DIRS})

# force out-of-source build
IF (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
  MESSAGE(FATAL_ERROR "In source build is not allowed")
ENDIF (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)

##################################################
# Project and some options
#####
PROJECT(sf1r-engine)
OPTION(VERBOSE "print detailed configure messages" ON)
OPTION(ENABLE_TEST "build test applications?" ON)
IF(ENABLE_TEST)
  ENABLE_TESTING()
ENDIF(ENABLE_TEST)

# Check the mode
IF( NOT MODE )
    MESSAGE( STATUS "Set Default Mode to MULTI")
    SET( MODE "MULTI")
ENDIF( NOT MODE )


STRING(TOUPPER ${MODE} UPPER_MODE)
IF( ${UPPER_MODE} STREQUAL "CN" )
    SET( USE_IZENECMA TRUE )
    SET( USE_WISEKMA FALSE )
    MESSAGE( STATUS "CN mode: uses iCMA.")
ELSEIF( ${UPPER_MODE} STREQUAL "KR" )
    SET( USE_IZENECMA FALSE )
    SET( USE_WISEKMA TRUE)
    MESSAGE( STATUS "KR mode: uses KMA")
ELSEIF( ${UPPER_MODE} STREQUAL "MULTI" )
    SET( USE_IZENECMA TRUE )
    SET( USE_IISE FALSE )
    SET( USE_WISEKMA TRUE)
    SET( USE_IZENEJMA TRUE)
    MESSAGE( STATUS "MULTI mode: uses iCMA ,iJMA and KMA." )
ELSE( ${UPPER_MODE} STREQUAL "CN" )
    MESSAGE( FATAL_ERROR "Invalid parameter mode: ${MODE}, should be one of CN, KR and MULTI")
ENDIF( ${UPPER_MODE} STREQUAL "CN" )

##################################################
# BUILD TYPE & OPTIONS
#
# Put this section just under PROJECT
#####

# License Check
IF (LICENSE_LEVEL)
    STRING(TOUPPER ${LICENSE_LEVEL} UPPER_LICENSE_LEVEL)
ENDIF (LICENSE_LEVEL)

IF (LICENSE_LEVEL)
    ADD_DEFINITIONS( -DEXIST_LICENSE )
ENDIF (LICENSE_LEVEL)

IF (UPPER_LICENSE_LEVEL STREQUAL "COBRA")
    SET(LICENSE_FLAGS "-DLICENSE_MAX_DOC=10000"   "-DLICENSE_MAX_SIZE=1"   CACHE STRING "Flags of cobra license." FORCE)
ELSEIF (UPPER_LICENSE_LEVEL STREQUAL "SILVER")
    SET(LICENSE_FLAGS "-DLICENSE_MAX_DOC=100000"  "-DLICENSE_MAX_SIZE=10"  CACHE STRING "Flags of silver license." FORCE)
ELSEIF (UPPER_LICENSE_LEVEL STREQUAL "GOLD")
    SET(LICENSE_FLAGS "-DLICENSE_MAX_DOC=1000000" "-DLICENSE_MAX_SIZE=100" CACHE STRING "Flags of gold license." FORCE)
ELSEIF (UPPER_LICENSE_LEVEL STREQUAL "PLATINUM")
    SET(LICENSE_FLAGS "-DLICENSE_MAX_DOC=500000000" "-DLICENSE_MAX_SIZE=50000" CACHE STRING "Flags of platinum license." FORCE)
ELSEIF (UPPER_LICENSE_LEVEL STREQUAL "MAX_SIZE_TEST")
    SET(LICENSE_FLAGS "-DLICENSE_MAX_DOC=500000000" "-DLICENSE_MAX_SIZE=1" CACHE STRING "Flags of max_size_test license." FORCE)
ELSEIF (UPPER_LICENSE_LEVEL STREQUAL "MAX_DOC_TEST")
    SET(LICENSE_FLAGS "-DLICENSE_MAX_DOC=1000" "-DLICENSE_MAX_SIZE=5000" CACHE STRING "Flags of max_doc_test license." FORCE)
ELSE (UPPER_LICENSE_LEVEL STREQUAL "COBRA")
    SET(UPPER_LICENSE_LEVEL "DEV-LICENSE")
    SET(LICENSE_FLAGS "-DLICENSE_MAX_DOC=500000000" "-DLICENSE_MAX_SIZE=50000" CACHE STRING "Flags of development license." FORCE)
ENDIF (UPPER_LICENSE_LEVEL STREQUAL "COBRA")
ADD_DEFINITIONS( ${LICENSE_FLAGS} )

# Use BUILD_FLAGS_HAS_BEEN_CUSTOMIZED as guard.
#
# The options are only customized in first run. User can edit cache to
# set their own options. If it's required to customized these in cmake
# command line options, please also add
# "-DBUILD_FLAGS_HAS_BEEN_CUSTOMIZED".
IF (CMAKE_COMPILER_IS_GNUCXX)
  INCLUDE(MacroSetBuildTypes)

  MACRO_SET_BUILD_TYPES(
    RelWithDebInfo
    "-march=native -mtune=native -fopenmp -O0 -g -Wno-deprecated -DNDEBUG"
    "Flags used by the compiler during Release with Debug Info builds."

    Release
    "-march=native -mtune=native -fopenmp -O3 -Wno-deprecated -DNDEBUG"
    "Flags used by the compiler during release builds"

    MinSizeRel
    "-march=native -mtune=native -fopenmp -Os -Wno-deprecated -DNDEBUG"
    "Flags used by the compiler during release minsize builds."

    Debug
    "-march=native -mtune=native -fopenmp -g -O0 -fno-reorder-blocks -fno-schedule-insns -fno-inline -Wno-deprecated"
    "Flags used by the compiler during debug builds."

    Profile
    "-march=native -mtune=native -fopenmp -g3 -fno-inline -ftest-coverage -fprofile-arcs -Wno-deprecated"
    "Profile build type"

    SF1DEBUG
    "-march=native -mtune=native -fopenmp -O3 -g -Wno-deprecated -DSF1_DEBUG"
    "Sf1 Debug build type"

    SF1TIMECHECK
    "-march=native -mtune=native -fopenmp -O3 -DNDEBUG -g -Wno-deprecated -DSF1_TIME_CHECK"
    "Sf1 time check build type"

    SF1PCHECK
    "-march=native -mtune=native -fopenmp -O3 -Wno-deprecated -DNDEBUG -DSF1_TIME_CHECK"<commit_msg>revert cmake file<commit_after>CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
GET_FILENAME_COMPONENT(SF1RENGINE_ROOT "${CMAKE_SOURCE_DIR}" PATH)

##################################################
# Find extra cmake modules dirs
#
# You can clone all modules from https://ssl.izenesoft.cn/projects/cmake
#
# Clone it and set environment variable EXTRA_CMAKE_MODULES_DIRS point to it.
#
SET(ENV_EXTRA_CMAKE_MODULES_DIRS $ENV{EXTRA_CMAKE_MODULES_DIRS})
IF(ENV_EXTRA_CMAKE_MODULES_DIRS)
  SET(EXTRA_CMAKE_MODULES_DIRS ${EXTRA_CMAKE_MODULES_DIRS} ${ENV_EXTRA_CMAKE_MODULES_DIRS})
ENDIF(ENV_EXTRA_CMAKE_MODULES_DIRS)
IF(NOT EXTRA_CMAKE_MODULES_DIRS)
  MESSAGE(FATAL_ERROR
    "Cannot find EXTRA_CMAKE_MODULES_DIRS.
1. Please clone it from https://ssl.izenesoft.cn/cmake.
2. Then set EXTRA_CMAKE_MODULES_DIRS through environment variable

       export EXTRA_CMAKE_MODULES_DIRS=/path/to/cmake

   You can put it in your .bashrc so it is loaded automatically.

   or cmake options

       cmake  -DEXTRA_CMAKE_MODULES_DIRS=/path/to/cmake (other options)
")
ENDIF(NOT EXTRA_CMAKE_MODULES_DIRS)
SET(CMAKE_MODULE_PATH ${EXTRA_CMAKE_MODULES_DIRS})

# force out-of-source build
IF (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
  MESSAGE(FATAL_ERROR "In source build is not allowed")
ENDIF (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)

##################################################
# Project and some options
#####
PROJECT(sf1r-engine)
OPTION(VERBOSE "print detailed configure messages" ON)
OPTION(ENABLE_TEST "build test applications?" ON)
IF(ENABLE_TEST)
  ENABLE_TESTING()
ENDIF(ENABLE_TEST)

# Check the mode
IF( NOT MODE )
    MESSAGE( STATUS "Set Default Mode to MULTI")
    SET( MODE "MULTI")
ENDIF( NOT MODE )


STRING(TOUPPER ${MODE} UPPER_MODE)
IF( ${UPPER_MODE} STREQUAL "CN" )
    SET( USE_IZENECMA TRUE )
    SET( USE_WISEKMA FALSE )
    MESSAGE( STATUS "CN mode: uses iCMA.")
ELSEIF( ${UPPER_MODE} STREQUAL "KR" )
    SET( USE_IZENECMA FALSE )
    SET( USE_WISEKMA TRUE)
    MESSAGE( STATUS "KR mode: uses KMA")
ELSEIF( ${UPPER_MODE} STREQUAL "MULTI" )
    SET( USE_IZENECMA TRUE )
    SET( USE_IISE FALSE )
    SET( USE_WISEKMA TRUE)
    SET( USE_IZENEJMA TRUE)
    MESSAGE( STATUS "MULTI mode: uses iCMA ,iJMA and KMA." )
ELSE( ${UPPER_MODE} STREQUAL "CN" )
    MESSAGE( FATAL_ERROR "Invalid parameter mode: ${MODE}, should be one of CN, KR and MULTI")
ENDIF( ${UPPER_MODE} STREQUAL "CN" )

##################################################
# BUILD TYPE & OPTIONS
#
# Put this section just under PROJECT
#####

# License Check
IF (LICENSE_LEVEL)
    STRING(TOUPPER ${LICENSE_LEVEL} UPPER_LICENSE_LEVEL)
ENDIF (LICENSE_LEVEL)

IF (LICENSE_LEVEL)
    ADD_DEFINITIONS( -DEXIST_LICENSE )
ENDIF (LICENSE_LEVEL)

IF (UPPER_LICENSE_LEVEL STREQUAL "COBRA")
    SET(LICENSE_FLAGS "-DLICENSE_MAX_DOC=10000"   "-DLICENSE_MAX_SIZE=1"   CACHE STRING "Flags of cobra license." FORCE)
ELSEIF (UPPER_LICENSE_LEVEL STREQUAL "SILVER")
    SET(LICENSE_FLAGS "-DLICENSE_MAX_DOC=100000"  "-DLICENSE_MAX_SIZE=10"  CACHE STRING "Flags of silver license." FORCE)
ELSEIF (UPPER_LICENSE_LEVEL STREQUAL "GOLD")
    SET(LICENSE_FLAGS "-DLICENSE_MAX_DOC=1000000" "-DLICENSE_MAX_SIZE=100" CACHE STRING "Flags of gold license." FORCE)
ELSEIF (UPPER_LICENSE_LEVEL STREQUAL "PLATINUM")
    SET(LICENSE_FLAGS "-DLICENSE_MAX_DOC=500000000" "-DLICENSE_MAX_SIZE=50000" CACHE STRING "Flags of platinum license." FORCE)
ELSEIF (UPPER_LICENSE_LEVEL STREQUAL "MAX_SIZE_TEST")
    SET(LICENSE_FLAGS "-DLICENSE_MAX_DOC=500000000" "-DLICENSE_MAX_SIZE=1" CACHE STRING "Flags of max_size_test license." FORCE)
ELSEIF (UPPER_LICENSE_LEVEL STREQUAL "MAX_DOC_TEST")
    SET(LICENSE_FLAGS "-DLICENSE_MAX_DOC=1000" "-DLICENSE_MAX_SIZE=5000" CACHE STRING "Flags of max_doc_test license." FORCE)
ELSE (UPPER_LICENSE_LEVEL STREQUAL "COBRA")
    SET(UPPER_LICENSE_LEVEL "DEV-LICENSE")
    SET(LICENSE_FLAGS "-DLICENSE_MAX_DOC=500000000" "-DLICENSE_MAX_SIZE=50000" CACHE STRING "Flags of development license." FORCE)
ENDIF (UPPER_LICENSE_LEVEL STREQUAL "COBRA")
ADD_DEFINITIONS( ${LICENSE_FLAGS} )

# Use BUILD_FLAGS_HAS_BEEN_CUSTOMIZED as guard.
#
# The options are only customized in first run. User can edit cache to
# set their own options. If it's required to customized these in cmake
# command line options, please also add
# "-DBUILD_FLAGS_HAS_BEEN_CUSTOMIZED".
IF (CMAKE_COMPILER_IS_GNUCXX)
  INCLUDE(MacroSetBuildTypes)

  MACRO_SET_BUILD_TYPES(
    RelWithDebInfo
    "-march=native -mtune=native -fopenmp -O2 -g -Wno-deprecated -DNDEBUG"
    "Flags used by the compiler during Release with Debug Info builds."

    Release
    "-march=native -mtune=native -fopenmp -O3 -Wno-deprecated -DNDEBUG"
    "Flags used by the compiler during release builds"

    MinSizeRel
    "-march=native -mtune=native -fopenmp -Os -Wno-deprecated -DNDEBUG"
    "Flags used by the compiler during release minsize builds."

    Debug
    "-march=native -mtune=native -fopenmp -g -O0 -fno-reorder-blocks -fno-schedule-insns -fno-inline -Wno-deprecated"
    "Flags used by the compiler during debug builds."

    Profile
    "-march=native -mtune=native -fopenmp -g3 -fno-inline -ftest-coverage -fprofile-arcs -Wno-deprecated"
    "Profile build type"

    SF1DEBUG
    "-march=native -mtune=native -fopenmp -O3 -g -Wno-deprecated -DSF1_DEBUG"
    "Sf1 Debug build type"

    SF1TIMECHECK
    "-march=native -mtune=native -fopenmp -O3 -DNDEBUG -g -Wno-deprecated -DSF1_TIME_CHECK"
    "Sf1 time check build type"

    SF1PCHECK
    "-march=native -mtune=native -fopenmp -O3 -Wno-deprecated -DNDEBUG -DSF1_TIME_CHECK"
{'fraction_non_alphanumeric': 0.11976911976911978, 'fraction_numerical': 0.016414141414141416, 'mean_word_length': 4.952227589908749, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 6, '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': '2933310', 'n_tokens_mistral': 4285, 'n_tokens_neox': 4050, 'n_words': 1003}