-
Notifications
You must be signed in to change notification settings - Fork 62
/
CMakeLists.txt
72 lines (60 loc) · 2.49 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
cmake_minimum_required(VERSION 3.12)
project(DenseFlow)
option(USE_HDF5 "Whether to build hdf5 for optical flow image saving" OFF)
option(USE_NVFLOW "Whether to use nvidia hardware optical flow" OFF)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
find_package(CUDA REQUIRED)
find_package(OpenCV REQUIRED)
set(DenseFlow_LIB zzdenseflow)
message(STATUS "OpenCV library status:")
message(STATUS " config: ${OpenCV_DIR}")
message(STATUS " version: ${OpenCV_VERSION}")
message(STATUS " libraries: ${OpenCV_LIBS}")
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
find_package(Boost REQUIRED COMPONENTS date_time filesystem iostreams)
message(STATUS "Boost library status:")
message(STATUS " version: ${Boost_VERSION}")
message(STATUS " libraries: ${Boost_LIBRARIES}")
message(STATUS " include path: ${Boost_INCLUDE_DIRS}")
add_library(${DenseFlow_LIB} src/common.cpp src/utils.cpp src/denseflow_gpu.cpp)
include_directories(${OpenCV_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} include ${PROJECT_BINARY_DIR})
link_directories(${OpenCV_LIB_DIRS})
target_link_libraries(${DenseFlow_LIB} ${OpenCV_LIBS} Boost::filesystem ${Boost_LIBRARIES} pthread)
if (USE_HDF5)
find_package(HDF5 COMPONENTS HL REQUIRED)
message(STATUS "HDF5 library status:")
message(STATUS " version: ${HDF5_VERSION}")
message(STATUS " libraries: ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}")
message(STATUS " include path: ${HDF5_INCLUDE_DIRS} ${HDF5_HL_INCLUDE_DIR}")
set(HDF5_DEFINITION 1)
include_directories(${HDF5_INCLUDE_DIRS} ${HDF5_HL_INCLUDE_DIR})
target_link_libraries(${DenseFlow_LIB} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})
else()
set(HDF5_DEFINITION 0)
endif()
if (USE_NVFLOW)
set(NVFLOW_DEFINITION 1)
else()
set(NVFLOW_DEFINITION 0)
endif()
configure_file(
"${PROJECT_SOURCE_DIR}/include/config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
)
add_executable(denseflow tools/denseflow.cpp)
target_link_libraries(denseflow ${DenseFlow_LIB})
install (
TARGETS denseflow ${DenseFlow_LIB}
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)