<commit_before>#================================================================
# cmake utilities to build IO component
#================================================================
#
# The objective is to call component_setup to create the target <COMPONENT>.
# Before, it's necessary to set:
# 
# - COMPONENT component name
# - <COMPONENT>_DIRS: the list of paths (relative to CMAKE_CURRENT_SOURCE_DIR) that
#   contain source files
# - <COMPONENT>_EXCLUDE_SRCS: the list of files, in <COMPONENT>_DIRS, that must be excluded
#   from build.
# - <COMPONENT>_INTERFACE_INCLUDE_DIRECTORIES: a list of directories
#   to populate the interface of the target for include directories at build time

# Component name (i.e. target name)
set(COMPONENT io)
message("-- Set up for ${PROJECT_NAME}_${COMPONENT} library ...\n")

# ------ source directories for current component ------
# What is needed by component to compile ?
# List here all directories that contain sources files
# for current component.
# Path must be relative to component path (i.e. to CMAKE_CURRENT_SOURCE_DIR)
set(${COMPONENT}_DIRS)

# By default this component has no sources, everything is optional :
# - serialization/generation part : sources in serialization and generation
# - mechanicsIO : sources in mechanics 

if(HAVE_SICONOS_MECHANICS)
  list(APPEND ${COMPONENT}_DIRS src/mechanics) 
endif()

# --- Serialization setup ---

if(WITH_SERIALIZATION)
  list(APPEND ${COMPONENT}_DIRS src/serialization)
  
  if(NOT WITH_GENERATION)
    # in that case, we use headers in src/generation.
    # Warning : they must regularly updated (build siconos with generation ON!)
    # to take into account all changes in siconos interface.
    # --- Some headers are generated in current binary dir ---
    list(APPEND ${COMPONENT}_DIRS src/generation)
  else()
    set(GENERATED_HEADER ${CMAKE_CURRENT_BINARY_DIR}/SiconosFullGenerated.hpp)
    set(GENERATED_HEADER_KERNEL ${CMAKE_CURRENT_BINARY_DIR}/SiconosFullKernelGenerated.hpp)

    # list components 'targeted' by generation
    set(io_targets ${COMPONENTS})
    list(REMOVE_ITEM io_targets numerics io externals)
    string(REPLACE ";" "," io_targets_list "${io_targets}")
    set(GENERATED_TARGETS --targets=${io_targets_list})

    if(HAVE_SICONOS_KERNEL)
      list(APPEND GENERATED_DEPENDENCIES ${CMAKE_SOURCE_DIR}/kernel/src/SiconosKernel.hpp)
    endif()
    if(HAVE_SICONOS_MECHANICS)
      list(APPEND GENERATED_DEPENDENCIES ${CMAKE_SOURCE_DIR}/mechanics/src/collision/native/SpaceFilter.hpp)
    endif()
    if(HAVE_SICONOS_CONTROL)
      list(APPEND GENERATED_DEPENDENCIES ${CMAKE_SOURCE_DIR}/control/src/SiconosControl.hpp)
    endif()
    list(APPEND GENERATED_INCLUDES -I${CMAKE_BINARY_DIR}) # For SiconosConfig.h
    
    if(MPI_FOUND)
      foreach(_DIR IN LISTS MPI_CXX_INCLUDE_PATH)
        list(APPEND GENERATED_INCLUDES -I${_DIR})
      endforeach()
    endif()

    set(GENERATED_COMMAND COMMAND ${CMAKE_SOURCE_DIR}/io/tools/build_from_doxygen.py
      ${GENERATED_TARGETS} ${GENERATED_INCLUDES} --output=${GENERATED_HEADER}
      --source="${CMAKE_CURRENT_SOURCE_DIR}/../" --build="${CMAKE_BINARY_DIR}")

    add_custom_command(
      OUTPUT ${GENERATED_HEADER}
      DEPENDS kernel-doxy2xml ${GENERATED_DEPENDENCIES}
      ${CMAKE_SOURCE_DIR}/io/tools/build_from_doxygen.py
      ${CMAKE_SOURCE_DIR}/io/tools/builder_common.py
      ${GENERATED_COMMAND})

    SET(GENERATED_COMMAND_KERNEL COMMAND ${CMAKE_SOURCE_DIR}/io/tools/build_from_doxygen.py
      --targets=kernel ${GENERATED_INCLUDES}
      --output=${GENERATED_HEADER_KERNEL}
      --source="${CMAKE_CURRENT_SOURCE_DIR}/../" --build="${CMAKE_BINARY_DIR}")<commit_msg>Add include dir for cs.h when calling build_from_doxygen.py.<commit_after>#================================================================
# cmake utilities to build IO component
#================================================================
#
# The objective is to call component_setup to create the target <COMPONENT>.
# Before, it's necessary to set:
# 
# - COMPONENT component name
# - <COMPONENT>_DIRS: the list of paths (relative to CMAKE_CURRENT_SOURCE_DIR) that
#   contain source files
# - <COMPONENT>_EXCLUDE_SRCS: the list of files, in <COMPONENT>_DIRS, that must be excluded
#   from build.
# - <COMPONENT>_INTERFACE_INCLUDE_DIRECTORIES: a list of directories
#   to populate the interface of the target for include directories at build time

# Component name (i.e. target name)
set(COMPONENT io)
message("-- Set up for ${PROJECT_NAME}_${COMPONENT} library ...\n")

# ------ source directories for current component ------
# What is needed by component to compile ?
# List here all directories that contain sources files
# for current component.
# Path must be relative to component path (i.e. to CMAKE_CURRENT_SOURCE_DIR)
set(${COMPONENT}_DIRS)

# By default this component has no sources, everything is optional :
# - serialization/generation part : sources in serialization and generation
# - mechanicsIO : sources in mechanics 

if(HAVE_SICONOS_MECHANICS)
  list(APPEND ${COMPONENT}_DIRS src/mechanics) 
endif()

# --- Serialization setup ---

if(WITH_SERIALIZATION)
  list(APPEND ${COMPONENT}_DIRS src/serialization)
  
  if(NOT WITH_GENERATION)
    # in that case, we use headers in src/generation.
    # Warning : they must regularly updated (build siconos with generation ON!)
    # to take into account all changes in siconos interface.
    # --- Some headers are generated in current binary dir ---
    list(APPEND ${COMPONENT}_DIRS src/generation)
  else()
    set(GENERATED_HEADER ${CMAKE_CURRENT_BINARY_DIR}/SiconosFullGenerated.hpp)
    set(GENERATED_HEADER_KERNEL ${CMAKE_CURRENT_BINARY_DIR}/SiconosFullKernelGenerated.hpp)

    # list components 'targeted' by generation
    set(io_targets ${COMPONENTS})
    list(REMOVE_ITEM io_targets numerics io externals)
    string(REPLACE ";" "," io_targets_list "${io_targets}")
    set(GENERATED_TARGETS --targets=${io_targets_list})

    if(HAVE_SICONOS_KERNEL)
      list(APPEND GENERATED_DEPENDENCIES ${CMAKE_SOURCE_DIR}/kernel/src/SiconosKernel.hpp)
    endif()
    if(HAVE_SICONOS_MECHANICS)
      list(APPEND GENERATED_DEPENDENCIES ${CMAKE_SOURCE_DIR}/mechanics/src/collision/native/SpaceFilter.hpp)
    endif()
    if(HAVE_SICONOS_CONTROL)
      list(APPEND GENERATED_DEPENDENCIES ${CMAKE_SOURCE_DIR}/control/src/SiconosControl.hpp)
    endif()
    list(APPEND GENERATED_INCLUDES -I${CMAKE_BINARY_DIR}) # For SiconosConfig.h
    if(SuiteSparse_CXSparse_INCLUDE_DIR)
      list(APPEND GENERATED_INCLUDES -I${SuiteSparse_CXSparse_INCLUDE_DIR})
    endif()
    
    if(MPI_FOUND)
      foreach(_DIR IN LISTS MPI_CXX_INCLUDE_PATH)
        list(APPEND GENERATED_INCLUDES -I${_DIR})
      endforeach()
    endif()

    set(GENERATED_COMMAND COMMAND ${CMAKE_SOURCE_DIR}/io/tools/build_from_doxygen.py
      ${GENERATED_TARGETS} ${GENERATED_INCLUDES} --output=${GENERATED_HEADER}
      --source="${CMAKE_CURRENT_SOURCE_DIR}/../" --build="${CMAKE_BINARY_DIR}")

    add_custom_command(
      OUTPUT ${GENERATED_HEADER}
      DEPENDS kernel-doxy2xml ${GENERATED_DEPENDENCIES}
      ${CMAKE_SOURCE_DIR}/io/tools/build_from_doxygen.py
      ${CMAKE_SOURCE_DIR}/io/tools/builder_common.py
      ${GENERATED_COMMAND})

    SET(GENERATED_COMMAND_KERNEL COMMAND ${CMAKE_SOURCE_DIR}/io/tools/build_from_doxygen.py
      --targets=kernel ${GENERATED_INCLUDES}
      --output=${GENERATED_HEADER_KERNEL}
      --source="${CMAKE_CURRENT_SOURCE_DIR}/../" --build="${CMAKE_BINARY_DIR}")
{'fraction_non_alphanumeric': 0.13511714589989351, 'fraction_numerical': 0.00026624068157614486, 'mean_word_length': 4.602535421327367, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3346129', 'n_tokens_mistral': 2498, 'n_tokens_neox': 2328, 'n_words': 543}