-
Notifications
You must be signed in to change notification settings - Fork 52
/
CMakeLists.txt
82 lines (57 loc) · 2.15 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
cmake_minimum_required(VERSION 3.16)
project(SurroundView LANGUAGES CXX CUDA)
find_package(CUDA REQUIRED)
enable_language(CUDA)
set(CMAKE_CUDA_COMPILER /usr/local/cuda-9.0/bin/nvcc)
set(
CMAKE_NVCC_FLAGS
${CMAKE_NVCC_FLAGS};
-Xcompiler
-fopenmp
#-O3
-use_fast_math
-gencode arch=compute_62,code=sm_62
)
set(CMAKE_CUDA_FLAGS)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 14)
find_package(OpenMP REQUIRED)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS})
set(PROJ_INCLUDE_DIRS)
set(PROJ_LIBRARIES)
#set(Qt5Modules Core Widgets Gui)
#find_package(Qt5 COMPONENTS ${Qt5Modules} REQUIRED)
#set(CMAKE_AUTOMOC ON)
set(3DP_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/3dparty/")
set(GLFW_LIB "${3DP_INCLUDE_DIR}/lib/libglfw.so.3.1")
set(GLES_LIB "${3DP_INCLUDE_DIR}/lib/libEGL.so")
list(APPEND GLES_LIB "${3DP_INCLUDE_DIR}/lib/libGLESv2.so")
set(GLM_INCLUDE_DIR "${3DP_INCLUDE_DIR}/glm")
find_package(OpenCV REQUIRED)
list(APPEND PROJ_LIBRARIES ${OpenCV_LIBS})
list(APPEND PROJ_LIBRARIES ${CUDA_LIBRARIES})
include_directories(${OpenCV_INCLUDE_DIRS})
list(APPEND PROJ_INCLUDE_DIRS ${CUDA_INCLUDE_DIRS})
find_package(OpenGL REQUIRED)
list(APPEND PROJ_INCLUDE_DIRS ${OPENGL_EGL_INCLUDE_DIR})
list(APPEND PROJ_INCLUDE_DIRS ${GLM_INCLUDE_DIR})
list(APPEND PROJ_INCLUDE_DIRS ${3DP_INCLUDE_DIR})
list(APPEND PROJ_LIBRARIES ${GLFW_LIB})
list(APPEND PROJ_LIBRARIES ${GLES_LIB})
find_package(ASSIMP REQUIRED)
list(APPEND PROJ_LIBRARIES ${ASSIMP_LIBRARIES})
list(APPEND PROJ_INCLUDE_DIRS ${ASSIMP_INCLUDE_DIRS})
include_directories(${PROJECT_SOURCE_DIR}/include)
file(GLOB SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cusrc/*.cu
)
add_executable(SurroundView ${SOURCE_FILES})
set_target_properties(SurroundView
PROPERTIES OUTPUT_NAME "SurroundView"
CUDA_SEPARABLE_COMPILATION ON
)
set_property(TARGET SurroundView PROPERTY CUDA_STANDARD 14)
target_link_libraries(SurroundView PUBLIC ${PROJ_LIBRARIES})
target_include_directories(SurroundView PUBLIC ${PROJ_INCLUDE_DIRS})
target_compile_options(SurroundView PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:${CMAKE_NVCC_FLAGS}>)