Skip to content

Commit cd1798b

Browse files
authored
Copy OpenCV binaries once to prevent sporadic build failure on Windows (#254)
1 parent d6d1658 commit cd1798b

3 files changed

Lines changed: 7 additions & 16 deletions

File tree

app/Graph/CMakeLists.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,6 @@ target_link_libraries(Graph_Build BuildGraph)
2222
add_executable(ACC acc_check.cpp)
2323
target_link_libraries(ACC BuildGraph)
2424

25-
if (WIN32)
26-
add_custom_command(TARGET Graph_Build POST_BUILD
27-
COMMAND ${CMAKE_COMMAND} -E copy_directory
28-
"${OPENCV_BUILD_DIR}/bin/."
29-
"${CMAKE_BINARY_DIR}/bin/")
30-
31-
add_custom_command(TARGET ACC POST_BUILD
32-
COMMAND ${CMAKE_COMMAND} -E copy_directory
33-
"${OPENCV_BUILD_DIR}/bin/."
34-
"${CMAKE_BINARY_DIR}/bin/")
35-
endif()
36-
3725
file(DOWNLOAD
3826
"https://raw.githubusercontent.com/DeepTrackAI/MNIST_dataset/main/mnist/test/1_000008.png"
3927
"${CMAKE_SOURCE_DIR}/docs/input/28/test1.png"

cmake/opencv_config.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,10 @@ execute_process(
2121
COMMAND ${CMAKE_COMMAND} --build "${OPENCV_BUILD_DIR}" --config "${CMAKE_BUILD_TYPE}"
2222
WORKING_DIRECTORY "${OPENCV_BUILD_DIR}"
2323
)
24+
25+
if(WIN32)
26+
file(GLOB OPENCV_DLLS "${OPENCV_BUILD_DIR}/bin/*.dll")
27+
if(OPENCV_DLLS)
28+
file(COPY ${OPENCV_DLLS} DESTINATION "${CMAKE_BINARY_DIR}/bin")
29+
endif()
30+
endif()

test/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ target_include_directories(run_test PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
1515
target_include_directories(run_test PRIVATE "${CMAKE_SOURCE_DIR}/app/ReaderImage")
1616

1717
if (WIN32)
18-
add_custom_command(TARGET run_test POST_BUILD
19-
COMMAND ${CMAKE_COMMAND} -E copy_directory
20-
"${OPENCV_BUILD_DIR}/bin/."
21-
"${CMAKE_BINARY_DIR}/bin/")
2218
add_custom_command(TARGET run_test POST_BUILD
2319
COMMAND ${CMAKE_COMMAND} -E copy
2420
$<TARGET_FILE:dnnl>

0 commit comments

Comments
 (0)