feichtenhofer / gpu_flow

GPU based optical flow extraction in OpenCV
427 stars 109 forks source link

Can I run the code on windows? #3

Open MargretWG opened 7 years ago

MargretWG commented 7 years ago

I try to run the code on Windows, but I get this error, qq 20170608091105

It suggests failed to open the input file "opencv_dep_cudart.lib"

I saw a solution to this problem on a forum, it was simply add set(CUDA_USE_STATIC_CUDA_RUNTIME OFF) to cmakelists.txt, but it didn't work . I guess this solution only works on the linux system. Could you please give me some suggestions? I have been working on the configuration for nearly 2 days.

audreyls commented 5 years ago

Sorry for the old post, but for anyone else that has this problem, per this comment by @tneumann, I did the following:

  1. Made a blank file "an_empty_file.cpp" in the \gpu_flow\ directory
  2. Opened gpu_flow's CMakeLists.txt and, directly above the INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) line, added in:

ADD_LIBRARY(opencv_dep_cudart STATIC <an_empty_file.cpp>)

and then added in "opencv_dep_cudart" to the TARGET_LINK_LIBRARIES sections underneath the ################################ like so:

TARGET_LINK_LIBRARIES(
  compute_flow
  ${OPENCV_LIBRARIES}
  ${OpenCV_LIBS}
  ${Qt5Widgets_LIBRARIES}
  opencv_dep_cudart
)
  1. Then I made through CMake and built, and everything went fine after I added in dirent.h and a gettimeofday.h implementation to my Visual Studio include dir. The opencv_dep_cudart issue is an OpenCV bug, and doesn't have anything to do with Windows compatibility as far as I can tell. The file isn't actually used, so it can be assigned to an empty file to just satisfy the compiler.