<commit_before>
# Copyright (c) 2012 <NAME> <<EMAIL>>
# Info: http://www.itk.org/Wiki/CMake:Component_Install_With_CPack

if(NOT CPACK_PROJECT_NAME)
  set(CPACK_PROJECT_NAME ${CMAKE_PROJECT_NAME})
endif()
string(TOUPPER ${CPACK_PROJECT_NAME} UPPER_PROJECT_NAME)

set(${UPPER_PROJECT_NAME}_PACKAGE_VERSION "" CACHE 
  STRING "Additional build version for packages")
mark_as_advanced(${UPPER_PROJECT_NAME}_PACKAGE_VERSION)

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
  set(CPACK_PACKAGE_NAME "${CPACK_PROJECT_NAME}${VERSION_ABI}")
else()
  set(CPACK_PACKAGE_NAME "${CPACK_PROJECT_NAME}")
endif()

if(NOT APPLE)
  # deb lintian insists on URL
  set(CPACK_PACKAGE_VENDOR "http://${CPACK_PACKAGE_VENDOR}")
endif()

set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt)

# Default component definition
if(NOT CPACK_COMPONENTS_ALL)
  if(RELEASE_VERSION)
    set(CPACK_COMPONENTS_ALL lib dev apps)
  else()
    set(CPACK_COMPONENTS_ALL unspecified lib dev app)
  endif()

  set(CPACK_COMPONENT_UNSPECIFIED_DISPLAY_NAME "Unspecified")
  set(CPACK_COMPONENT_UNSPECIFIED_DESCRIPTION
    "Unspecified Component - set COMPONENT in CMake install() command")

  set(CPACK_COMPONENT_LIB_DISPLAY_NAME "${CPACK_PROJECT_NAME} Libraries")
  set(CPACK_COMPONENT_LIB_DESCRIPTION "${CPACK_PROJECT_NAME} Runtime Libraries")

  set(CPACK_COMPONENT_DEV_DISPLAY_NAME
    "${CPACK_PROJECT_NAME} Development Files")
  set(CPACK_COMPONENT_DEV_DESCRIPTION
    "Header and Library Files for ${CPACK_PROJECT_NAME} Development")
  set(CPACK_COMPONENT_DEV_DEPENDS lib)

  set(CPACK_COMPONENT_APPS_DISPLAY_NAME "${CPACK_PROJECT_NAME} Applications")
  set(CPACK_COMPONENT_APPS_DESCRIPTION "${CPACK_PROJECT_NAME} Applications")
  set(CPACK_COMPONENT_APPS_DEPENDS lib)
endif()

include(LSBInfo)

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
  find_program(RPM_EXE rpmbuild)
  find_program(DEB_EXE debuild)
endif()

# Heuristics to figure out cpack generator
if(MSVC)
  set(CPACK_GENERATOR "NSIS")
  set(CPACK_NSIS_MODIFY_PATH ON)
elseif(APPLE)
  set(CPACK_GENERATOR "PackageMaker")
  set(CPACK_OSX_PACKAGE_VERSION "${${UPPER_PROJECT_NAME}_OSX_VERSION}")
elseif(LSB_DISTRIBUTOR_ID MATCHES "Ubuntu")
  set(CPACK_GENERATOR "DEB")
elseif(LSB_DISTRIBUTOR_ID MATCHES "RedHatEnterpriseServer")
  set(CPACK_GENERATOR "RPM")
elseif(DEB_EXE)
  set(CPACK_GENERATOR "DEB")
elseif(RPM_EXE)
  set(CPACK_GENERATOR "RPM")
else()
  set(CPACK_GENERATOR "TGZ")
endif()

if(CPACK_GENERATOR STREQUAL "RPM")
  set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
  set(CPACK_RPM_PACKAGE_LICENSE "LGPL")
  set(CPACK_RPM_PACKAGE_RELEASE ${${UPPER_PROJECT_NAME}_PACKAGE_VERSION})
  set(CPACK_RPM_PACKAGE_VERSION ${VERSION})
  if(CPACK_PACKAGE_NAME_EXTRA)
    set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
  endif()
  if(NOT CPACK_RPM_POST_INSTALL_SCRIPT_FILE)
    set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/CMake/rpmPostInstall.sh")
  endif()
else()
  if(${UPPER_PROJECT_NAME}_PACKAGE_VERSION)
    set(CPACK_PACKAGE_VERSION_PATCH
      ${CPACK_PACKAGE_VERSION_PATCH}-${${UPPER_PROJECT_NAME}_PACKAGE_VERSION})
  endif()

  if(CPACK_GENERATOR STREQUAL "DEB")
    # dpkg requires lowercase package names
    string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)

    if(CPACK_PACKAGE_NAME_EXTRA)
      set(CPACK_DEBIAN_PACKAGE_VERSION
        "${CPACK_PACKAGE_VERSION}~${CPACK_PACKAGE_NAME_EXTRA}${LSB_RELEASE}")

      set(CPACK_PACKAGE_FILE_NAME
        "${CPACK_PACKAGE_NAME}-${CPACK_DEBIAN_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
    endif()

    if(NOT CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA)
      set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "/sbin/ldconfig")
    endif()

    if(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
      set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_CONTACT}")
    endif()
  endif()
endif()

set(CPACK_STRIP_FILES TRUE)
include(InstallRequiredSystemLibraries)
include(CPack)

include(UploadPPA)
if(UPLOADPPA_FOUND)
  upload_ppas()
endif()
<commit_msg>CommonCPack tweaks for vizsh<commit_after>
# Copyright (c) 2012 <NAME> <<EMAIL>>
# Info: http://www.itk.org/Wiki/CMake:Component_Install_With_CPack

if(NOT CPACK_PROJECT_NAME)
  set(CPACK_PROJECT_NAME ${CMAKE_PROJECT_NAME})
endif()
string(TOUPPER ${CPACK_PROJECT_NAME} UPPER_PROJECT_NAME)

set(${UPPER_PROJECT_NAME}_PACKAGE_VERSION "" CACHE 
  STRING "Additional build version for packages")
mark_as_advanced(${UPPER_PROJECT_NAME}_PACKAGE_VERSION)

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
  set(CPACK_PACKAGE_NAME "${CPACK_PROJECT_NAME}${VERSION_ABI}")
else()
  set(CPACK_PACKAGE_NAME "${CPACK_PROJECT_NAME}")
endif()

if(NOT APPLE)
  # deb lintian insists on URL
  set(CPACK_PACKAGE_VENDOR "http://${CPACK_PACKAGE_VENDOR}")
endif()

set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
set(CPACK_PACKAGE_VERSION ${VERSION})
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt)

# Default component definition
if(NOT CPACK_COMPONENTS_ALL)
  if(RELEASE_VERSION)
    set(CPACK_COMPONENTS_ALL lib dev apps)
  else()
    set(CPACK_COMPONENTS_ALL unspecified lib dev app)
  endif()

  set(CPACK_COMPONENT_UNSPECIFIED_DISPLAY_NAME "Unspecified")
  set(CPACK_COMPONENT_UNSPECIFIED_DESCRIPTION
    "Unspecified Component - set COMPONENT in CMake install() command")

  set(CPACK_COMPONENT_LIB_DISPLAY_NAME "${CPACK_PROJECT_NAME} Libraries")
  set(CPACK_COMPONENT_LIB_DESCRIPTION "${CPACK_PROJECT_NAME} Runtime Libraries")

  set(CPACK_COMPONENT_DEV_DISPLAY_NAME
    "${CPACK_PROJECT_NAME} Development Files")
  set(CPACK_COMPONENT_DEV_DESCRIPTION
    "Header and Library Files for ${CPACK_PROJECT_NAME} Development")
  set(CPACK_COMPONENT_DEV_DEPENDS lib)

  set(CPACK_COMPONENT_APPS_DISPLAY_NAME "${CPACK_PROJECT_NAME} Applications")
  set(CPACK_COMPONENT_APPS_DESCRIPTION "${CPACK_PROJECT_NAME} Applications")
  set(CPACK_COMPONENT_APPS_DEPENDS lib)
endif()

include(LSBInfo)

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
  find_program(RPM_EXE rpmbuild)
  find_program(DEB_EXE debuild)
endif()

# Heuristics to figure out cpack generator
if(MSVC)
  set(CPACK_GENERATOR "NSIS")
  set(CPACK_NSIS_MODIFY_PATH ON)
elseif(APPLE)
  set(CPACK_GENERATOR "PackageMaker")
  set(CPACK_OSX_PACKAGE_VERSION "${${UPPER_PROJECT_NAME}_OSX_VERSION}")
elseif(LSB_DISTRIBUTOR_ID MATCHES "Ubuntu")
  set(CPACK_GENERATOR "DEB")
elseif(LSB_DISTRIBUTOR_ID MATCHES "RedHatEnterpriseServer")
  set(CPACK_GENERATOR "RPM")
elseif(DEB_EXE)
  set(CPACK_GENERATOR "DEB")
elseif(RPM_EXE)
  set(CPACK_GENERATOR "RPM")
else()
  set(CPACK_GENERATOR "TGZ")
endif()

if(CPACK_GENERATOR STREQUAL "RPM")
  set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
  set(CPACK_RPM_PACKAGE_LICENSE "LGPL")
  set(CPACK_RPM_PACKAGE_RELEASE ${${UPPER_PROJECT_NAME}_PACKAGE_VERSION})
  set(CPACK_RPM_PACKAGE_VERSION ${VERSION})
  if(CPACK_PACKAGE_NAME_EXTRA)
    set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
  endif()
  if(NOT CPACK_RPM_POST_INSTALL_SCRIPT_FILE)
    set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/CMake/rpmPostInstall.sh")
  endif()
else()
  if(${UPPER_PROJECT_NAME}_PACKAGE_VERSION)
    set(CPACK_PACKAGE_VERSION_PATCH
      ${CPACK_PACKAGE_VERSION_PATCH}-${${UPPER_PROJECT_NAME}_PACKAGE_VERSION})
  endif()

  if(CPACK_GENERATOR STREQUAL "DEB")
    # dpkg requires lowercase package names
    string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)

    if(CPACK_PACKAGE_NAME_EXTRA)
      set(CPACK_DEBIAN_PACKAGE_VERSION
        "${CPACK_PACKAGE_VERSION}~${CPACK_PACKAGE_NAME_EXTRA}${LSB_RELEASE}")
      set(CPACK_PACKAGE_FILE_NAME
        "${CPACK_PACKAGE_NAME}-${CPACK_DEBIAN_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
    else()
      set(CPACK_DEBIAN_PACKAGE_VERSION
        "${CPACK_PACKAGE_VERSION}~${LSB_RELEASE}")
      set(CPACK_PACKAGE_FILE_NAME
        "${CPACK_PACKAGE_NAME}-${CPACK_DEBIAN_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
    endif()

    if(NOT CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA)
      set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "/sbin/ldconfig")
    endif()

    if(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
      set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_CONTACT}")
    endif()
  endif()
endif()

set(CPACK_STRIP_FILES TRUE)
include(InstallRequiredSystemLibraries)

set(CPACK_PACKAGE_FILE_NAME_BACKUP "${CPACK_PACKAGE_FILE_NAME}")
include(CPack)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME_BACKUP}")

include(UploadPPA)
if(UPLOADPPA_FOUND)
  upload_ppas()
endif()

{'fraction_non_alphanumeric': 0.10212521539345204, 'fraction_numerical': 0.0009190120620333142, 'mean_word_length': 7.892747701736465, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7510937', 'n_tokens_mistral': 3512, 'n_tokens_neox': 3424, 'n_words': 448}