<commit_before>#---------------------------------------------------------------------
# Sub project name

PROJECT( elxComponents )

#---------------------------------------------------------------------
# Set the libraries to be linked.

# Linux gave an error, if param was linked. This was only
# when we still used .dll's. I'm not sure if it will still
# give an error, but as long as linux does not complain
# about the missing param, just leave it out.
IF( UNIX )
  IF ( NOT APPLE )
    SET(elxLinkLibs
      xoutlib
      elxCommon
      elxCore
      ITKBasicFilters
      ITKNumerics
      ITKIO
      ITKCommon
      ITKStatistics )
  ENDIF( NOT APPLE )
ENDIF( UNIX )

# Interestingly, visual c++ and MAC-GCC do need param
IF( WIN32 OR APPLE )
  SET( elxLinkLibs
    param
    xoutlib
    elxCommon
    elxCore
    ITKBasicFilters
    ITKNumerics
    ITKIO
    ITKCommon
    ITKStatistics )
ENDIF( WIN32 OR APPLE )

#--------------------------------------------------------------------
# Prepare elxInstallComponentFunctionDeclarations.h and
# elxInstallComponentFunctionCalls.h
# In the ADD_ELXCOMPONENT macro a line is added
#

SET( InstallFunctionDeclarationFile
  ${elastix_BINARY_DIR}/elxInstallComponentFunctionDeclarations.h )
SET( InstallFunctionCallFile
  ${elastix_BINARY_DIR}/elxInstallComponentFunctionCalls.h )

FILE( WRITE ${InstallFunctionDeclarationFile}
  "\n" "//This file is generated by CMake. Do not edit manually!\n\n" )
FILE( WRITE ${InstallFunctionCallFile}
  "\n" "//This file is generated by CMake. Do not edit manually!\n\n" )


#---------------------------------------------------------------------
# Macro that simplifies the addition of elx-components
#
# Usage:
# ADD_ELXCOMPONENT( <name_of_lib> <list_of_source_and_header_files> )
#
# The name_of_lib should be equal to the name of the elx class,
# which also should be the name used in the elxInstallMacro, in the
# the .cxx file of the component.
#

MACRO( ADD_ELXCOMPONENT name )
  # Compile this component or not
  SET( defaultValue ON )
  IF( ${ARGV1} STREQUAL "OFF" )
    SET( defaultValue OFF )
  ENDIF()
  MARK_AS_ADVANCED( USE_${name} )
  OPTION( USE_${name} "Compile this component" ${defaultValue} )

  IF( USE_${name} )
    # Create the list of files which create the library
    SET( filelist ${ARGN} )
    LIST( REMOVE_ITEM filelist "ON" "OFF" )

    # Create project and library
    PROJECT( ${name} )
    ADD_LIBRARY( ${name} STATIC ${filelist} )
    TARGET_LINK_LIBRARIES( ${name} ${elxLinkLibs} )

    # Update AllComponentLibs, while avoiding duplicates:
    IF( DEFINED AllComponentLibs )
      SET( dummy ${AllComponentLibs} )
      LIST( REMOVE_ITEM dummy ${name} )
      SET( dummy ${dummy} ${name} )
    ELSE()
      SET( dummy ${name} )
    ENDIF()
    SET( AllComponentLibs ${dummy} CACHE INTERNAL "All component libraries for elastix/transformix" )

    # Write lines to two files
    FILE( APPEND ${InstallFunctionDeclarationFile}
      "elxInstallComponentFunctionDeclarationMacro( " ${name} " );\n\n" )
    FILE( APPEND ${InstallFunctionCallFile}
      "elxInstallComponentFunctionCallMacro( " ${name} " );\n\n" )

  ELSE( USE_${name} )
    # Remove from link list
    IF( DEFINED AllComponentLibs )
      SET( dummy ${AllComponentLibs} )
      LIST( REMOVE_ITEM dummy ${name} )
    ELSE()
      SET( dummy "" )
    ENDIF()
    SET( AllComponentLibs ${dummy} CACHE INTERNAL "All component libraries for elastix/transformix"  )
  ENDIF()

ENDMACRO( ADD_ELXCOMPONENT )

#---------------------------------------------------------------------
# Search for all components
#

FILE( GLOB_RECURSE ListOfComponents "*/CMakeLists.txt" )

FOREACH( component ${ListOfComponents} )
  GET_FILENAME_COMPONENT( path_to_comp ${component} PATH )
  STRING( REGEX REPLACE "${elxComponents_SOURCE_DIR}/" "" relative_path_to_comp ${path_to_comp} )
  ADD_SUBDIRECTORY( ${relative_path_to_comp} )
ENDFOREACH()
<commit_msg>ENH: add support for external component dirs; not yet ready<commit_after>#---------------------------------------------------------------------
# Sub project name

PROJECT( elxComponents )

#---------------------------------------------------------------------
# Set the libraries to be linked.

# Linux gave an error, if param was linked. This was only
# when we still used .dll's. I'm not sure if it will still
# give an error, but as long as linux does not complain
# about the missing param, just leave it out.
IF( UNIX )
  IF ( NOT APPLE )
    SET(elxLinkLibs
      xoutlib
      elxCommon
      elxCore
      ITKBasicFilters
      ITKNumerics
      ITKIO
      ITKCommon
      ITKStatistics )
  ENDIF( NOT APPLE )
ENDIF( UNIX )

# Interestingly, visual c++ and MAC-GCC do need param
IF( WIN32 OR APPLE )
  SET( elxLinkLibs
    param
    xoutlib
    elxCommon
    elxCore
    ITKBasicFilters
    ITKNumerics
    ITKIO
    ITKCommon
    ITKStatistics )
ENDIF( WIN32 OR APPLE )

#--------------------------------------------------------------------
# Prepare elxInstallComponentFunctionDeclarations.h and
# elxInstallComponentFunctionCalls.h
# In the ADD_ELXCOMPONENT macro a line is added
#

SET( InstallFunctionDeclarationFile
  ${elastix_BINARY_DIR}/elxInstallComponentFunctionDeclarations.h )
SET( InstallFunctionCallFile
  ${elastix_BINARY_DIR}/elxInstallComponentFunctionCalls.h )

FILE( WRITE ${InstallFunctionDeclarationFile}
  "\n" "//This file is generated by CMake. Do not edit manually!\n\n" )
FILE( WRITE ${InstallFunctionCallFile}
  "\n" "//This file is generated by CMake. Do not edit manually!\n\n" )


#---------------------------------------------------------------------
# Macro that simplifies the addition of elx-components
#
# Usage:
# ADD_ELXCOMPONENT( <name_of_lib> <list_of_source_and_header_files> )
#
# The name_of_lib should be equal to the name of the elx class,
# which also should be the name used in the elxInstallMacro, in the
# the .cxx file of the component.
#

MACRO( ADD_ELXCOMPONENT name )
  # Compile this component or not
  SET( defaultValue ON )
  IF( ${ARGV1} STREQUAL "OFF" )
    SET( defaultValue OFF )
  ENDIF()
  MARK_AS_ADVANCED( USE_${name} )
  OPTION( USE_${name} "Compile this component" ${defaultValue} )

  IF( USE_${name} )
    # Create the list of files which create the library
    SET( filelist ${ARGN} )
    LIST( REMOVE_ITEM filelist "ON" "OFF" )

    # Create project and library
    PROJECT( ${name} )
    ADD_LIBRARY( ${name} STATIC ${filelist} )
    TARGET_LINK_LIBRARIES( ${name} ${elxLinkLibs} )

    # Update AllComponentLibs, while avoiding duplicates:
    IF( DEFINED AllComponentLibs )
      SET( dummy ${AllComponentLibs} )
      LIST( REMOVE_ITEM dummy ${name} )
      SET( dummy ${dummy} ${name} )
    ELSE()
      SET( dummy ${name} )
    ENDIF()
    SET( AllComponentLibs ${dummy} CACHE INTERNAL "All component libraries for elastix/transformix" )

    # Write lines to two files
    FILE( APPEND ${InstallFunctionDeclarationFile}
      "elxInstallComponentFunctionDeclarationMacro( " ${name} " );\n\n" )
    FILE( APPEND ${InstallFunctionCallFile}
      "elxInstallComponentFunctionCallMacro( " ${name} " );\n\n" )

  ELSE( USE_${name} )
    # Remove from link list
    IF( DEFINED AllComponentLibs )
      SET( dummy ${AllComponentLibs} )
      LIST( REMOVE_ITEM dummy ${name} )
    ELSE()
      SET( dummy "" )
    ENDIF()
    SET( AllComponentLibs ${dummy} CACHE INTERNAL "All component libraries for elastix/transformix"  )
  ENDIF()

ENDMACRO( ADD_ELXCOMPONENT )

#---------------------------------------------------------------------
# Search for all components
#

FILE( GLOB_RECURSE ListOfComponents "*/CMakeLists.txt" )

FOREACH( component ${ListOfComponents} )
  GET_FILENAME_COMPONENT( path_to_comp ${component} PATH )
  STRING( REGEX REPLACE "${elxComponents_SOURCE_DIR}/" "" relative_path_to_comp ${path_to_comp} )
  ADD_SUBDIRECTORY( ${relative_path_to_comp} )
ENDFOREACH()

#----------------------------------------------------------------------
# Search for user components

#FOREACH( USER_COMPONENT_DIR ${ELASTIX_USER_COMPONENT_DIRS} )
#
#  FILE( GLOB_RECURSE ListOfUserComponents "${USER_COMPONENT_DIR}/CMakeLists.txt" )
#
#  FOREACH( component ${ListOfUserComponents} )
#    GET_FILENAME_COMPONENT( path_to_comp ${component} PATH )
#	  # Use the full absolute path for user components:
#		ADD_SUBDIRECTORY( ${path_to_comp} )
#  ENDFOREACH( component )
#
#ENDFOREACH( USER_COMPONENT_DIR )

{'fraction_non_alphanumeric': 0.17759790501130818, 'fraction_numerical': 0.0011903344839900012, 'mean_word_length': 2.5753191489361704, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '98198', 'n_tokens_mistral': 2670, 'n_tokens_neox': 2578, 'n_words': 749}