@@ -78,41 +78,64 @@ add_custom_target(_build_time_create_dpctl_include ALL
7878 DEPENDS DPCTLSyclInterface
7979)
8080
81+ set (_copied_header_files)
8182file (GLOB _syclinterface_h ${CMAKE_SOURCE_DIR} /libsyclinterface/include /*.h)
8283foreach (hf ${_syclinterface_h} )
83- add_custom_command (TARGET _build_time_create_dpctl_include
84- COMMAND ${CMAKE_COMMAND} -E copy ${hf} ${DPCTL_INCLUDE_DIR} /syclinterface
85- )
84+ get_filename_component (_header_name ${hf} NAME )
85+ set (_target_header_file ${DPCTL_INCLUDE_DIR} /syclinterface/${_header_name} )
86+ list (APPEND _copied_header_files ${_target_header_file} )
87+ add_custom_command (OUTPUT ${_target_header_file}
88+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${hf} ${_target_header_file}
89+ DEPENDS ${hf} _build_time_create_dpctl_include
90+ VERBATIM
91+ )
8692endforeach ()
8793
8894file (GLOB _syclinterface_Support_h ${CMAKE_SOURCE_DIR} /libsyclinterface/include /Support/*.h)
8995foreach (hf ${_syclinterface_Support_h} )
90- add_custom_command (TARGET _build_time_create_dpctl_include
91- COMMAND ${CMAKE_COMMAND} -E copy ${hf} ${DPCTL_INCLUDE_DIR} /syclinterface/Support
92- )
96+ get_filename_component (_header_name ${hf} NAME )
97+ set (_target_header_file ${DPCTL_INCLUDE_DIR} /syclinterface/Support/${_header_name} )
98+ list (APPEND _copied_header_files ${_target_header_file} )
99+ add_custom_command (OUTPUT ${_target_header_file}
100+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${hf} ${_target_header_file}
101+ DEPENDS ${hf} _build_time_create_dpctl_include
102+ )
93103endforeach ()
94104
95105file (GLOB _syclinterface_Config_h ${CMAKE_SOURCE_DIR} /libsyclinterface/include /Config/*.h)
96106foreach (hf ${_syclinterface_Config_h} )
97- add_custom_command (TARGET _build_time_create_dpctl_include
98- COMMAND ${CMAKE_COMMAND} -E copy ${hf} ${DPCTL_INCLUDE_DIR} /syclinterface/Config
99- )
107+ get_filename_component (_header_name ${hf} NAME )
108+ set (_target_header_file ${DPCTL_INCLUDE_DIR} /syclinterface/Config/${_header_name} )
109+ list (APPEND _copied_header_files ${_target_header_file} )
110+ add_custom_command (OUTPUT ${_target_header_file}
111+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${hf} ${_target_header_file}
112+ DEPENDS ${hf} _build_time_create_dpctl_include
113+ )
100114endforeach ()
101115
102116file (GLOB _apis_h ${CMAKE_CURRENT_SOURCE_DIR} /apis/include /*)
103117foreach (hf ${_apis_h} )
104- add_custom_command (TARGET _build_time_create_dpctl_include
105- COMMAND ${CMAKE_COMMAND} -E copy ${hf} ${DPCTL_INCLUDE_DIR}
106- )
118+ get_filename_component (_header_name ${hf} NAME )
119+ set (_target_header_file ${DPCTL_INCLUDE_DIR} /${_header_name} )
120+ list (APPEND _copied_header_files ${_target_header_file} )
121+ add_custom_command (OUTPUT ${_target_header_file}
122+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${hf} ${_target_header_file}
123+ DEPENDS ${hf} _build_time_create_dpctl_include
124+ )
107125endforeach ()
108126
127+ add_custom_target (
128+ _build_time_create_dpctl_include_copy ALL
129+ DEPENDS ${_copied_header_files}
130+ )
131+
109132set (CMAKE_INSTALL_RPATH "$ORIGIN" )
110133
111134function (build_dpctl_ext _trgt _src _dest)
112135 add_cython_target(${_trgt} ${_src} CXX OUTPUT_VAR _generated_src)
113136 add_library (${_trgt} MODULE ${_generated_src} )
114137 target_include_directories (${_trgt} PRIVATE ${NumPy_INCLUDE_DIR} ${DPCTL_INCLUDE_DIR} )
115- add_dependencies (${_trgt} _build_time_create_dpctl_include )
138+ add_dependencies (${_trgt} _build_time_create_dpctl_include_copy )
116139 if (DPCTL_GENERATE_COVERAGE)
117140 target_compile_definitions (${_trgt} PRIVATE CYTHON_TRACE=1 CYTHON_TRACE_NOGIL=1)
118141 target_compile_options (${_trgt} PRIVATE -fno-sycl-use-footer)
0 commit comments