<commit_before>PROJECT(binaryen CXX)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)

IF(NOT CMAKE_BUILD_TYPE)
  MESSAGE(STATUS "No build type selected, default to Release")
  SET(CMAKE_BUILD_TYPE "Release")
ENDIF()
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
IF(CMAKE_BUILD_TYPE AND
    NOT uppercase_CMAKE_BUILD_TYPE MATCHES "^(DEBUG|RELEASE)$")
  MESSAGE(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
ENDIF()

# Support functionality.

FUNCTION(ADD_COMPILE_FLAG value)
  MESSAGE(STATUS "Building with ${value}")
  FOREACH(variable CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
    SET(${variable} "${${variable}} ${value}" PARENT_SCOPE)
  ENDFOREACH(variable)
ENDFUNCTION()

# Compiler setup.

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)

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

IF(MSVC)
  ADD_COMPILE_FLAG("/arch:sse2")
  ADD_COMPILE_FLAG("/Wall")
  ADD_COMPILE_FLAG("/WX-")
  IF(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
    ADD_COMPILE_FLAG("/O0")
  ELSE()
    ADD_COMPILE_FLAG("/O2")
  ENDIF()
ELSE()
  ADD_COMPILE_FLAG("-std=c++11")
  ADD_COMPILE_FLAG("-msse2")
  ADD_COMPILE_FLAG("-mfpmath=sse")
  ADD_COMPILE_FLAG("-Wall")
  ADD_COMPILE_FLAG("-Werror")
  ADD_COMPILE_FLAG("-Wextra")<commit_msg>Remove /Wall warning level when building with Visual Studio. It is counterproductive since it spams thousands of warnings from Visual Studio runtime headers themselves.<commit_after>PROJECT(binaryen CXX)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)

IF(NOT CMAKE_BUILD_TYPE)
  MESSAGE(STATUS "No build type selected, default to Release")
  SET(CMAKE_BUILD_TYPE "Release")
ENDIF()
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
IF(CMAKE_BUILD_TYPE AND
    NOT uppercase_CMAKE_BUILD_TYPE MATCHES "^(DEBUG|RELEASE)$")
  MESSAGE(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
ENDIF()

# Support functionality.

FUNCTION(ADD_COMPILE_FLAG value)
  MESSAGE(STATUS "Building with ${value}")
  FOREACH(variable CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
    SET(${variable} "${${variable}} ${value}" PARENT_SCOPE)
  ENDFOREACH(variable)
ENDFUNCTION()

# Compiler setup.

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)

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

IF(MSVC)
  ADD_COMPILE_FLAG("/arch:sse2")
  ADD_COMPILE_FLAG("/WX-")
  IF(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
    ADD_COMPILE_FLAG("/O0")
  ELSE()
    ADD_COMPILE_FLAG("/O2")
  ENDIF()
ELSE()
  ADD_COMPILE_FLAG("-std=c++11")
  ADD_COMPILE_FLAG("-msse2")
  ADD_COMPILE_FLAG("-mfpmath=sse")
  ADD_COMPILE_FLAG("-Wall")
  ADD_COMPILE_FLAG("-Werror")
  ADD_COMPILE_FLAG("-Wextra")
{'fraction_non_alphanumeric': 0.12727898176814587, 'fraction_numerical': 0.006191950464396285, 'mean_word_length': 7.629080118694362, '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': '4841925', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1117, 'n_words': 175}