<commit_before>CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)

foreach(flag_var
        CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
        CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
   message(STATUS "flag_var: ${flag_var}")
   if(${flag_var} MATCHES "/MD")
      string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
   endif(${flag_var} MATCHES "/MD")
   
   if(${flag_var} MATCHES "_DLL")
      string(REGEX REPLACE "_DLL" "" ${flag_var} "${${flag_var}}")
   endif(${flag_var} MATCHES "_DLL")
endforeach(flag_var)

set(CMAKE_USER_MAKE_RULES_OVERRIDE
   ${CMAKE_SOURCE_DIR}/cmake/c_flag_overrides.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
   ${CMAKE_SOURCE_DIR}/cmake/cxx_flag_overrides.cmake)
   
SET(CMAKE_BUILD_TYPE $ENV{BUILD_TYPE})
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")

PROJECT("osIROSE")

LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

INCLUDE(OsIROSECMakeTools)
INCLUDE(FindLua)
INCLUDE(FindProtocolBuffer)

SET(VERSION_MAJOR 1)
SET(VERSION_MINOR 2)
SET(VERSION_PATCH 0)
SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")

# Evaluate ABI version number.
MATH(EXPR PROJECT_ABI_VERSION_SUFFIX "${VERSION_MAJOR} * 10000 + ${VERSION_MINOR} * 100 + ${VERSION_PATCH} * 1")

SET(PROJECT_ABI_VERSION v${PROJECT_ABI_VERSION_SUFFIX})

# Create a version file using git data
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
  execute_process(
    COMMAND git rev-parse --abbrev-ref HEAD
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_BRANCH
    OUTPUT_STRIP_TRAILING_WHITESPACE
  )

  execute_process(
    COMMAND git log -1 --format=%h
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_COMMIT_HASH
    OUTPUT_STRIP_TRAILING_WHITESPACE
  )
else()
  set(GIT_BRANCH "")
  set(GIT_COMMIT_HASH "")
endif()

message(STATUS "Git current branch: ${GIT_BRANCH}")
message(STATUS "Git commit hash: ${GIT_COMMIT_HASH}")

message(STATUS "Generating version.h")

configure_file(
  ${CMAKE_SOURCE_DIR}/cmake/version.h.in
  ${CMAKE_BINARY_DIR}/generated/version.h
)
#end version file

SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

OPTION(PROJECT_DEBUG 
  "Enable debugging messages support" ON)
OPTION(ENABLE_TESTING 
  "Enable testing" OFF)
OPTION(ENABLE_TESTING_COVERAGE, 
  "Enable generating code coverage report" OFF)
OPTION(BUILD_TOOLS 
  "Build server tools" ON)
OPTION(BUILD_PROTOBUF 
  "Build Protobuf (Leave this off)" OFF)
OPTION(BUILD_API_DOC
  "Build doxygen documentation" OFF)
OPTION(ENABLE_MYSQL_ONE_INSTANCE 
	"Enable use of the single instance mysql database" ON)
OPTION(ENABLE_EXPERMENTAL
  "Enable expermental features" OFF)
OPTION(DISABLE_CRYPT
  "Enable this to not use encryption functions" OFF)
  
SET(BUILD_TYPE "Debug" CACHE STRING "Debug")

IF (BUILD_API_DOC)
  FIND_PACKAGE(Doxygen)
  IF (DOXYGEN_FOUND)
    ADD_SUBDIRECTORY(doc)
  ENDIF (DOXYGEN_FOUND)
ENDIF (BUILD_API_DOC)

IF(ENABLE_MYSQL_ONE_INSTANCE)
  SET(ENABLE_MYSQL ON)
ENDIF()

IF(ENABLE_TESTING)
  enable_testing() #enable ctest
  
  include( CTest )
  INCLUDE( Dart )

	SET(CMAKE_RULE_MESSAGES OFF)	
	IF (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
		#Build GoogleMock
		ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/tools/googletest/googlemock)		
	ELSE()
		#Build GoogleMock
		ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/tools/googletest/googlemock)
		SET(GMOCK_INCLUDE_DIR ${gmock_SOURCE_DIR}/include)
		SET(GMOCK_BINARY_DIR ${gmock_SOURCE_DIR})
		SET(GTEST_INCLUDE_DIR ${gtest_SOURCE_DIR}/include)
		SET(GTEST_BINARY_DIR ${gtest_SOURCE_DIR})
	ENDIF()
	SET(CMAKE_RULE_MESSAGES ON)
ENDIF()

SET(ASIO_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tools/asio/asio/include)
SET(EXTERNAL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/3rdparty/include)
SET(EXTERNAL_BINARY_DIR ${CMAKE_SOURCE_DIR}/3rdparty/lib)
SET(PBJSON_ROOT ${CMAKE_SOURCE_DIR}/tools/pbjson/src)
SET(SPDLOG_ROOT ${CMAKE_SOURCE_DIR}/tools/spdlog/include)
SET(SELENE_ROOT ${CMAKE_SOURCE_DIR}/tools/Selene/include)
SET(SOL2_ROOT ${CMAKE_SOURCE_DIR}/tools/sol2)
SET(LUA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tools/lua/src)
SET(PROTOBUF_ROOT ${CMAKE_BINARY_DIR})
SET(PROTOBUF_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/tools/protobuf/src" CACHE STRING "${CMAKE_SOURCE_DIR}/tools/protobuf/src" FORCE)
SET(MYSQLpp_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/tools/mysqlpp/lib" CACHE STRING "${CMAKE_SOURCE_DIR}/tools/mysqlpp/lib" FORCE)
SET(CXXOPT_ROOT ${CMAKE_SOURCE_DIR}/tools/cxxopts/src)

IF(ENABLE_MYSQL)
  find_package(MySQL REQUIRED)
  #SET(BUILD_MYSQLPP ON CACHE BOOL "" FORCE)
  
  MESSAGE(STATUS "MySQL++ Include Path: ${MYSQLpp_INCLUDE_DIR}")

  configure_file(
    ${MYSQLpp_INCLUDE_DIR}/mysql++.h.in
    ${MYSQLpp_INCLUDE_DIR}/mysql++.h
  )
ENDIF()

IF (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
  SET(GMOCK_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tools/googletest/googlemock/include)
  SET(GMOCK_BINARY_DIR ${gmock_SOURCE_DIR})
  SET(GTEST_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tools/googletest/googletest/include)
  SET(GTEST_BINARY_DIR ${gtest_SOURCE_DIR})
  SET(PROTOBUF_PROTOC_EXECUTABLE "${CMAKE_BINARY_DIR}/bin/${BUILD_TYPE}/protoc.exe" CACHE STRING "${CMAKE_BINARY_DIR}/bin/${BUILD_TYPE}/protoc.exe" FORCE)
  SET(MYSQLpp_LIBRARY_PATH "${CMAKE_BINARY_DIR}/lib/${BUILD_TYPE}/" CACHE STRING "${CMAKE_BINARY_DIR}/lib/${BUILD_TYPE}/" FORCE)
  
  IF (${BUILD_TYPE} STREQUAL Debug)
    SET(PROTOBUF_LIBRARY "${CMAKE_BINARY_DIR}/lib/${BUILD_TYPE}/libprotobufd.lib" CACHE STRING "${CMAKE_BINARY_DIR}/lib/${BUILD_TYPE}/libprotobufd.lib" FORCE)
  ELSE()
    SET(PROTOBUF_LIBRARY "${CMAKE_BINARY_DIR}/lib/${BUILD_TYPE}/libprotobuf.lib" CACHE STRING "${CMAKE_BINARY_DIR}/lib/${BUILD_TYPE}/libprotobuf.lib" FORCE)
  ENDIF()
ELSE()
	#UNIX ONLY SETTINGS
	IF(ENABLE_MYSQL)
		SET(MYSQL_INCLUDE_DIR /usr/include/mysql)
	ENDIF()<commit_msg>Update CMakeLists.txt<commit_after>CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)

foreach(flag_var
        CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
        CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
   message(STATUS "flag_var: ${flag_var}")
   if(${flag_var} MATCHES "/MD")
      string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
   endif(${flag_var} MATCHES "/MD")
   
   if(${flag_var} MATCHES "_DLL")
      string(REGEX REPLACE "_DLL" "" ${flag_var} "${${flag_var}}")
   endif(${flag_var} MATCHES "_DLL")
endforeach(flag_var)

set(CMAKE_USER_MAKE_RULES_OVERRIDE
   ${CMAKE_SOURCE_DIR}/cmake/c_flag_overrides.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
   ${CMAKE_SOURCE_DIR}/cmake/cxx_flag_overrides.cmake)
   
SET(CMAKE_BUILD_TYPE $ENV{BUILD_TYPE})
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")

PROJECT("osIROSE")

LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

INCLUDE(OsIROSECMakeTools)
INCLUDE(FindLua)
INCLUDE(FindProtocolBuffer)

SET(VERSION_MAJOR 1)
SET(VERSION_MINOR 2)
SET(VERSION_PATCH 0)
SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")

# Evaluate ABI version number.
MATH(EXPR PROJECT_ABI_VERSION_SUFFIX "${VERSION_MAJOR} * 10000 + ${VERSION_MINOR} * 100 + ${VERSION_PATCH} * 1")

SET(PROJECT_ABI_VERSION v${PROJECT_ABI_VERSION_SUFFIX})

# Create a version file using git data
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
  execute_process(
    COMMAND git rev-parse --abbrev-ref HEAD
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_BRANCH
    OUTPUT_STRIP_TRAILING_WHITESPACE
  )

  execute_process(
    COMMAND git log -1 --format=%h
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_COMMIT_HASH
    OUTPUT_STRIP_TRAILING_WHITESPACE
  )
else()
  set(GIT_BRANCH "")
  set(GIT_COMMIT_HASH "")
endif()

message(STATUS "Git current branch: ${GIT_BRANCH}")
message(STATUS "Git commit hash: ${GIT_COMMIT_HASH}")

message(STATUS "Generating version.h")

configure_file(
  ${CMAKE_SOURCE_DIR}/cmake/version.h.in
  ${CMAKE_BINARY_DIR}/generated/version.h
)
#end version file

SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

OPTION(PROJECT_DEBUG 
  "Enable debugging messages support" ON)
OPTION(ENABLE_TESTING 
  "Enable testing" OFF)
OPTION(ENABLE_TESTING_COVERAGE, 
  "Enable generating code coverage report" OFF)
OPTION(BUILD_TOOLS 
  "Build server tools" ON)
OPTION(BUILD_PROTOBUF 
  "Build Protobuf (Leave this off)" OFF)
OPTION(BUILD_API_DOC
  "Build doxygen documentation" OFF)
OPTION(ENABLE_MYSQL_ONE_INSTANCE 
	"Enable use of the single instance mysql database" ON)
OPTION(ENABLE_EXPERMENTAL
  "Enable expermental features" OFF)
OPTION(DISABLE_CRYPT
  "Enable this to not use encryption functions" OFF)
  
SET(BUILD_TYPE "Debug" CACHE STRING "Debug")

IF (BUILD_API_DOC)
  FIND_PACKAGE(Doxygen)
  IF (DOXYGEN_FOUND)
    ADD_SUBDIRECTORY(doc)
  ENDIF (DOXYGEN_FOUND)
ENDIF (BUILD_API_DOC)

IF(ENABLE_MYSQL_ONE_INSTANCE)
  SET(ENABLE_MYSQL ON)
ENDIF()

IF(ENABLE_TESTING)
  enable_testing() #enable ctest
  
  include( CTest )
  INCLUDE( Dart )

	SET(CMAKE_RULE_MESSAGES OFF)	
	IF (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
		#Build GoogleMock
		ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/tools/googletest/googlemock)		
	ELSE()
		#Build GoogleMock
		ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/tools/googletest/googlemock)
		SET(GMOCK_INCLUDE_DIR ${gmock_SOURCE_DIR}/include)
		SET(GMOCK_BINARY_DIR ${gmock_SOURCE_DIR})
		SET(GTEST_INCLUDE_DIR ${gtest_SOURCE_DIR}/include)
		SET(GTEST_BINARY_DIR ${gtest_SOURCE_DIR})
	ENDIF()
	SET(CMAKE_RULE_MESSAGES ON)
ENDIF()

SET(ASIO_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tools/asio/asio/include)
SET(EXTERNAL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/3rdparty/include)
SET(EXTERNAL_BINARY_DIR ${CMAKE_SOURCE_DIR}/3rdparty/lib)
SET(PBJSON_ROOT ${CMAKE_SOURCE_DIR}/tools/pbjson/src)
SET(SPDLOG_ROOT ${CMAKE_SOURCE_DIR}/tools/spdlog/include)
SET(SELENE_ROOT ${CMAKE_SOURCE_DIR}/tools/Selene/include)
SET(SOL2_ROOT ${CMAKE_SOURCE_DIR}/tools/sol2)
SET(LUA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tools/lua/src)
SET(PROTOBUF_ROOT ${CMAKE_BINARY_DIR})
SET(PROTOBUF_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/tools/protobuf/src" CACHE STRING "${CMAKE_SOURCE_DIR}/tools/protobuf/src" FORCE)
SET(MYSQLpp_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/tools/mysqlpp/lib" CACHE STRING "${CMAKE_SOURCE_DIR}/tools/mysqlpp/lib" FORCE)
SET(CXXOPT_ROOT ${CMAKE_SOURCE_DIR}/tools/cxxopts/src)

IF(ENABLE_MYSQL)
  find_package(MySQL REQUIRED)
  #SET(BUILD_MYSQLPP ON CACHE BOOL "" FORCE)
  
  MESSAGE(STATUS "MySQL++ Include Path: ${MYSQLpp_INCLUDE_DIR}")

  configure_file(
    ${MYSQLpp_INCLUDE_DIR}/mysql++.h.in
    ${MYSQLpp_INCLUDE_DIR}/mysql++.h
  )
ENDIF()

IF (MSVC)
  SET(GMOCK_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tools/googletest/googlemock/include)
  SET(GMOCK_BINARY_DIR ${gmock_SOURCE_DIR})
  SET(GTEST_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tools/googletest/googletest/include)
  SET(GTEST_BINARY_DIR ${gtest_SOURCE_DIR})
  SET(PROTOBUF_PROTOC_EXECUTABLE "${CMAKE_BINARY_DIR}/bin/${BUILD_TYPE}/protoc.exe" CACHE STRING "${CMAKE_BINARY_DIR}/bin/${BUILD_TYPE}/protoc.exe" FORCE)
  SET(MYSQLpp_LIBRARY_PATH "${CMAKE_BINARY_DIR}/lib/${BUILD_TYPE}/" CACHE STRING "${CMAKE_BINARY_DIR}/lib/${BUILD_TYPE}/" FORCE)
  
  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4221")
  set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
  
  IF (${BUILD_TYPE} STREQUAL Debug)
    SET(PROTOBUF_LIBRARY "${CMAKE_BINARY_DIR}/lib/${BUILD_TYPE}/libprotobufd.lib" CACHE STRING "${CMAKE_BINARY_DIR}/lib/${BUILD_TYPE}/libprotobufd.lib" FORCE)
  ELSE()
    SET(PROTOBUF_LIBRARY "${CMAKE_BINARY_DIR}/lib/${BUILD_TYPE}/libprotobuf.lib" CACHE STRING "${CMAKE_BINARY_DIR}/lib/${BUILD_TYPE}/libprotobuf.lib" FORCE)
  ENDIF()
ELSE()
	#UNIX ONLY SETTINGS
	IF(ENABLE_MYSQL)
		SET(MYSQL_INCLUDE_DIR /usr/include/mysql)
	ENDIF()
{'fraction_non_alphanumeric': 0.12098074149486723, 'fraction_numerical': 0.0039026045643505555, 'mean_word_length': 6.879679144385027, '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': '2074759', 'n_tokens_mistral': 4979, 'n_tokens_neox': 4638, 'n_words': 692}