File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,12 @@ repos:
141
141
hooks :
142
142
- id : cmakelint
143
143
args : [--config=./tools/codestyle/.cmakelintrc]
144
+ # Exclude some files has false positive warnings
145
+ # Need to fix them in the future
146
+ exclude : |
147
+ (?x)^(
148
+ cmake/external/onnxruntime.cmake
149
+ )$
144
150
# Others
145
151
- repo : local
146
152
hooks :
Original file line number Diff line number Diff line change @@ -178,14 +178,37 @@ add_library(onnxruntime STATIC IMPORTED GLOBAL)
178
178
set_property (TARGET onnxruntime PROPERTY IMPORTED_LOCATION ${ONNXRUNTIME_LIB} )
179
179
add_dependencies (onnxruntime ${ONNXRUNTIME_PROJECT} )
180
180
181
+ if (WIN32 )
182
+ string (REGEX REPLACE "/" "\\\\ " SOURCE_PATH "${ONNXRUNTIME_SHARED_LIB} " )
183
+ set (ONNX_COPY_PATH
184
+ "${CMAKE_BINARY_DIR} /paddle/third_party/onnx_copy_retry.bat" )
185
+ file (
186
+ WRITE ${CMAKE_BINARY_DIR} /paddle/third_party/onnx_copy_retry.bat
187
+ ""
188
+ "set build_times=1\n "
189
+ ":retry\n "
190
+ "ECHO copy_onnx run %build_times% time\n "
191
+ "xcopy ${SOURCE_PATH} %1 /Y\n "
192
+ "if %ERRORLEVEL% NEQ 0 (\n "
193
+ " set /a build_times=%build_times%+1\n "
194
+ " if %build_times% GEQ 10 (\n "
195
+ " exit /b 1\n "
196
+ " ) else (\n "
197
+ " goto :retry\n "
198
+ " )\n "
199
+ ")\n "
200
+ "exit /b 0" )
201
+ endif ()
202
+
181
203
function (copy_onnx TARGET_NAME )
182
204
# If error of Exitcode0xc000007b happened when a .exe running, copy onnxruntime.dll
183
205
# to the .exe folder.
184
206
if (TARGET ${TARGET_NAME} )
207
+ string (REGEX REPLACE "/" "\\\\ " DESTINATION_PATH
208
+ "${CMAKE_CURRENT_BINARY_DIR} " )
185
209
add_custom_command (
186
210
TARGET ${TARGET_NAME}
187
211
POST_BUILD
188
- COMMAND ${CMAKE_COMMAND} -E copy ${ONNXRUNTIME_SHARED_LIB}
189
- ${CMAKE_CURRENT_BINARY_DIR} DEPENDS onnxruntime )
212
+ COMMAND ${ONNX_COPY_PATH} ${DESTINATION_PATH} DEPENDS onnxruntime )
190
213
endif ()
191
214
endfunction ()
You can’t perform that action at this time.
0 commit comments