Skip to content

Commit

Permalink
Merge upstream master
Browse files Browse the repository at this point in the history
  • Loading branch information
SamFlt committed Mar 25, 2024
2 parents dd8238d + 5420cec commit 70af294
Show file tree
Hide file tree
Showing 239 changed files with 16,097 additions and 6,573 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-contrib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Print compiler information
run: dpkg --list | grep compiler

- name: Install dependencies for ubuntu 18.04 and 20.04
- name: Install dependencies for ubuntu 20.04
if: matrix.os != 'ubuntu-22.04'
run: sudo apt-get update && sudo apt-get install -y libx11-dev libdc1394-22-dev libv4l-dev liblapack-dev libopenblas-dev libeigen3-dev libopencv-dev nlohmann-json3-dev

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-dep-apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
compiler: [ {CC: /usr/bin/gcc-9, CXX: /usr/bin/g++-9}, {CC: /usr/bin/gcc-10, CXX: /usr/bin/g++-10}, {CC: /usr/bin/clang, CXX: /usr/bin/clang++} ]
standard: [ 11, 14, 17 ]
standard: [ 98, 11, 17 ]

steps:
- name: Checkout repository
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/ubuntu-sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,12 @@ jobs:
# SUMMARY: AddressSanitizer: odr-violation: global 'ALIGNMENT' at /home/runner/work/visp/visp/3rdparty/simdlib/Simd/SimdLib.cpp:82:18
ASAN_OPTIONS: detect_odr_violation=0
working-directory: build
run: ctest -j$(nproc) --output-on-failure
# When running ctest we got a lot of segfault
# This seems a bug reported in
# - https://stackoverflow.com/questions/77894856/possible-bug-in-gcc-sanitizers
# - https://stackoverflow.com/questions/77850769/fatal-threadsanitizer-unexpected-memory-mapping-when-running-on-linux-kernels
# The workaround seems to be to set vm.mmap_rnd_bits=28
run: |
sudo cat /proc/sys/vm/mmap_rnd_bits
sudo sysctl vm.mmap_rnd_bits=28
ctest -j$(nproc) --output-on-failure -V
10 changes: 6 additions & 4 deletions .github/workflows/windows-clang.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,29 @@ jobs:
cd build
cmake .. -G "Visual Studio 17 2022" -T "ClangCl" -A "x64"
type ViSP-third-party.txt
pwd
- name: Build ViSP
working-directory: build
working-directory: ${{ github.workspace }}\build
run: |
pwd
cmake --build . --config Release
- name: Install ViSP
working-directory: build
working-directory: ${{ github.workspace }}\build
run: |
cmake --build . --config Release --target install
- name: Check installation folder
working-directory: build
working-directory: ${{ github.workspace }}\build
run: |
dir ${{ github.workspace }}\build\install\
dir ${{ github.workspace }}\build\install\x64\
dir ${{ github.workspace }}\build\install\x64\vc17\
dir ${{ github.workspace }}\build\install\x64\vc17\bin
- name: Test ViSP
working-directory: build
working-directory: ${{ github.workspace }}\build
run: |
set VISP_INPUT_IMAGE_PATH=${{ env.VISP_INPUT_IMAGE_PATH }}
echo "VISP_INPUT_IMAGE_PATH: "
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/windows-msvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

include:
- name: windows-latest
os: windows-2019
os: windows-2022

steps:
- name: Checkout repository
Expand All @@ -47,31 +47,31 @@ jobs:
echo %VISP_INPUT_IMAGE_PATH%
mkdir build
cd build
cmake .. -G "Visual Studio 16 2019" -A "x64"
cmake .. -G "Visual Studio 17 2022" -A "x64"
type ViSP-third-party.txt
- name: Build ViSP
working-directory: build
working-directory: ${{ github.workspace }}\build
run: |
cmake --build . --config Release
- name: Install ViSP
working-directory: build
working-directory: ${{ github.workspace }}\build
run: |
cmake --build . --config Release --target install
- name: Check installation folder
working-directory: build
working-directory: ${{ github.workspace }}\build
run: |
dir ${{ github.workspace }}\build\install\x64\vc16\bin
dir ${{ github.workspace }}\build\install\x64\vc17\bin
- name: Test ViSP
working-directory: build
working-directory: ${{ github.workspace }}\build
run: |
set VISP_INPUT_IMAGE_PATH=${{ env.VISP_INPUT_IMAGE_PATH }}
echo "VISP_INPUT_IMAGE_PATH: "
echo %VISP_INPUT_IMAGE_PATH%
set PATH=%PATH%;${{ github.workspace }}\build\install\x64\vc16\bin
set PATH=%PATH%;${{ github.workspace }}\build\install\x64\vc17\bin
echo "PATH: "
echo %PATH%
ctest --output-on-failure -C Release -V
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp"
"xutility": "cpp",
"execution": "cpp"
},
"C_Cpp.vcFormat.indent.namespaceContents": false,
"editor.formatOnSave": true,
Expand Down
155 changes: 116 additions & 39 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ endif()
if(POLICY CMP0075)
cmake_policy(SET CMP0075 NEW) # For check_include_file and cmake 3.12.0
endif()
if(POLICY CMP0146)
cmake_policy(SET CMP0146 OLD) # The ``FindCUDA`` module deprecated since CMake 3.10
endif()

if(APPLE)
# Fix following errors for libpng and libjpeg detection:
Expand All @@ -127,11 +130,7 @@ project(VISP C CXX)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

include(cmake/VISPUtils.cmake)
include(cmake/VISPDetectCXXStandard.cmake) # Set cxx standard to 11 by default

if (CMAKE_VERSION VERSION_LESS 3.0.0)
vp_clear_vars(VISPModules_TARGETS)
endif()
include(cmake/VISPDetectCXXStandard.cmake) # Set cxx standard to 17 by default

#-----------------------------------------------------------------------------
# VISP version number. An even minor number corresponds to releases.
Expand All @@ -146,8 +145,7 @@ set(VISP_REVISION "1")
#-----------------------------------------------------------------------------
# TO BE CHECKED BEFORE NEXT RELEASE
#
# see here: https://github.com/PointCloudLibrary/pcl/issues/3680
# when this is fixed, we can remove the following 3 lines.
# Remove following 3 next lines and check if pcl produces a CMP0144 complain around CMake variable FLANN_ROOT set to /opt/homebrew
if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
endif()
Expand Down Expand Up @@ -269,39 +267,93 @@ endif()

# --- Python Support ---
if(NOT IOS)
include(cmake/VISPDetectPython.cmake)
# Make sure to refresh the python interpreter every time we rerun cmake
# If we don't do this, we may use an old or invalid python when installing the bindings
# that was cached by a previous attempt at building
if(CMAKE_VERSION VERSION_LESS "3.15.0")
set(PYTHON3_CACHE_LIST
PYTHON3INTERP_FOUND PYTHONINTERP_FOUND PYTHONLIBS_FOUND PYTHON_FOUND
PYTHON3_EXECUTABLE PYTHON_EXECUTABLE
)
foreach (_variableName ${PYTHON3_CACHE_LIST})
unset(${_variableName} CACHE)
endforeach()
include(cmake/VISPDetectPython.cmake)
else()
set(PYTHON3_CACHE_LIST
Python3_FOUND Python3_EXECUTABLE Python3_Interpreter_FOUND Python3_LIBRARIES
_Python3_EXECUTABLE _Python3_INCLUDE_DIR _Python3_INTERPRETER_PROPERTIES _Python3_LIBRARY_RELEASE
)
foreach (_variableName ${PYTHON3_CACHE_LIST})
unset(${_variableName} CACHE)
endforeach()
# Find strategy
set(Python3_FIND_REGISTRY LAST)
set(Python3_FIND_VIRTUALENV FIRST)
set(Python3_FIND_STRATEGY LOCATION)
find_package (Python3 COMPONENTS Interpreter Development)

# Alias variables to be consistent with previous detection method
set(PYTHON3_FOUND ${Python3_FOUND})
set(PYTHON3_EXECUTABLE ${Python3_EXECUTABLE})
set(PYTHON_DEFAULT_EXECUTABLE ${PYTHON3_EXECUTABLE})
set(PYTHON3INTERP_FOUND ${Python3_Interpreter_FOUND})
set(PYTHON3_VERSION_STRING ${Python3_VERSION})
endif()
endif()

if(CMAKE_VERSION VERSION_LESS "3.19.0")
# --- Python Bindings requirements ---
VP_OPTION(USE_PYBIND11 pybind11 QUIET "Include pybind11 to create Python bindings" "" ON)

# Minimum tool versions
set(CMAKE_MINIMUM_VERSION_PYTHON_BINDINGS "3.19.0")
set(PYTHON3_MINIMUM_VERSION_PYTHON_BINDINGS "3.7.0")
if(CMAKE_VERSION VERSION_LESS ${CMAKE_MINIMUM_VERSION_PYTHON_BINDINGS})
set(CMAKE_NOT_OK_FOR_BINDINGS TRUE)
message(STATUS "Required CMake version for Python bindings is ${CMAKE_MINIMUM_VERSION_PYTHON_BINDINGS},
but you have ${CMAKE_VERSION}.
Python bindings generation will be deactivated.
")
else()
set(CMAKE_NOT_OK_FOR_BINDINGS FALSE)
endif()

if(CMAKE_NOT_OK_FOR_BINDINGS)
status("${CMAKE_NOT_OK_FOR_BINDINGS}")
status("CMake version required for Python bindings is 3.19.0, but you have ${CMAKE_VERSION}. Python bindings generation will be deactivated")
if(PYTHON3_VERSION_STRING VERSION_LESS ${PYTHON3_MINIMUM_VERSION_PYTHON_BINDINGS})
set(PYTHON3_NOT_OK_FOR_BINDINGS TRUE)
message(STATUS "Required Python version for Python bindings is ${PYTHON3_MINIMUM_VERSION_PYTHON_BINDINGS},
but you have ${PYTHON3_VERSION_STRING}.
Python bindings generation will be deactivated.
")
else()
set(PYTHON3_NOT_OK_FOR_BINDINGS FALSE)
endif()
if(VISP_CXX_STANDARD LESS VISP_CXX_STANDARD_17)
set(CXX_STANDARD_NOT_OK_FOR_BINDINGS TRUE)
message(STATUS "Required C++ standard is C++17, but you have ${VISP_CXX_STANDARD}")
else()
set(CXX_STANDARD_NOT_OK_FOR_BINDINGS FALSE)
endif()

# --- Python Bindings requirements ---

# this avoids non-active conda from getting picked anyway on Windows
#set(Python_FIND_REGISTRY LAST)
# Use environment variable PATH to decide preference for Python
#set(Python_FIND_VIRTUALENV FIRST)
#set(Python_FIND_STRATEGY LOCATION)

#find_package(Python 3.7 COMPONENTS Interpreter Development) # TODO: use visp function to find python?
#if(Python_FOUND)
# set(VISP_PYTHON_BINDINGS_EXECUTABLE "${Python_EXECUTABLE}")
#endif()
#find_package(pybind11)
VP_OPTION(USE_PYBIND11 pybind11 QUIET "Include pybind11 to create Python bindings" "" ON)

#if(pybind11_FOUND)
# set(VISP_PYBIND11_DIR "${pybind11_DIR}")
#endif()
#message("${pybind11_FOUND}")
# Forbid system Python
if(DEFINED ENV{VIRTUAL_ENV} OR DEFINED ENV{CONDA_PREFIX})
set(_pip_args)
set(VISP_PYTHON_IS_SYSTEM_WIDE FALSE)
else()
# First solution: raise an error when cmake will call pip install
# set(_pip_args "--require-virtualenv") # If this is a system python, throw an error
if(PYTHON3_FOUND)
message(STATUS "The python version that you are using (${PYTHON3_EXECUTABLE}) is the system interpreter.
pip packages should not be installed system-wide!
Python bindings targets will be deactivated!
To reenable them, install conda or virtualenv,
delete the CMakeCache file then rerun cmake when inside the virtual environment.
")
set(VISP_PYTHON_IS_SYSTEM_WIDE TRUE)
endif()
endif()

# ---


Expand Down Expand Up @@ -447,7 +499,7 @@ VP_OPTION(BUILD_ANDROID_EXAMPLES "" "" "Build examples for Android platform"
VP_OPTION(INSTALL_ANDROID_EXAMPLES "" "" "Install Android examples" "" OFF IF ANDROID )

# Build python bindings as an option
VP_OPTION(BUILD_PYTHON_BINDINGS "" "" "Build Python bindings" "" ON IF (PYTHON3INTERP_FOUND AND USE_PYBIND11 AND NOT CMAKE_NOT_OK_FOR_BINDINGS) )
VP_OPTION(BUILD_PYTHON_BINDINGS "" "" "Build Python bindings" "" ON IF (PYTHON3INTERP_FOUND AND USE_PYBIND11 AND NOT CMAKE_NOT_OK_FOR_BINDINGS AND NOT VISP_PYTHON_IS_SYSTEM_WIDE AND NOT PYTHON3_NOT_OK_FOR_BINDINGS AND NOT CXX_STANDARD_NOT_OK_FOR_BINDINGS) )
VP_OPTION(BUILD_PYTHON_BINDINGS_DOC "" "" "Build the documentation for the Python bindings" "" ON IF BUILD_PYTHON_BINDINGS )


Expand Down Expand Up @@ -628,6 +680,23 @@ if(USE_PCL)
vp_find_pcl(PCL_LIBRARIES PCL_DEPS_INCLUDE_DIRS PCL_DEPS_LIBRARIES)
endif()

# ----------------------------------------------------------------------------
# Handle OpenCV 2.4.8 as minimal version
# ----------------------------------------------------------------------------
if(USE_OPENCV)
if(OpenCV_VERSION)
if(OpenCV_VERSION VERSION_LESS "2.4.8")
message(WARNING "OpenCV 3rd party was detected but its version ${OpenCV_VERSION} is too old. Thus we disable OpenCV usage turning USE_OPENCV=OFF.")
unset(USE_OPENCV)
set(USE_OPENCV OFF CACHE BOOL "Include OpenCV support" FORCE)
endif()
else()
message(WARNING "OpenCV 3rd party was detected but its version cannot be found or is too old. Thus we disable OpenCV usage turning USE_OPENCV=OFF.")
unset(USE_OPENCV)
set(USE_OPENCV OFF CACHE BOOL "Include OpenCV support" FORCE)
endif()
endif()

# ----------------------------------------------------------------------------
# Handle cxx standard depending on specific 3rd parties. Should be before module parsing and VISP3rdParty.cmake include
# ----------------------------------------------------------------------------
Expand All @@ -642,7 +711,7 @@ endif()

if(VISP_CXX_STANDARD LESS VISP_CXX_STANDARD_14)
if(USE_FTIITSDK)
message(WARNING "IIT force-torque SDK 3rd party was detected and needs at least c++14 standard compiler flag while you have set c++${USE_CXX_STANDARD}. Thus we disable IIT force-torque usage turning USE_OPENCV=OFF.")
message(WARNING "IIT force-torque SDK 3rd party was detected and needs at least c++14 standard compiler flag while you have set c++${USE_CXX_STANDARD}. Thus we disable IIT force-torque usage turning USE_FTIITSDK=OFF.")
unset(USE_FTIITSDK)
set(USE_FTIITSDK OFF CACHE BOOL "Include IIT force-torque SDK support" FORCE)
endif()
Expand Down Expand Up @@ -694,13 +763,14 @@ if(VISP_CXX_STANDARD LESS VISP_CXX_STANDARD_11)
message(WARNING "std::thread was detected but needs at least c++11 standard compiler flag while you have set c++${USE_CXX_STANDARD}. Thus we disable std::thread usage turning USE_THREADS=OFF.")
unset(USE_THREADS)
set(USE_THREADS OFF CACHE BOOL "Include std::thread support" FORCE)
elseif(UNIX)
# Apriltag on unix needs pthread. On windows we are using pthread built-in
if(Threads_FOUND)
set(USE_PTHREAD ON) # for AprilTag only
endif()
endif()
endif()

if(UNIX AND Threads_FOUND)
# Apriltag on unix needs native pthread. On windows we are using pthread built-in
set(USE_PTHREAD ON) # for AprilTag only
endif()

# ----------------------------------------------------------------------------
# Build-in 3rd parties. Should be after c++ standard potential modification
# ----------------------------------------------------------------------------
Expand Down Expand Up @@ -1080,8 +1150,6 @@ VP_SET(VISP_HAVE_VICON TRUE IF (BUILD_MODULE_visp_sensor AND USE_VICON))
VP_SET(VISP_BUILD_SHARED_LIBS TRUE IF BUILD_SHARED_LIBS) # for header vpConfig.h
VP_SET(VISP_HAVE_DC1394_CAMERA_ENUMERATE TRUE IF (USE_DC1394 AND DC1394_CAMERA_ENUMERATE_FOUND)) # for header vpConfig.h
VP_SET(VISP_HAVE_DC1394_FIND_CAMERAS TRUE IF (USE_DC1394 AND DC1394_FIND_CAMERAS_FOUND)) # for header vpConfig.h
VP_SET(VISP_HAVE_D3D9 TRUE IF USE_DIRECT3D) # for header vpConfig.h
VP_SET(VISP_HAVE_GTK TRUE IF USE_GTK2) # for header vpConfig.h
VP_SET(VISP_HAVE_XRANDR TRUE IF XRANDR) # for header vpConfig.h
VP_SET(VISP_HAVE_NULLPTR TRUE IF HAVE_NULLPTR) # for header vpConfig.h

Expand Down Expand Up @@ -1605,8 +1673,17 @@ if(BUILD_PYTHON_BINDINGS)
status(" Package version:" "${VISP_PYTHON_PACKAGE_VERSION}")
status(" Wrapped modules:" "${VISP_PYTHON_BOUND_MODULES}")
status(" Generated input config:" "${VISP_PYTHON_GENERATED_CONFIG_FILE}")
else()
status(" Requirements: ")
status(" Python version > ${PYTHON3_MINIMUM_VERSION_PYTHON_BINDINGS}:" PYTHON3_FOUND AND NOT PYTHON3_NOT_OK_FOR_BINDINGS THEN "ok (ver ${PYTHON3_VERSION_STRING})" ELSE "python not found or too old (${PYTHON3_VERSION_STRING})")
status(" Python in Virtual environment or conda:" VISP_PYTHON_IS_SYSTEM_WIDE THEN "failed" ELSE "ok")
status(" Pybind11 found:" USE_PYBIND11 THEN "ok" ELSE "failed")
status(" CMake > ${CMAKE_MINIMUM_VERSION_PYTHON_BINDINGS}:" CMAKE_NOT_OK_FOR_BINDINGS THEN "failed (${CMAKE_VERSION})" ELSE "ok (${CMAKE_VERSION})")
status(" C++ standard > ${VISP_CXX_STANDARD_17}:" CXX_STANDARD_NOT_OK_FOR_BINDINGS THEN "failed (${VISP_CXX_STANDARD})" ELSE "ok (${VISP_CXX_STANDARD})")

endif()


# ============================ Options ===========================
status("")
status(" Build options: ")
Expand Down Expand Up @@ -1732,7 +1809,7 @@ status("")
status(" Optimization: ")
status(" Use OpenMP:" USE_OPENMP THEN "yes" ELSE "no")
status(" Use std::thread:" USE_THREADS THEN "yes" ELSE "no")
status(" Use pthread:" USE_PHREADS THEN "yes" ELSE "no")
status(" Use pthread:" USE_PTHREAD THEN "yes" ELSE "no")
status(" Use pthread (built-in):" WITH_PTHREAD THEN "yes (ver ${PTHREADS_VERSION})" ELSE "no")
status(" Use simdlib (built-in):" WITH_SIMDLIB THEN "yes" ELSE "no")
status("")
Expand Down
Loading

0 comments on commit 70af294

Please sign in to comment.