Itk: snake case functions are erased when re-running cmake

Created on 17 Feb 2019  Â·  5Comments  Â·  Source: InsightSoftwareConsortium/ITK

When a developer configures ITK with cmake, the Python Config files for each modules are created. During compilation, these files are appended with the list of snake case functions that the module contains. However, if the developer runs cmake again, the module files are re-generated, and the list of snake_case functions are erased. When trying to recompile ITK with make or ninja to recreate the complete Config files including the list of snake_case functions, nothing happens.

The current work around is to manually erase some files such as deleting the Wrapping folder in the build tree.

Python wrapping Bug Infrastructure

All 5 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This problem seems to still persist, and it makes debugging or improving the python code extremely difficult.

Files in ITK-bld/Wrapping/Generators/Python/Configuration/*Config.py are not written correctly after some reruns of cmake.

Uploading image.png…

image

During cmake .

Wrapping/Generators/Python/CMakeLists.txt
``` configure_file("${ITK_WRAP_PYTHON_SOURCE_DIR}/ModuleConfig.py.in"
"${ITK_WRAP_PYTHON_LIBRARY_CONFIG_FILE}"
@ONLY)

write a config file without the snake_case_functions listed

Then during the first build (ninja, or make), the dependancies are not met for this add_custom_commmand, such that the `${IGENERATOR}` script modifies the "Generators/Python/Configuration/ITK*Config.py" files appending the snake_case_functions.

add_custom_command(
  OUTPUT ${i_files} ${typedef_files} ${idx_files} ${snake_case_config_file}
  COMMAND ${Python3_EXECUTABLE} ${IGENERATOR}
    ${mdx_opts}
    ${swig_libs}
    -w1 -w3 -w51 -w52 -w53 -w54
    -A protected -A private
    -p ${PYGCCXML_DIR}
    -g ${CASTXML_EXECUTABLE}
    --snake-case-file "${snake_case_config_file}"
    --interface-output-dir "${WRAPPER_MASTER_INDEX_OUTPUT_DIR}"
    --library-output-dir "${WRAPPER_LIBRARY_OUTPUT_DIR}"
    --submodule-order "${WRAPPER_SUBMODULE_ORDER}"
    DEPENDS ${ITK_WRAP_DOC_DOCSTRING_FILES} ${xml_files} ${IGENERATOR} ${typedef_in_files}
  VERBATIM
)

```

====
Now subsequent runs if cmake . will again call the configure_file command which will re-write the "ITKConfig.py" files wiping out the "snake_case_functions" appended content. The problem is that none of the add_custom_command DEPENDS are out of date, so the very time consuming "${IGENERATOR}" command is not re-run, and the side effect of modifying the "ITKConfig.py" files does not occur.

======
A PR is being constructed to fix the identified problem.

Was this page helpful?
0 / 5 - 0 ratings