@@ -78,41 +78,64 @@ add_custom_target(_build_time_create_dpctl_include ALL
78
78
DEPENDS DPCTLSyclInterface
79
79
)
80
80
81
+ set (_copied_header_files )
81
82
file (GLOB _syclinterface_h ${CMAKE_SOURCE_DIR} /libsyclinterface/include/*.h )
82
83
foreach (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
+ )
86
92
endforeach ()
87
93
88
94
file (GLOB _syclinterface_Support_h ${CMAKE_SOURCE_DIR} /libsyclinterface/include/Support/*.h )
89
95
foreach (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
+ )
93
103
endforeach ()
94
104
95
105
file (GLOB _syclinterface_Config_h ${CMAKE_SOURCE_DIR} /libsyclinterface/include/Config/*.h )
96
106
foreach (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
+ )
100
114
endforeach ()
101
115
102
116
file (GLOB _apis_h ${CMAKE_CURRENT_SOURCE_DIR} /apis/include/* )
103
117
foreach (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
+ )
107
125
endforeach ()
108
126
127
+ add_custom_target (
128
+ _build_time_create_dpctl_include_copy ALL
129
+ DEPENDS ${_copied_header_files}
130
+ )
131
+
109
132
set (CMAKE_INSTALL_RPATH "$ORIGIN" )
110
133
111
134
function (build_dpctl_ext _trgt _src _dest )
112
135
add_cython_target (${_trgt} ${_src} CXX OUTPUT_VAR _generated_src )
113
136
add_library (${_trgt} MODULE ${_generated_src} )
114
137
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 )
116
139
if (DPCTL_GENERATE_COVERAGE )
117
140
target_compile_definitions (${_trgt} PRIVATE CYTHON_TRACE=1 CYTHON_TRACE_NOGIL=1 )
118
141
target_compile_options (${_trgt} PRIVATE -fno-sycl-use-footer )
0 commit comments