CMakeLists.txt 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. cmake_minimum_required(VERSION 2.8)
  2. project(slow_flow)
  3. set(CMAKE_C_COMPILER_INIT g++)
  4. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -Wall -g -O3 -msse4")
  5. ############################# PLEASE SPECIFY #############################
  6. set(MIDDLEBURY_DEVKIT_PATH "[SPECIFY PATH TO MIDDLEBURY DEVKIT]") # Middlebury Devkit
  7. set(GCO_PATH "[SPECIFY PATH TO GRAPH CUT]") # Graph cut library
  8. set(TRWS_PATH "[SPECIFY PATH TO TRWS]") # Tree-Reweigthed Message Passing
  9. #set(DMGUNTURK_PATH "[SPECIFY PATH TO HAMILTON ADAMS DEMOSAICING]") # Gunturk-Altunbasak-Mersereau Alternating Projections Image Demosaicking
  10. ############################# PLEASE SPECIFY #############################
  11. # opencv library
  12. find_package(OpenCV REQUIRED)
  13. # boost library
  14. find_package(Boost REQUIRED COMPONENTS system filesystem chrono regex)
  15. # eigen library
  16. find_package(Eigen3 REQUIRED )
  17. # PNG library
  18. find_package(PNG REQUIRED)
  19. # JPEG library
  20. find_package(JPEG REQUIRED)
  21. # Img library
  22. find_path(IMG_INCLUDE_DIRS Image.h PATHS ${MIDDLEBURY_DEVKIT_PATH}/imageLib/ NO_DEFAULT_PATH)
  23. find_library(IMG_LIBRARY NAMES Img PATHS ${MIDDLEBURY_DEVKIT_PATH}/imageLib/)
  24. add_library(Img STATIC IMPORTED)
  25. # LAPACK library
  26. find_package(LAPACK REQUIRED)
  27. find_package(BLAS REQUIRED)
  28. # GSL library
  29. FIND_PACKAGE(GSL REQUIRED)
  30. include_directories(${OpenCV_INCLUDE_DIRS})
  31. include_directories(${Eigen_INCLUDE_DIRS})
  32. include_directories(${Boost_INCLUDE_DIRS})
  33. include_directories(${PNG_INCLUDE_DIR})
  34. include_directories(${JPEG_INCLUDE_DIR})
  35. include_directories(${IMG_INCLUDE_DIRS})
  36. include_directories(${BLAS_INCLUDE_DIR})
  37. include_directories(${LAPACK_INCLUDE_DIR})
  38. include_directories(${GSLCBLAS_INCLUDE_DIR})
  39. include_directories(${GSL_INCLUDE_DIR})
  40. include_directories(${TRWS_PATH})
  41. link_directories(${Boost_LIBRARY_DIR})
  42. # INCLUDES
  43. set(EPIC_FLOW_EXTENDED_INCLUDES epic_flow_extended/epic_aux.cpp
  44. epic_flow_extended/epic.cpp
  45. epic_flow_extended/image.c
  46. epic_flow_extended/io.c
  47. epic_flow_extended/solver.c
  48. epic_flow_extended/variational_aux_mt.cpp
  49. epic_flow_extended/variational_mt.cpp)
  50. set(EPIC_FLOW_INCLUDES epic_flow_extended/epic_aux.cpp
  51. epic_flow_extended/epic.cpp
  52. epic_flow_extended/image.c
  53. epic_flow_extended/io.c
  54. epic_flow_extended/solver.c
  55. epic_flow_extended/variational_aux.c
  56. epic_flow_extended/variational.c)
  57. set(UTILS_INCLUDES utils/utils.cpp utils/parameter_list.cpp)
  58. set(MIDDLEBURY_INCLUDES ${MIDDLEBURY_DEVKIT_PATH}/colorcode.cpp ${MIDDLEBURY_DEVKIT_PATH}/flowIO.cpp)
  59. set(GCO_INCLUDES ${GCO_PATH}/GCoptimization.cpp
  60. ${GCO_PATH}/maxflow.cpp
  61. ${GCO_PATH}/graph.cpp
  62. ${GCO_PATH}/LinkedBlockList.cpp)
  63. if(DMGUNTURK_PATH)
  64. set(DMGUNTURK_INCLUDES ${DMGUNTURK_PATH}/dmha.c
  65. ${DMGUNTURK_PATH}/dmbilinear.c
  66. ${DMGUNTURK_PATH}/basic.c
  67. ${DMGUNTURK_PATH}/imageio.c)
  68. else()
  69. set(DMGUNTURK_INCLUDES )
  70. endif()
  71. # parallel computing
  72. find_package(OpenMP)
  73. if (OPENMP_FOUND)
  74. message("OPENMP FOUND")
  75. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
  76. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
  77. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
  78. endif()
  79. add_executable(slow_flow slow_flow.cpp
  80. ${EPIC_FLOW_EXTENDED_INCLUDES}
  81. ${UTILS_INCLUDES}
  82. ${MIDDLEBURY_INCLUDES}
  83. ${GCO_INCLUDES}
  84. ${DMGUNTURK_INCLUDES})
  85. add_executable(adaptiveFR adaptiveFR.cpp
  86. ${EPIC_FLOW_INCLUDES}
  87. ${UTILS_INCLUDES}
  88. ${MIDDLEBURY_INCLUDES}
  89. ${GCO_INCLUDES}
  90. ${DMGUNTURK_INCLUDES})
  91. add_executable(dense_tracking dense_tracking.cpp
  92. ${EPIC_FLOW_EXTENDED_INCLUDES}
  93. ${UTILS_INCLUDES}
  94. utils/hypothesis.cpp
  95. penalty_functions/penalty_function.h
  96. penalty_functions/lorentzian.h
  97. penalty_functions/modified_l1_norm.h
  98. penalty_functions/quadratic_function.h
  99. ${MIDDLEBURY_INCLUDES}
  100. ${TRWS_PATH}/MRFEnergy.cpp
  101. ${TRWS_PATH}/minimize.cpp
  102. ${TRWS_PATH}/ordering.cpp
  103. ${TRWS_PATH}/treeProbabilities.cpp
  104. ${GCO_INCLUDES}
  105. ${DMGUNTURK_INCLUDES})
  106. target_link_libraries(slow_flow ${OpenCV_LIBS} ${Boost_LIBRARIES} ${IMG_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
  107. target_link_libraries(adaptiveFR ${OpenCV_LIBS} ${Boost_LIBRARIES} ${IMG_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
  108. target_link_libraries(dense_tracking ${OpenCV_LIBS} ${Boost_LIBRARIES} ${IMG_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${GSL_LIBRARY} ${GSLCBLAS_LIBRARY})