-
Notifications
You must be signed in to change notification settings - Fork 31
/
CMakeLists.txt
106 lines (92 loc) · 3.71 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
# Copyright: (C) 2019 EDPR - Istituto Italiano di Tecnologia
# Authors: Arren Glover, Daniele Domenichelli
# CopyPolicy: Released under the terms of the GNU GPL v3.0.
cmake_minimum_required(VERSION 3.5)
project(event-driven
LANGUAGES CXX C
VERSION 2.0)
include(GNUInstallDirs)
#options
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_EXTENSIONS OFF)
option(BUILD_SHARED_LIBS "Build libraries as shared as opposed to static" ON)
set(CONTEXT_DIR event-driven)
set(EVENTDRIVEN_LIBRARY event-driven)
#YCM and cmake search path options
message(STATUS "Install Directory: ${CMAKE_INSTALL_PREFIX}")
find_package(YCM QUIET)
if(YCM_FOUND)
message(STATUS "Found YCM: (found version ${YCM_VERSION})")
else()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
endif()
include(AddInstallRPATHSupport)
add_install_rpath_support(BIN_DIRS "${CMAKE_INSTALL_FULL_BINDIR}"
LIB_DIRS "${CMAKE_INSTALL_FULL_LIBDIR}"
INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}"
USE_LINK_PATH)
if(NOT CMAKE_CONFIGURATION_TYPES)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Release' as none was specified.")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE "Release")
endif()
endif()
set(YARP_COMPONENTS os sig math dev)
set(OpenCV_dep "")
# opencv
find_package(OpenCV QUIET)
if(OpenCV_FOUND)
message(STATUS "Found OpenCV: (found version ${OpenCV_VERSION})")
set(OpenCV_dep OpenCV)
list(APPEND YARP_COMPONENTS cv)
endif()
#YARP
find_package(YARP COMPONENTS ${YARP_COMPONENTS} REQUIRED)
yarp_configure_external_installation(event-driven)
#metavision packages (prophesee is old version)
find_package(MetavisionSDK COMPONENTS core driver QUIET)
if(MetavisionSDK_FOUND)
message(STATUS "Found MetavisionSDK: (found version ${MetavisionSDK_VERSION})")
endif()
find_package(prophesee_core QUIET)
if(prophesee_core_FOUND)
message(STATUS "Found prophesee_core: (found version ${prophesee_core_VERSION})")
endif()
#build the library
#set options for the timing and encoding
set(VLIB_ENABLE_TS OFF CACHE BOOL "events have individual timestamps")
set(VLIB_CLOCK_PERIOD_NS 80 CACHE STRING "event timestamp clock period (ns)")
set(VLIB_TIMER_BITS 30 CACHE STRING "event timestamp maximum = 2^TIMERBITS")
string(COMPARE GREATER ${VLIB_TIMER_BITS} 31 TOOMANYBITSINCOUNTER)
if(TOOMANYBITSINCOUNTER)
message( FATAL_ERROR "Maximum bits useable is 31 (VLIB_TIMER_BITS)")
endif()
if(${VLIB_ENABLE_TS})
message(STATUS "ON: individual event timestamps")
message(STATUS "EVENT CLOCK: ${VLIB_CLOCK_PERIOD_NS} ns")
message(STATUS "MAX TIMESTAMP: ${VLIB_TIMER_BITS}/32 bits")
else()
message(STATUS "OFF: individual event timestamps")
endif()
add_subdirectory(ev2)
#build additional tools
add_subdirectory(cpp_tools)
#install the package
include(InstallBasicPackageFiles)
install_basic_package_files(${PROJECT_NAME}
EXPORT eventdriven
VERSION ${${PROJECT_NAME}_VERSION}
COMPATIBILITY SameMajorVersion
LOWERCASE_FILENAMES
NAMESPACE ev::
DEPENDENCIES "YARP COMPONENTS os sig" ${OpenCV_dep}
INCLUDE_CONTENT "yarp_configure_external_installation(event-driven NO_PATH_D)")
include(AddUninstallTarget)