-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
83 lines (66 loc) · 3.57 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
#------------------------------------------------------------------------------------------------------------
# Basic Configuration
#------------------------------------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.5)
project(TSlam VERSION "1.1.0" LANGUAGES CXX)
set(PROJECT_SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
set(BUILD_SHARED_LIBS ON)
# Set the build type for API integration into third software or not
if(BUILD_4_API)
set(TSLAM_BUILD_UTILS OFF)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
#------------------------------------------------------------------------------------------------------------
# Lib Names and Dirs
#------------------------------------------------------------------------------------------------------------
include(cmake/options.cmake)
include(cmake/compiler.cmake)
include(cmake/dependencies.cmake)
if(WIN32)
# Postfix of DLLs:
set(PROJECT_DLLVERSION "${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR}${PROJECT_VERSION_PATCH}")
set(RUNTIME_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "Directory for dlls and binaries")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "Directory for binaries")
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "Directory for dlls")
else()
# Postfix of so's:
set(PROJECT_DLLVERSION)
endif()
add_subdirectory(src)
if(TSLAM_BUILD_UTILS)
add_subdirectory(utils)
endif()
#------------------------------------------------------------------------------------------------------------
# Uninstall target, for "make uninstall"
#------------------------------------------------------------------------------------------------------------
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
# "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
# IMMEDIATE @ONLY)
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
#------------------------------------------------------------------------------------------------------------
# create configuration file from .in file (If you use windows take care with paths)
#------------------------------------------------------------------------------------------------------------
include(cmake/display.cmake)
#------------------------------------------------------------------------------------------------------------
# Download tslam vocabulary file
#------------------------------------------------------------------------------------------------------------
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/assets/voc/orb.fbow")
message(STATUS "Downloading vocabulary file from https://zenodo.org/record/7738721/files/orb.fbow")
file(DOWNLOAD "https://zenodo.org/record/7738721/files/orb.fbow" "${PROJECT_SOURCE_DIR}/assets/voc/orb.fbow")
endif()
#------------------------------------------------------------------------------------------------------------
# Testing
#------------------------------------------------------------------------------------------------------------
if(TSLAM_BUILD_TESTS)
include(CTest)
enable_testing()
add_subdirectory(tests)
endif()
#------------------------------------------------------------------------------------------------------------
# CPack packaging
#------------------------------------------------------------------------------------------------------------
if(TSLAM_BUILD_DEBPACKAGE)
include(cmake/cpack.cmake)
endif()