[swig] prepend utf-8 coding indicator to generated .py files
Fixes
@@ -122,6 +122,9 @@ macro(add_siconos_swig_sub_module fullname)
set_source_files_properties(${${_name}_generated_file_fullname} PROPERTIES COMPILE_FLAGS "/bigobj")
ENDIF()
+ # Add a post-build step that prepends utf-8 coding indicator to .py files
+ add_custom_command(TARGET ${SWIG_MODULE_${_name}_REAL_NAME}
+ POST_BUILD COMMAND sh -c "(echo '# -*- coding: utf-8 -*-'; cat ${SICONOS_SWIG_ROOT_DIR}/${_path}/${_name}.py) > ${SICONOS_SWIG_ROOT_DIR}/${_path}/${_name}.tmp; mv ${SICONOS_SWIG_ROOT_DIR}/${_path}/${_name}.tmp ${SICONOS_SWIG_ROOT_DIR}/${_path}/${_name}.py" VERBATIM)
# Check dependencies and then link ...
add_dependencies(${SWIG_MODULE_${_name}_REAL_NAME} ${COMPONENT})
