file(GLOB_RECURSE PYTHON_SRCS RELATIVE ${PROJECT_SOURCE_DIR}
"${PROJECT_SOURCE_DIR}/caffe2/*.py")
+ # generated pb files are copied from build/caffe2 to caffe2
+ # if we copied them back to build this would create a build cycle
+ # consider removing the need for globs
+ filter_list_exclude(PYTHON_SRCS PYTHON_SRCS "proto/.*_pb")
+
set(build_files)
foreach(python_src ${PYTHON_SRCS})
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${python_src}
set(${output} ${result} PARENT_SCOPE)
endfunction()
+function(filter_list_exclude output input)
+ unset(result)
+ foreach(filename ${${input}})
+ foreach(pattern ${ARGN})
+ if(NOT "${filename}" MATCHES "${pattern}")
+ list(APPEND result "${filename}")
+ endif()
+ endforeach()
+ endforeach()
+ set(${output} ${result} PARENT_SCOPE)
+endfunction()
+
################################################################################
if (DEFINED ENV{PYTORCH_PYTHON})