<commit_before>##
# Copyright (c) 2010 <NAME>, All rights reserved.
#
# This file is freely distributable without licensing fees and
# is provided without guarantee or warrantee expressed or implied.
# This file is -not- in the public domain.
##

macro(_PURPLE_PCH_FILES PCH_HEADER PCH_SOURCE NAME)
  set(${PCH_HEADER} "${CMAKE_CURRENT_BINARY_DIR}/${NAME}_pch.hxx")
  set(${PCH_SOURCE} "${CMAKE_CURRENT_BINARY_DIR}/${NAME}_pch.cxx")
endmacro(_PURPLE_PCH_FILES PCH_HEADER PCH_SOURCE NAME)

macro(_PURPLE_PRECOMPILE_HEADER_GCC NAME TARGET)
  _purple_pch_files(PCH_INPUT PCH_SOURCE ${NAME})

  set(PCH_HEADER "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_pch.hxx")
  set(PCH_BINARY "${PCH_HEADER}.gch")

  configure_file(${PCH_INPUT} ${PCH_HEADER} COPYONLY)

  string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" VARIANT)
  set(COMPILE_FLAGS ${${VARIANT}} )

  #get_target_property(TARGET_TYPE ${TARGET} TYPE)
  #if(${TARGET_TYPE} STREQUAL SHARED_LIBRARY)
  #  list(APPEND COMPILE_FLAGS "-fPIC")
  #endif(${TARGET_TYPE} STREQUAL SHARED_LIBRARY)

  get_directory_property(INC_DIRS INCLUDE_DIRECTORIES)
  foreach(DIR ${INC_DIRS})
    list(APPEND COMPILE_FLAGS "-I${DIR}")
  endforeach(DIR)

  get_directory_property(DIRECTORY_DEFS DEFINITIONS)
  list(APPEND COMPILE_FLAGS ${DIRECTORY_DEFS} ${CMAKE_CXX_FLAGS})

  separate_arguments(COMPILE_FLAGS)

  add_custom_command(OUTPUT ${PCH_BINARY} 	
    COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} ${COMPILE_FLAGS} -x c++-header -o ${PCH_BINARY} ${PCH_HEADER} 
    )

  add_custom_target(${TARGET}_pch
    DEPENDS	${PCH_BINARY} 
    )

  add_dependencies(${TARGET} ${TARGET}_pch)
  
  get_target_property(OLD_FLAGS ${TARGET} COMPILE_FLAGS)
  if(${OLD_FLAGS} MATCHES NOTFOUND)
    set(OLD_FLAGS "")
  endif(${OLD_FLAGS} MATCHES NOTFOUND)

  set_target_properties(${TARGET} PROPERTIES
    COMPILE_FLAGS "${OLD_FLAGS} -include ${PCH_HEADER}"
    )
endmacro(_PURPLE_PRECOMPILE_HEADER_GCC)

macro(_PURPLE_PRECOMPILE_HEADER_MSVC NAME TARGET)
  _purple_pch_files(PCH_HEADER PCH_SOURCE ${NAME})

  get_target_property(OLD_FLAGS ${TARGET} COMPILE_FLAGS)
  if(${OLD_FLAGS} MATCHES NOTFOUND)<commit_msg>Switch Collage to be dynamically linked for Equalizer.<commit_after>##
# Copyright (c) 2010 <NAME>, All rights reserved.
#
# This file is freely distributable without licensing fees and
# is provided without guarantee or warrantee expressed or implied.
# This file is -not- in the public domain.
##

macro(_PURPLE_PCH_FILES PCH_HEADER PCH_SOURCE NAME)
  set(${PCH_HEADER} "${CMAKE_CURRENT_BINARY_DIR}/${NAME}_pch.hxx")
  set(${PCH_SOURCE} "${CMAKE_CURRENT_BINARY_DIR}/${NAME}_pch.cxx")
endmacro(_PURPLE_PCH_FILES PCH_HEADER PCH_SOURCE NAME)

macro(_PURPLE_PRECOMPILE_HEADER_GCC NAME TARGET)
  _purple_pch_files(PCH_INPUT PCH_SOURCE ${NAME})

  set(PCH_HEADER "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_pch.hxx")
  set(PCH_BINARY "${PCH_HEADER}.gch")

  configure_file(${PCH_INPUT} ${PCH_HEADER} COPYONLY)

  string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" VARIANT)
  set(COMPILE_FLAGS ${${VARIANT}} )

  #get_target_property(TARGET_TYPE ${TARGET} TYPE)
  #if(${TARGET_TYPE} STREQUAL SHARED_LIBRARY)
  #  list(APPEND COMPILE_FLAGS "-fPIC")
  #endif(${TARGET_TYPE} STREQUAL SHARED_LIBRARY)

  get_directory_property(INC_DIRS INCLUDE_DIRECTORIES)
  foreach(DIR ${INC_DIRS})
    list(APPEND COMPILE_FLAGS "-I${DIR}")
  endforeach(DIR)

  get_directory_property(DIRECTORY_DEFS DEFINITIONS)
  list(APPEND COMPILE_FLAGS ${DIRECTORY_DEFS} ${CMAKE_CXX_FLAGS})

  separate_arguments(COMPILE_FLAGS)

  add_custom_command(OUTPUT ${PCH_BINARY} 	
    COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} ${COMPILE_FLAGS} -x c++-header -o ${PCH_BINARY} ${PCH_HEADER} 
    )

  add_custom_target(${TARGET}_pch DEPENDS ${PCH_BINARY})
  add_dependencies(${TARGET} ${TARGET}_pch)
  
  get_target_property(OLD_FLAGS ${TARGET} COMPILE_FLAGS)
  if(${OLD_FLAGS} MATCHES NOTFOUND)
    set(OLD_FLAGS "")
  endif(${OLD_FLAGS} MATCHES NOTFOUND)

  set_target_properties(${TARGET} PROPERTIES
    COMPILE_FLAGS "${OLD_FLAGS} -include ${PCH_HEADER}"
    )
endmacro(_PURPLE_PRECOMPILE_HEADER_GCC)

macro(_PURPLE_PRECOMPILE_HEADER_MSVC NAME TARGET)
  _purple_pch_files(PCH_HEADER PCH_SOURCE ${NAME})

  get_target_property(OLD_FLAGS ${TARGET} COMPILE_FLAGS)
  if(${OLD_FLAGS} MATCHES NOTFOUND)
{'fraction_non_alphanumeric': 0.11738726173872617, 'fraction_numerical': 0.0023245002324500234, 'mean_word_length': 6.823636363636363, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7562135', 'n_tokens_mistral': 1754, 'n_tokens_neox': 1649, 'n_words': 278}