-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
131 lines (99 loc) · 3.94 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
cmake_minimum_required (VERSION 3.8)
project (feintrack)
FIND_PACKAGE(OpenCV 4 REQUIRED)
unset(CMAKE_CXX_FLAGS CACHE)
find_package(OpenMP)
if (OPENMP_FOUND)
list(APPEND CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
list(APPEND CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall --std=c++0x -g --coverage" CACHE STRING COMPILE_FLAGS FORCE)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall --std=c++0x -g -pg" CACHE STRING COMPILE_FLAGS FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic-errors --std=c++0x" CACHE STRING COMPILE_FLAGS FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native --fast-math -ffast-math -funroll-loops -Wall -DNDEBUG -DBOOST_DISABLE_ASSERTS" CACHE STRING COMPILE_FLAGS FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -march=native -mtune=native -Wall -DDEBUG" CACHE STRING COMPILE_FLAGS FORCE)
elseif (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /W4" CACHE STRING COMPILE_FLAGS FORCE)
endif()
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7 -stdlib=libc++ -Wall" CACHE STRING COMPILE_FLAGS FORCE)
ENDIF()
include_directories(${OpenCV_INCLUDE_DIRS})
option(USE_GPU "Should the GPU be used?" OFF)
if(USE_GPU)
add_definitions(-DUSE_GPU)
endif(USE_GPU)
# Setup CUDA
if(USE_GPU)
find_package(CUDA REQUIRED)
include_directories(${CUDA_INCLUDE_DIRS} ${CUDA_CUT_INCLUDE_DIR})
endif(USE_GPU)
# ----------------------------------------------------------------------
set(SOURCE
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/bgrnd_substr.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/feintrack.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/feintrack_objects.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/segmentation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/objects_tracker.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/left_objects_detector.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/utils.cpp
)
set(HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/bgrnd_substr.h
${CMAKE_CURRENT_SOURCE_DIR}/src/feintrack.h
${CMAKE_CURRENT_SOURCE_DIR}/src/feintrack_objects.h
${CMAKE_CURRENT_SOURCE_DIR}/src/segmentation.h
${CMAKE_CURRENT_SOURCE_DIR}/src/objects_tracker.h
${CMAKE_CURRENT_SOURCE_DIR}/src/left_objects_detector.h
${CMAKE_CURRENT_SOURCE_DIR}/src/utils.h
${CMAKE_CURRENT_SOURCE_DIR}/src/some_types.h
${CMAKE_CURRENT_SOURCE_DIR}/src/feintrack_params.h
${CMAKE_CURRENT_SOURCE_DIR}/src/feintrack_d.h
)
file(GLOB SrcGpuCpp
${CMAKE_CURRENT_SOURCE_DIR}/src/feintrack_d.cu
)
# ----------------------------------------------------------------------
if(USE_GPU)
# add GPU related source code to the executable list
list(APPEND SOURCE ${SrcGpuCpp})
# Compile CUDA stuff
cuda_include_directories(${local_CUDA_CUT_INCLUDE_DIRS})
cuda_include_directories(${CUDA_INCLUDE_DIRS} ${CUDA_CUT_INCLUDE_DIR} ${local_CUDA_CUT_INCLUDE_DIR})
link_directories(${local_CUDA_CUT_LIBRARY_DIRS})
#target_link_libraries(
# ${CUDA_LIBRARIES}
# ${cutil_LIB}
#)
#set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --generate-line-info) # used during profiling
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -arch=sm_20)
endif(USE_GPU)
# ----------------------------------------------------------------------
list(REMOVE_ITEM OpenCV_LIBS "opencv_adas")
if (CMAKE_COMPILER_IS_GNUCXX)
set(LIBS
${OpenCV_LIBS}
# ${QT_LIBRARIES}
)
else(CMAKE_COMPILER_IS_GNUCXX)
set(LIBS
${OpenCV_LIBS}
)
endif()
if(USE_GPU)
#list(APPEND LIBS ${CUDA_LIBRARIES} ${cutil_LIB})
#MESSAGE(${CUDA_CUDA_LIBRARY})
#MESSAGE(${CUDA_CUDART_LIBRARY})
list(APPEND LIBS ${CUDA_CUDA_LIBRARY} ${CUDA_CUDART_LIBRARY})
endif(USE_GPU)
if(USE_GPU)
CUDA_ADD_EXECUTABLE(feintrack ${SOURCE} ${HEADERS})
else()
add_executable(feintrack ${SOURCE} ${HEADERS})
endif()
target_link_libraries(feintrack ${LIBS})
if(USE_GPU)
target_link_libraries(feintrack ${local_CUDA_LIB})
endif(USE_GPU)