-
Notifications
You must be signed in to change notification settings - Fork 71
/
CMakeLists.txt
161 lines (129 loc) · 4.48 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
cmake_minimum_required (VERSION 2.8.13)
project (Voxel)
set(VOXEL_MAJOR_VERSION 0)
set(VOXEL_MINOR_VERSION 6)
set(VOXEL_PATCH_VERSION 11)
set(VOXEL_VERSION ${VOXEL_MAJOR_VERSION}.${VOXEL_MINOR_VERSION}.${VOXEL_PATCH_VERSION})
set(VOXEL_ABI_VERSION 34)
set(VOXEL_CONF_VERSION 1)
### Do not export any symbol by default
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
include(GenerateExportHeader)
set(CMAKE_INCLUDE_CURRENT_DIR 1)
MESSAGE(${CMAKE_SYSTEM_NAME})
set(ARCH ${CMAKE_SYSTEM_PROCESSOR})
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
SET(LINUX 1)
add_definitions(-msse2 -pthread -std=c++11 -fPIC -ffast-math)
ADD_DEFINITIONS(-DLINUX)
set(COMMON_LIBS ${COMMON_LIBS} usb-1.0 dl)
SET(COMMON_LIBS_PRIVATE "")
set(COMMON_INCLUDE
${COMMON_INCLUDE}
/usr/include/libusb-1.0
Util/
)
if(ARCH STREQUAL "x86_64")
set(ARCH amd64)
endif()
file(WRITE "${CMAKE_BINARY_DIR}/make_deb.sh" "for i in CPackConfig-*.cmake; do cpack -G DEB --config $i; done\n")
SET(COMMON_LIB_FILES)
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
SET(WINDOWS 1)
add_definitions(/fp:fast /W0 /bigobj)
ADD_DEFINITIONS(-DWINDOWS /wd4251)
if(NOT MSVC_VERSION GREATER 1800)
SET(COMMON_LIBS setupapi strmiids strmbase Cfgmgr32 Version)
else()
SET(COMMON_LIBS setupapi strmiids strmbase Cfgmgr32 Version legacy_stdio_definitions)
endif()
SET(COMMON_LIBS_PRIVATE ${CMAKE_SOURCE_DIR}/Voxel/CyAPI/CyAPI.lib)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config/dllversion.rc.in
${CMAKE_CURRENT_BINARY_DIR}/dllversion.rc
@ONLY)
SET(COMMON_LIB_FILES ${CMAKE_CURRENT_BINARY_DIR}/dllversion.rc)
endif()
set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
if(NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
else()
foreach(config ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${config} c)
message(${c})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${c} ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${c} ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${c} ${PROJECT_BINARY_DIR}/lib)
endforeach()
endif()
include_directories(
Voxel
TI3DToF
VoxelPCL
${PROJECT_BINARY_DIR}/Voxel
${PROJECT_BINARY_DIR}/TI3DToF
${PROJECT_BINARY_DIR}/VoxelPCL
${COMMON_INCLUDE}
)
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()
IF(LINUX)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${ARCH})
set(CPACK_DEBIAN_PACKAGE_SECTION "Electronics")
set(CPACK_DEB_COMPONENT_INSTALL 1)
ENDIF()
INCLUDE(config/common.cmake)
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_SOURCE_DIR}/config/Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
SET (EXECUTE_ARG "${CMAKE_BINARY_DIR}/Doxyfile")
install(CODE "execute_process(COMMAND ${DOXYGEN_EXECUTABLE} \"${EXECUTE_ARG}\" WORKING_DIRECTORY \"${CMAKE_BINARY_DIR}\")"
COMPONENT voxel_dev)
if(LINUX)
install(DIRECTORY
${CMAKE_BINARY_DIR}/doc/html/
DESTINATION share/doc/voxel-sdk-${VOXEL_VERSION}
COMPONENT voxel_dev)
elseif(WINDOWS)
install(DIRECTORY
${CMAKE_BINARY_DIR}/doc/html/
DESTINATION doc/voxel-sdk
COMPONENT voxel_dev)
endif()
endif()
#### Packaging related information -- common to both platforms
set(CPACK_PACKAGE_NAME "Voxel SDK")
set(CPACK_PACKAGE_VERSION ${VOXEL_VERSION})
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_PACKAGE_VENDOR "Texas Instruments, Inc.")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Voxel library package. Contains the main Voxel library.")
set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)
add_subdirectory(Voxel)
add_subdirectory(VoxelPCL)
add_subdirectory(TI3DToF)
add_subdirectory(Test)
add_subdirectory(App)
add_subdirectory(Util)
IF(WINDOWS)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/config)
SET(CPACK_NSIS_MODIFY_PATH ON)
SET(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
IF(CMAKE_CL_64)
SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
ELSE()
SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
ENDIF()
INCLUDE(config/windows_all_in_installer_config.cmake)
include(CPack)
ENDIF()