Skip to content

Commit

Permalink
Merge pull request #85 from prophesee-ai/v4.2.0-to-main
Browse files Browse the repository at this point in the history
[v4.2.0] Release update
  • Loading branch information
nmartin-psee authored Jun 22, 2023
2 parents d66dfb2 + 6f4adea commit 509312e
Show file tree
Hide file tree
Showing 57 changed files with 1,468 additions and 780 deletions.
28 changes: 8 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif(NOT CMAKE_BUILD_TYPE)

cmake_minimum_required(VERSION 3.5)

project(metavision VERSION 4.1.0)
project(metavision VERSION 4.2.0)
set(PROJECT_VERSION_SUFFIX "")

if(PROJECT_VERSION_SUFFIX STREQUAL "")
Expand Down Expand Up @@ -162,7 +162,6 @@ endif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/utils/platforms/CMakeLists.txt")

if (NOT ANDROID)
option(COMPILE_PYTHON3_BINDINGS "Compile python 3 bindings" ON)
option(COMPILE_3DVIEW "Compile 3dview module for Designer" ON)
cmake_dependent_option(CODE_COVERAGE "Enable code coverage" ON "CMAKE_BUILD_TYPE_LOWER STREQUAL debug" OFF)
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
cmake_dependent_option(GENERATE_DOC "Generate Doxygen documentation" OFF "COMPILE_PYTHON3_BINDINGS" OFF)
Expand Down Expand Up @@ -200,9 +199,6 @@ endif ()
# OpenCV
find_package(OpenCV COMPONENTS core highgui imgproc videoio imgcodecs calib3d objdetect REQUIRED)

# OpenSceneGraph
find_package(OpenSceneGraph COMPONENTS osg osgViewer osgDB osgGA osgUtil osgText)

# HDF5
if (NOT ANDROID)
find_package(HDF5 1.10.2 COMPONENTS CXX)
Expand All @@ -224,9 +220,9 @@ if (BUILD_TESTING)
if (NOT GTest_FOUND)
find_package(GTest REQUIRED)
endif (NOT GTest_FOUND)
if (NOT TARGET GTest::gmock)
if (NOT TARGET GTest::gmock)
message(FATAL_ERROR
"GMock can't be found. Please install 'libgmock-dev' package. "
"GMock can't be found. Please install 'libgmock-dev' package. "
"Otherwise make sure it's compiled and installed along with your GoogleTest suite."
)
endif()
Expand All @@ -239,7 +235,7 @@ if (BUILD_TESTING)
message("| - Metavision SDK: https://dataset.prophesee.ai/index.php/s/l3RpHoC3NDL7OU6 (5 Gb archive) |")
message("---------------------------------------------------------------------------------------------------------\n")
endif()

set(PYTEST_CMD ${PYTHON_${PYTEST_PYTHON_VERSION}_EXECUTABLE} -m pytest)
if(CMAKE_CROSSCOMPILING)
# When cross compiling, we cannot use python executable path from the Host
Expand Down Expand Up @@ -311,9 +307,11 @@ if (BUILD_TESTING)
endfunction(add_test_app)

# Paths where gtest and pytests xml output files are stored
set(TEST_XML_OUTPUT_DIRECTORY "${GENERATE_FILES_DIRECTORY}/tests_xml_output")
set(TEST_OUTPUT_DIRECTORY "${GENERATE_FILES_DIRECTORY}/tests_output")
set(TEST_XML_OUTPUT_DIRECTORY "${TEST_OUTPUT_DIRECTORY}/xml")
set(JUNIT_XML_OUTPUT_DIRECTORY "${TEST_XML_OUTPUT_DIRECTORY}/junit/")
set(GTEST_XML_OUTPUT_DIRECTORY "${TEST_XML_OUTPUT_DIRECTORY}/gtest/")
set(TEST_LOG_OUTPUT_DIRECTORY "${TEST_OUTPUT_DIRECTORY}/log/")

include(register_gtest)

Expand Down Expand Up @@ -341,9 +339,6 @@ set(METAVISION_SDK_MODULES_ADVANCED analytics calibration cv ml CACHE STRING "SD
if (NOT ANDROID)
list(APPEND METAVISION_SDK_MODULES_OPEN ui)
list(APPEND METAVISION_SDK_MODULES_ADVANCED cv3d)
if(OpenSceneGraph_FOUND)
list(APPEND METAVISION_SDK_MODULES_ADVANCED 3dview)
endif(OpenSceneGraph_FOUND)
endif (NOT ANDROID)

set(METAVISION_SDK_MODULES_AVAILABLE)
Expand Down Expand Up @@ -425,13 +420,6 @@ endif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/hal_psee_plugins/CMakeLists.txt")
################################
add_subdirectory(sdk)

################################
# Designer ##
################################
if (COMPILE_PYTHON3_BINDINGS AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/designer/CMakeLists.txt")
add_subdirectory(designer)
endif (COMPILE_PYTHON3_BINDINGS AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/designer/CMakeLists.txt")

################################
# Standalone samples ##
################################
Expand Down Expand Up @@ -466,7 +454,7 @@ set(cpack_all_components ${cpack_public_components} ${cpack_internal_components}
list(REMOVE_DUPLICATES cpack_all_components)
file(WRITE ${GENERATE_FILES_DIRECTORY}/meta-package.log "")
foreach(comp ${cpack_all_components})
if ("${comp}" MATCHES "^metavision-(open|sdk|sdk-advanced|designer)-(lib|bin|dev|samples|python3.*|python|python-samples)$" OR
if ("${comp}" MATCHES "^metavision-(open|sdk|sdk-advanced)-(lib|bin|dev|samples|python3.*|python|python-samples)$" OR
"${comp}" STREQUAL "metavision-sdk")
install(FILES ${GENERATE_FILES_DIRECTORY}/meta-package.log
DESTINATION share/metavision/log/${comp}
Expand Down
22 changes: 20 additions & 2 deletions cmake/Modules/Findnodejs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#
# NODEJS_FOUND - Set to true if nodejs is found
# NODEJS_EXECUTABLE - The path to the nodejs executable
# NPM_EXECUTABLE - The path to the npm executable
# NPX_EXECUTABLE - The path to the npx executable
# NODEJS_VERSION - The version number of the nodejs executable

find_program(NODEJS_EXECUTABLE
Expand All @@ -17,6 +19,22 @@ find_program(NODEJS_EXECUTABLE
/opt/local
PATH_SUFFIXES bin)

find_program(NPM_EXECUTABLE
NAMES npm.cmd npm
HINTS /usr
/usr/local
/opt
/opt/local
PATH_SUFFIXES bin)

find_program(NPX_EXECUTABLE
NAMES npx.cmd npx
HINTS /usr
/usr/local
/opt
/opt/local
PATH_SUFFIXES bin)

# If nodejs was found, fill in the rest
if (NODEJS_EXECUTABLE)
# Set the VERSION
Expand Down Expand Up @@ -49,7 +67,7 @@ endif ()

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(nodejs
REQUIRED_VARS NODEJS_EXECUTABLE
REQUIRED_VARS NODEJS_EXECUTABLE NPX_EXECUTABLE
VERSION_VAR NODEJS_VERSION)

mark_as_advanced(NODEJS_EXECUTABLE NODEJS_VERSION)
mark_as_advanced(NODEJS_EXECUTABLE NPX_EXECUTABLE NODEJS_VERSION)
54 changes: 0 additions & 54 deletions cmake/Modules/Findyarn.cmake

This file was deleted.

144 changes: 95 additions & 49 deletions cmake/android/env.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ if (NOT DEFINED METAVISION_ANDROID_ENV_INCLUDED)

message(STATUS "Android ABI : ${ANDROID_ABI}")
message(STATUS "Android NDK : ${ANDROID_NDK_VERSION}")
if(ANDROID_NDK_VERSION VERSION_LESS "22")

if(ANDROID_NDK_VERSION VERSION_LESS "22")
# @TODO Remove once we update to NDK >22
if (ANDROID_ABI STREQUAL arm64-v8a)
# arm64-v8a linker seems to not be gold, which causes undefined references
Expand All @@ -74,70 +74,112 @@ if (NOT DEFINED METAVISION_ANDROID_ENV_INCLUDED)
endif (NOT DEFINED METAVISION_ANDROID_ENV_INCLUDED)

if (NOT DEFINED ANDROID_PREBUILT_3RDPARTY_DIR)
set(ANDROID_PREBUILT_3RDPARTY_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../../)
set(ANDROID_PREBUILT_3RDPARTY_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../../)
endif (NOT DEFINED ANDROID_PREBUILT_3RDPARTY_DIR)

# libusb has no config module, we need to create imported targets by hand
set(_libusb_root ${ANDROID_PREBUILT_3RDPARTY_DIR}/libusb-1.0.22)
set(LIBUSB_INCLUDE_DIR ${_libusb_root}/include/libusb1.0)
set(LIBUSB_LIBRARY ${_libusb_root}/libs/${ANDROID_ABI}/libusb1.0.so)
if (NOT TARGET libusb-1.0)
add_library(libusb-1.0 SHARED IMPORTED)
set_target_properties(libusb-1.0 PROPERTIES IMPORTED_LOCATION ${_libusb_root}/libs/${ANDROID_ABI}/libusb1.0.so)
set_target_properties(libusb-1.0 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${_libusb_root}/include/libusb-1.0)
# Implicit dependencies
set_target_properties(libusb-1.0 PROPERTIES INTERFACE_LINK_LIBRARIES log)
add_library(libusb-1.0 SHARED IMPORTED)
set_target_properties(libusb-1.0 PROPERTIES IMPORTED_LOCATION ${_libusb_root}/libs/${ANDROID_ABI}/libusb1.0.so)
set_target_properties(libusb-1.0 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${_libusb_root}/include/libusb-1.0)
# Implicit dependencies
set_target_properties(libusb-1.0 PROPERTIES INTERFACE_LINK_LIBRARIES log)
endif (NOT TARGET libusb-1.0)


# Boost has no config module, we need to create imported targets by hand
set(_boost_root ${ANDROID_PREBUILT_3RDPARTY_DIR}/boost-1.69.0)
set(_boost_components atomic chrono container context contract coroutine date_time fiber filesystem graph iostreams log log_setup math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l prg_exec_monitor program_options random regex serialization stacktrace_basic stacktrace_noop system thread timer type_erasure unit_test_framework wave wserialization)
set(_boost_components
atomic
chrono
container
context
contract
coroutine
date_time
fiber
filesystem
graph
iostreams
log
log_setup
math_c99
math_c99f
math_c99l
math_tr1
math_tr1f
math_tr1l
prg_exec_monitor
program_options
random
regex
serialization
stacktrace_basic
stacktrace_noop
system
thread
timer
type_erasure
unit_test_framework
wave
wserialization
)
set(Boost_INCLUDE_DIR "${_boost_root}/include")
set(Boost_FOUND TRUE)
foreach(b_comp ${_boost_components})
string(TOUPPER ${b_comp} b_comp_uc)
if (NOT TARGET Boost::${b_comp})
add_library(Boost::${b_comp} SHARED IMPORTED)
set_target_properties(Boost::${b_comp} PROPERTIES IMPORTED_LOCATION "${_boost_root}/libs/llvm/${ANDROID_ABI}/libboost_${b_comp}.so")
set_target_properties(Boost::${b_comp} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_boost_root}/include")
# Implicit dependencies
if ("${b_comp}" STREQUAL "filesystem")
set_target_properties(Boost::filesystem PROPERTIES INTERFACE_LINK_LIBRARIES Boost::system)
elseif ("${b_comp}" STREQUAL "timer")
set_target_properties(Boost::timer PROPERTIES INTERFACE_LINK_LIBRARIES Boost::chrono)
endif ()
endif (NOT TARGET Boost::${b_comp})
set(Boost_${b_comp_uc}_FOUND TRUE)
string(TOUPPER ${b_comp} b_comp_uc)
if (NOT TARGET Boost::${b_comp})
add_library(Boost::${b_comp} SHARED IMPORTED)
set_target_properties(Boost::${b_comp} PROPERTIES IMPORTED_LOCATION "${_boost_root}/libs/llvm/${ANDROID_ABI}/libboost_${b_comp}.so")
set_target_properties(Boost::${b_comp} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_boost_root}/include")
# Implicit dependencies
if ("${b_comp}" STREQUAL "filesystem")
set_target_properties(Boost::filesystem PROPERTIES INTERFACE_LINK_LIBRARIES Boost::system)
elseif ("${b_comp}" STREQUAL "timer")
set_target_properties(Boost::timer PROPERTIES INTERFACE_LINK_LIBRARIES Boost::chrono)
endif ()
endif (NOT TARGET Boost::${b_comp})
set(Boost_${b_comp_uc}_FOUND TRUE)
endforeach(b_comp)

# FFMpeg has no config module, we need to create imported targets by hand
set(_ffmpeg_root ${ANDROID_PREBUILT_3RDPARTY_DIR}/mobile-ffmpeg-min-gpl-4.3)
set(_ffmpeg_components avcodec avdevice avfilter avformat avutil swresample swscale)
set(_ffmpeg_components
avcodec
avdevice
avfilter
avformat
avutil
swresample
swscale
)
set(FFMPEG_INCLUDE_DIR "${_ffmpeg_root}/include")
set(FFMPEG_FOUND TRUE)
foreach(b_comp ${_ffmpeg_components})
string(TOUPPER ${b_comp} b_comp_uc)
if (NOT TARGET FFMPEG::${b_comp})
add_library(FFMPEG::${b_comp} SHARED IMPORTED)
set_target_properties(FFMPEG::${b_comp} PROPERTIES IMPORTED_LOCATION "${_ffmpeg_root}/android-${ANDROID_ABI}/ffmpeg/lib/lib${b_comp}.so")
set_target_properties(FFMPEG::${b_comp} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_ffmpeg_root}/android-${ANDROID_ABI}/ffmpeg/include")
# Implicit dependencies
if ("${b_comp}" STREQUAL "avdevice")
set_target_properties(FFMPEG::avdevice PROPERTIES INTERFACE_LINK_LIBRARIES FFMPEG::avfilter)
elseif ("${b_comp}" STREQUAL "avfilter")
set_target_properties(FFMPEG::avfilter PROPERTIES INTERFACE_LINK_LIBRARIES FFMPEG::avformat)
elseif ("${b_comp}" STREQUAL "avformat")
set_target_properties(FFMPEG::avformat PROPERTIES INTERFACE_LINK_LIBRARIES FFMPEG::avcodec)
elseif ("${b_comp}" STREQUAL "avcodec")
set_target_properties(FFMPEG::avcodec PROPERTIES INTERFACE_LINK_LIBRARIES FFMPEG::swresample)
elseif ("${b_comp}" STREQUAL "swresample")
set_target_properties(FFMPEG::swresample PROPERTIES INTERFACE_LINK_LIBRARIES FFMPEG::avutil)
elseif ("${b_comp}" STREQUAL "swscale")
set_target_properties(FFMPEG::swscale PROPERTIES INTERFACE_LINK_LIBRARIES FFMPEG::avutil)
endif ()
endif (NOT TARGET FFMPEG::${b_comp})
set(FFMPEG_${b_comp_uc}_FOUND TRUE)
string(TOUPPER ${b_comp} b_comp_uc)
if (NOT TARGET FFMPEG::${b_comp})
add_library(FFMPEG::${b_comp} SHARED IMPORTED)
set_target_properties(FFMPEG::${b_comp} PROPERTIES IMPORTED_LOCATION "${_ffmpeg_root}/android-${ANDROID_ABI}/ffmpeg/lib/lib${b_comp}.so")
set_target_properties(FFMPEG::${b_comp} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_ffmpeg_root}/android-${ANDROID_ABI}/ffmpeg/include")
# Implicit dependencies
if ("${b_comp}" STREQUAL "avdevice")
set_target_properties(FFMPEG::avdevice PROPERTIES INTERFACE_LINK_LIBRARIES FFMPEG::avfilter)
elseif ("${b_comp}" STREQUAL "avfilter")
set_target_properties(FFMPEG::avfilter PROPERTIES INTERFACE_LINK_LIBRARIES FFMPEG::avformat)
elseif ("${b_comp}" STREQUAL "avformat")
set_target_properties(FFMPEG::avformat PROPERTIES INTERFACE_LINK_LIBRARIES FFMPEG::avcodec)
elseif ("${b_comp}" STREQUAL "avcodec")
set_target_properties(FFMPEG::avcodec PROPERTIES INTERFACE_LINK_LIBRARIES FFMPEG::swresample)
elseif ("${b_comp}" STREQUAL "swresample")
set_target_properties(FFMPEG::swresample PROPERTIES INTERFACE_LINK_LIBRARIES FFMPEG::avutil)
elseif ("${b_comp}" STREQUAL "swscale")
set_target_properties(FFMPEG::swscale PROPERTIES INTERFACE_LINK_LIBRARIES FFMPEG::avutil)
endif ()
endif (NOT TARGET FFMPEG::${b_comp})
set(FFMPEG_${b_comp_uc}_FOUND TRUE)
endforeach(b_comp)


Expand All @@ -148,10 +190,10 @@ set(OpenCV_DIR ${_opencv_root}/jni)
# libopencv_java which is a shared library as we expect
include_directories(${ANDROID_OPENCV_INC_DIR})
if (NOT TARGET OpenCV::java)
add_library(OpenCV::java SHARED IMPORTED)
set_target_properties(OpenCV::java PROPERTIES IMPORTED_LOCATION "${_opencv_root}/libs/${ANDROID_ABI}/libopencv_java4.so")
set_target_properties(OpenCV::java PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_opencv_root}/jni/include")
set_target_properties(OpenCV::java PROPERTIES INTERFACE_LINK_LIBRARIES "z;log;android;jnigraphics")
add_library(OpenCV::java SHARED IMPORTED)
set_target_properties(OpenCV::java PROPERTIES IMPORTED_LOCATION "${_opencv_root}/libs/${ANDROID_ABI}/libopencv_java4.so")
set_target_properties(OpenCV::java PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_opencv_root}/jni/include")
set_target_properties(OpenCV::java PROPERTIES INTERFACE_LINK_LIBRARIES "z;log;android;jnigraphics")
endif (NOT TARGET OpenCV::java)
set(OpenCV_LIBS OpenCV::java)

Expand All @@ -162,4 +204,8 @@ find_package(GTest CONFIG)
# Eigen3 comes with its own module, let's use it
set(Eigen3_DIR ${ANDROID_PREBUILT_3RDPARTY_DIR}/eigen3-3.3.90/share/eigen3/cmake)

set(METAVISION_ANDROID_ENV_INCLUDED TRUE CACHE INTERNAL "Prevents multiple definition of Android related variables")
set(METAVISION_ANDROID_ENV_INCLUDED
TRUE
CACHE
INTERNAL "Prevents multiple definition of Android related variables"
)
6 changes: 0 additions & 6 deletions cmake/cpack/MetavisionCPackConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
# Include cpack configuration from the public packages of MetavisionSDK
include(${PROJECT_SOURCE_DIR}/sdk/cmake/MetavisionOffersCPackConfig.cmake)

# Include cpack configuration from the public packages of Metavision Designer (if available)
get_filename_component(designer_cpack_config "${PROJECT_SOURCE_DIR}/designer/cmake/MetavisionDesignerCPackConfig.cmake" REALPATH)
if(EXISTS "${designer_cpack_config}")
include("${designer_cpack_config}")
endif(EXISTS "${designer_cpack_config}")

###########################
# HAL #
###########################
Expand Down
Loading

0 comments on commit 509312e

Please sign in to comment.