forked from MarkMuth/QtKittiVisualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
96 lines (84 loc) · 2.77 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
# Resources:
#
# http://www.vtk.org/Wiki/VTK/Examples/Cxx/Qt/RenderWindowNoUiFile
cmake_minimum_required(VERSION 2.8)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif()
project(QtKittiVisualizer)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
message(STATUS "VTK_QT_VERSION: " ${VTK_QT_VERSION})
if(${VTK_VERSION} VERSION_GREATER "6" AND VTK_QT_VERSION VERSION_GREATER "4")
message(STATUS "Using Qt5")
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
find_package(Qt5Widgets REQUIRED QUIET)
else()
message(STATUS "Using Qt4")
find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
include(${QT_USE_FILE})
endif()
set(PROJECT_BINARY_NAME qt-kitti-visualizer)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
find_package(Boost 1.54 COMPONENTS program_options filesystem REQUIRED)
set(Boost_COMPONENTS_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
set(Boost_COMPONENTS_LIBRARY_DIRS ${Boost_LIBRARY_DIRS})
set(Boost_COMPONENTS_LIBRARIES ${Boost_LIBRARIES})
include_directories(${Boost_COMPONENTS_INCLUDE_DIRS})
link_directories(${Boost_COMPONENTS_LIBRARY_DIRS})
add_definitions(${Boost_COMPONENTS_DEFINITIONS})
find_package(PCL 1.8 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
set(CPP_FILES
KittiConfig.cpp
KittiDataset.cpp
main.cpp
QtKittiVisualizer.cpp
)
set(WRAP_CPP_FILES QtKittiVisualizer.h)
set(WRAP_UI_FILES QtKittiVisualizer.ui)
if(${VTK_VERSION} VERSION_GREATER "6" AND VTK_QT_VERSION VERSION_GREATER "4")
qt5_wrap_ui(PROJECT_FORMS_HEADERS ${WRAP_UI_FILES} )
# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.
add_executable(${PROJECT_BINARY_NAME}
${CPP_FILES}
${PROJECT_FORMS_HEADERS}
${WRAP_CPP_FILES})
qt5_use_modules(${PROJECT_BINARY_NAME} Core Gui)
target_link_libraries(${PROJECT_BINARY_NAME}
${PCL_LIBRARIES}
${VTK_LIBRARIES}
${Boost_COMPONENTS_LIBRARIES})
else()
QT4_WRAP_UI(PROJECT_FORMS_HEADERS ${WRAP_UI_FILES})
QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${WRAP_CPP_FILES})
add_executable(${PROJECT_BINARY_NAME}
${CPP_FILES}
${PROJECT_FORMS_HEADERS}
${PROJECT_HEADERS_MOC})
if(VTK_LIBRARIES)
if(${VTK_VERSION} VERSION_LESS "6")
target_link_libraries(${PROJECT_BINARY_NAME}
${PCL_LIBRARIES}
${VTK_LIBRARIES}
QVTK
${Boost_COMPONENTS_LIBRARIES})
else()
target_link_libraries(${PROJECT_BINARY_NAME}
${PCL_LIBRARIES}
${VTK_LIBRARIES}
${Boost_COMPONENTS_LIBRARIES})
endif()
else()
target_link_libraries(${PROJECT_BINARY_NAME}
vtkHybrid
QVTK
vtkViews
${QT_LIBRARIES}
${PCL_LIBRARIES}
${Boost_COMPONENTS_LIBRARIES})
endif()
endif()