-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
165 lines (134 loc) · 4.83 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
project(STAR_FC)
#add_subdirectory(test)
cmake_minimum_required(VERSION 3.1)
option(WITH_SALICON "Build with support for OpenSALICON" OFF)
option(WITH_GPU_FOVEATION "Build with support for GPU-accelerated foveation" OFF)
#find_package(Qt5Widgets REQUIRED)
find_package(PythonInterp REQUIRED )
find_package(PythonLibs REQUIRED )
find_package(Boost COMPONENTS system filesystem serialization program_options)
#FIND_PACKAGE(OpenGL REQUIRED)
#FIND_LIBRARY(GLEW_LIBRARY GLEW)
if (WITH_SALICON)
set(CAFFE_INCLUDE_DIR /opt/STAR_FC/contrib/caffe/include)
set(CAFFE_LIB_DIR /opt/STAR_FC/contrib/caffe/build/lib)
find_library(CAFFE_LIBRARY caffe PATHS ${CAFFE_LIB_DIR})
find_library(GLOG_LIBRARY glog)
find_library(PROTOBUF_LIBRARY protobuf PATHS /usr/local/lib/)
endif()
include_directories(${PYTHON_INCLUDE_DIRS})
# this part is to automatically compile .ui files generated by qt designer
#set(CMAKE_AUTOMOC ON)
#set(CMAKE_AUTOUIC ON)
#set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(WITH_GPU_FOVEATION OR WITH_SALICON)
find_package(CUDA REQUIRED)
if (CUDA_FOUND)
set(CUDA_PROPAGATE_HOST_FLAGS ON)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -gencode arch=compute_30,code=sm_30;
-gencode arch=compute_50,code=sm_50;
-gencode arch=compute_60,code=sm_60;)
set(CUDA_SEPARABLE_COMPILATION ON)
endif()
endif()
if (NOT WITH_GPU_FOVEATION)
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif()
find_library(FFTW3_LIBRARY fftw3f)
find_library(FFTW3_THREADS fftw3f_threads)
find_package(OpenCV REQUIRED)
find_library(MATIO_LIB matio)
if (WITH_SALICON)
message (STATUS ${CAFFE_INCLUDE_DIR})
message (STATUS ${CAFFE_LIBRARY})
message (STATUS ${Boost_LIBRARIES})
endif()
message (STATUS ${FFTW3_LIBRARY})
message (STATUS ${FFTW3_THREADS})
message (STATUS ${OpenCV_LIBS})
message (STATUS ${MATIO_LIB})
#message (STATUS ${Qt5Widgets_INCLUDE_DIRS})
message (STATUS ${GLOG_LIBRARY})
message (STATUS ${PROTOBUF_LIBRARY})
if (NOT WITH_GPU_FOVEATION)
message (STATUS "OPENMP FOUND ${OPENMP_FOUND}")
endif()
set ( STAR_FC_SOURCES
src/AIM.cpp
src/AttentionalMap.cpp
src/CentralAttentionalMap.cpp
src/ConspicuityMap.cpp
src/Controller.cpp
src/Environment.cpp
src/Eye.cpp
src/FixationHistoryMap.cpp
src/foveate_wide_fov.cpp
src/main.cpp
src/PeripheralAttentionalMap.cpp
src/PriorityMap.cpp
src/factorize.cpp
src/utils.cpp
)
set ( STAR_FC_HEADERS
src/AIM.h
src/AttentionalMap.hpp
src/CentralAttentionalMap.hpp
src/ConspicuityMap.hpp
src/Controller.hpp
src/Environment.hpp
src/Eye.hpp
src/FixationHistoryMap.hpp
src/foveate_wide_fov.hpp
src/PeripheralAttentionalMap.hpp
src/PriorityMap.hpp
src/factorize.h
src/utils.hpp
src/ba_interp3.hpp
)
set ( STAR_FC_CUDA_FILES
src/ba_interp3.cu
)
set ( BMS_SOURCES
contrib/BMS_v2/mex/BMS.cpp
)
set ( VOCUS_SOURCES
contrib/VOCUS2/src/VOCUS2.cpp
)
set ( INIH_SOURCES
contrib/inih/cpp/INIReader.cpp
contrib/inih/ini.c
)
if (WITH_SALICON )
include_directories(${CAFFE_INCLUDE_DIR})
endif()
if (WITH_GPU_FOVEATION OR WITH_SALICON)
include_directories(${CUDA_INCLUDE_DIRS})
endif()
include_directories(${OpenCV_INCLUDE_DIRS} contrib/inih/ contrib/inih/cpp contrib/BMS_v2/mex/ contrib/VOCUS2/src/ /usr/include /usr/local/include/)
#add_compile_options(-std=c++11)
SET(CMAKE_CXX_FLAGS "-std=c++11 -O3")
if(WITH_GPU_FOVEATION AND WITH_SALICON)
message ("Compiling with GPU_FOVEATION=ON and WITH_SALICON=ON")
cuda_add_executable(STAR_FC ${STAR_FC_SOURCES} ${INIH_SOURCES} src/Salicon.cpp ${STAR_FC_HEADERS} src/Salicon.hpp ${STAR_FC_CUDA_FILES} ${BMS_SOURCES} ${VOCUS_SOURCES})
target_compile_definitions(STAR_FC PRIVATE GPU_FOVEATION=1 WITH_SALICON=1)
elseif (WITH_GPU_FOVEATION)
message ("Compiling with WITH_GPU_FOVEATION=ON")
cuda_add_executable(STAR_FC ${STAR_FC_SOURCES} ${INIH_SOURCES} ${STAR_FC_HEADERS} ${STAR_FC_CUDA_FILES} ${BMS_SOURCES} ${VOCUS_SOURCES})
#this is a preprocessor directive for foveate_wide_fov.hpp to switch on/off GPU accelerated foveation
target_compile_definitions(STAR_FC PRIVATE GPU_FOVEATION=1)
elseif(WITH_SALICON)
message ("Compiling with WITH_SALICON=ON")
add_executable(STAR_FC ${STAR_FC_SOURCES} ${INIH_SOURCES} src/Salicon.cpp ${STAR_FC_HEADERS} src/Salicon.hpp ${BMS_SOURCES} ${VOCUS_SOURCES})
target_compile_definitions(STAR_FC PRIVATE WITH_SALICON=1)
else()
add_executable(STAR_FC ${STAR_FC_SOURCES} ${INIH_SOURCES} ${STAR_FC_HEADERS} ${BMS_SOURCES} ${VOCUS_SOURCES})
endif()
if (WITH_SALICON)
target_link_libraries(STAR_FC ${OpenCV_LIBS} ${FFTW3_LIBRARY} ${FFTW3_THREADS} ${MATIO_LIB} ${PYTHON_LIBRARIES} ${CAFFE_LIBRARY} ${GLOG_LIBRARY} ${PROTOBUF_LIBRARY} ${Boost_LIBRARIES})
else()
target_link_libraries(STAR_FC ${OpenCV_LIBS} ${FFTW3_LIBRARY} ${FFTW3_THREADS} ${MATIO_LIB} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})
endif()