From d052f99c4dfcb9c55546a21d270f70c26854ee44 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Fri, 25 Oct 2024 18:47:20 +0200 Subject: [PATCH 001/131] initial deps moved to vcpkg --- cmake/depthaiDependencies.cmake | 12 +++--------- vcpkg.json | 11 ++++++++++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake index 1e710c2f4c..d2524ac428 100644 --- a/cmake/depthaiDependencies.cmake +++ b/cmake/depthaiDependencies.cmake @@ -14,14 +14,10 @@ else() hunter_add_package(XLink) endif() hunter_add_package(BZip2) - hunter_add_package(FP16) hunter_add_package(libarchive-luxonis) hunter_add_package(spdlog) - hunter_add_package(ZLIB) hunter_add_package(lz4-luxonis) hunter_add_package(httplib) - hunter_add_package(PNG) - hunter_add_package(TIFF) hunter_add_package(mp4v2) if(DEPTHAI_ENABLE_CURL) hunter_add_package(CURL) @@ -31,19 +27,16 @@ else() hunter_add_package(Backward) endif() hunter_add_package(libnop) - if(DEPTHAI_RTABMAP_SUPPORT) - hunter_add_package(rtbmap COMPONENTS core utilite) - endif() if(DEPTHAI_BASALT_SUPPORT) hunter_add_package(Eigen) hunter_add_package(basalt-headers) hunter_add_package(basalt) hunter_add_package(oneTBB) endif() - hunter_add_package(yaml-cpp) + # hunter_add_package(yaml-cpp) hunter_add_package(semver) if(DEPTHAI_HAS_APRIL_TAG) - hunter_add_package(apriltag) + # hunter_add_package(apriltag) endif() endif() @@ -113,6 +106,7 @@ find_package(mp4v2 ${_QUIET} CONFIG REQUIRED) # TODO(Morato) - potentially move this to a private library find_package(Protobuf ${_QUIET} CONFIG REQUIRED) + # XLink if(DEPTHAI_XLINK_LOCAL AND (NOT CONFIG_MODE)) set(_BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}") diff --git a/vcpkg.json b/vcpkg.json index 581dc80206..7ea7262c1c 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,7 +1,16 @@ { "dependencies": [ "websocketpp", - "protobuf" + "protobuf", + { + "name": "rtabmap", + "default-features": false + }, + "libpng", + "tiff", + "yaml-cpp", + "apriltag", + "fp16" ], "builtin-baseline": "f5ec6f30ff70f04f841436a0f36600bdbabfcfbf" } From 757dfd5d229be60df7dd8d9f0c99f7d74fd394ce Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 28 Oct 2024 14:33:34 +0100 Subject: [PATCH 002/131] optional features --- CMakeLists.txt | 22 ++++++---- cmake/Hunter/config.cmake | 73 --------------------------------- cmake/depthaiDependencies.cmake | 6 +-- vcpkg.json | 38 +++++++++++------ 4 files changed, 41 insertions(+), 98 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ba9e1eff7..a63b9c9ed7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,18 @@ cmake_minimum_required(VERSION 3.4) # For Hunter +# Build AprilTag node code (note, that even if set to OFF, an AprilTagNode can be used with setRunOnHost(false)) +option(DEPTHAI_ENABLE_APRIL_TAG "Enable AprilTag node" ON) +set(DEPTHAI_HAS_APRIL_TAG ${DEPTHAI_ENABLE_APRIL_TAG}) +if(WIN32) + message(STATUS "AprilTag node is not supported on Windows") + set(DEPTHAI_HAS_APRIL_TAG OFF) +endif() +if(DEPTHAI_HAS_APRIL_TAG) +list(APPEND VCPKG_MANIFEST_FEATURES "apriltag") +endif() +option(DEPTHAI_RTABMAP_SUPPORT "Enable optional RTABMap support" OFF) +if(DEPTHAI_RTABMAP_SUPPORT) +list(APPEND VCPKG_MANIFEST_FEATURES "rtabmap") +endif() include(cmake/vcpkg.cmake) # MSVC variable isn't available before 'project' call # Generalize to Win32 platform for now @@ -42,13 +56,6 @@ else() message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}") endif() -# Build AprilTag node code (note, that even if set to OFF, an AprilTagNode can be used with setRunOnHost(false)) -option(DEPTHAI_ENABLE_APRIL_TAG "Enable AprilTag node" ON) -set(DEPTHAI_HAS_APRIL_TAG ${DEPTHAI_ENABLE_APRIL_TAG}) -if(WIN32) - message(STATUS "AprilTag node is not supported on Windows") - set(DEPTHAI_HAS_APRIL_TAG OFF) -endif() include("cmake/HunterGate.cmake") HunterGate( @@ -200,7 +207,6 @@ endif() option(DEPTHAI_XTENSOR_SUPPORT "Enable optional xtensor support" ON) option(DEPTHAI_OPENCV_SUPPORT "Enable optional OpenCV support" ON) option(DEPTHAI_PCL_SUPPORT "Enable optional PCL support" OFF) -option(DEPTHAI_RTABMAP_SUPPORT "Enable optional RTABMap support" OFF) option(DEPTHAI_BASALT_SUPPORT "Enable optional Basalt support" OFF) option(DEPTHAI_MERGED_TARGET "Enable merged target build" ON) diff --git a/cmake/Hunter/config.cmake b/cmake/Hunter/config.cmake index 94b3f22241..b5fa5162c8 100644 --- a/cmake/Hunter/config.cmake +++ b/cmake/Hunter/config.cmake @@ -153,70 +153,6 @@ hunter_config( ) -# RTABMap -hunter_config( - rtbmap - VERSION "0.21.4" - URL "https://github.com/introlab/rtabmap/archive/623d056436946c35beb12199831f178a84eaad73.zip" # until fixes are merged to main - SHA1 "98768b5adea093cc5e1bbe74b2ad3749e61de0ef" - CMAKE_ARGS - BUILD_APP=OFF - WITH_UDEV=OFF - BUILD_EXAMPLES=OFF - BUILD_TOOLS=OFF - BUILD_SHARED_LIBS=OFF - WITH_QT=OFF - WITH_ORB_OCTREE=OFF - WITH_TORCH=OFF - WITH_PYTHON=OFF - WITH_PYTHON_THREADING=OFF - WITH_PDAL=OFF - WITH_FREENECT=OFF - WITH_FREENECT2=OFF - WITH_K4W2=OFF - WITH_K4A=OFF - WITH_OPENNI=OFF - WITH_OPENNI2=OFF - WITH_DC1394=OFF - WITH_G2O=ON - WITH_GTSAM=ON - WITH_TORO=ON - WITH_CERES=OFF - WITH_MRPT=OFF - WITH_VERTIGO=ON - WITH_CVSBA=OFF - WITH_POINTMATCHER=ON - WITH_CCCORELIB=OFF - WITH_OPEN3D=OFF - WITH_LOAM=OFF - WITH_FLOAM=OFF - WITH_FLYCAPTURE2=OFF - WITH_ZED=OFF - WITH_ZEDOC=OFF - WITH_REALSENSE=OFF - WITH_REALSENSE_SLAM=OFF - WITH_REALSENSE2=OFF - WITH_MYNTEYE=OFF - WITH_DEPTHAI=OFF - WITH_OCTOMAP=OFF - WITH_GRIDMAP=OFF - WITH_CPUTSDF=OFF - WITH_OPENCHISEL=OFF - WITH_ALICE_VISION=OFF - WITH_FOVIS=OFF - WITH_VISO2=OFF - WITH_DVO=OFF - WITH_ORB_SLAM=OFF - WITH_OKVIS=OFF - WITH_MSCKF_VIO=OFF - WITH_VINS=OFF - WITH_OPENVINS=OFF - WITH_MADGWICK=OFF - WITH_FASTCV=OFF - WITH_OPENMP=OFF - WITH_OPENGV=OFF - PCL_OMP=OFF -) # Pybind11 2.9.2 # # Pybind11 2.11.0-smart_holder # hunter_config( @@ -329,12 +265,3 @@ hunter_config( SHA1 "c9ac79025cc259d8cca454be0865e88f154402be" ) -# Only include april tag if needed -if(DEPTHAI_HAS_APRIL_TAG) - hunter_config( - apriltag - VERSION "3.4.2" - URL "https://github.com/AprilRobotics/apriltag/archive/v3.4.2.tar.gz" - SHA1 "5fe51a652e451aedd11f8966abdb8f16bb1faefe" - ) -endif() diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake index d2524ac428..8318a6cf36 100644 --- a/cmake/depthaiDependencies.cmake +++ b/cmake/depthaiDependencies.cmake @@ -14,6 +14,7 @@ else() hunter_add_package(XLink) endif() hunter_add_package(BZip2) + hunter_add_package(FP16) hunter_add_package(libarchive-luxonis) hunter_add_package(spdlog) hunter_add_package(lz4-luxonis) @@ -33,13 +34,8 @@ else() hunter_add_package(basalt) hunter_add_package(oneTBB) endif() - # hunter_add_package(yaml-cpp) hunter_add_package(semver) - if(DEPTHAI_HAS_APRIL_TAG) - # hunter_add_package(apriltag) - endif() endif() - # If library was build as static, find all dependencies if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS)) diff --git a/vcpkg.json b/vcpkg.json index 7ea7262c1c..b8dfd29f83 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,16 +1,30 @@ { - "dependencies": [ - "websocketpp", - "protobuf", - { - "name": "rtabmap", - "default-features": false - }, + "name": "depthai", + "dependencies": [ + "websocketpp", + "protobuf", "libpng", "tiff", - "yaml-cpp", - "apriltag", - "fp16" - ], - "builtin-baseline": "f5ec6f30ff70f04f841436a0f36600bdbabfcfbf" + "yaml-cpp" + ], + "features": { + "rtabmap": { + "description": "Enable RTAB-Map support", + "dependencies": [ + { + "name": "rtabmap", + "default-features": false + } + ] + }, + "apriltag": { + "description": "Enable AprilTag support", + "dependencies": [ + { + "name": "apriltag" + } + ] + } + }, + "builtin-baseline": "f5ec6f30ff70f04f841436a0f36600bdbabfcfbf" } From 62e9331bc3830baf521c288fa334111abd588414 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 28 Oct 2024 16:20:23 +0100 Subject: [PATCH 003/131] vcpkg ports for httplib xlink and zlib --- cmake/Hunter/config.cmake | 26 -------------------------- cmake/depthaiDependencies.cmake | 10 ++-------- cmake/ports/httplib/portfile.cmake | 18 ++++++++++++++++++ cmake/ports/httplib/vcpkg.json | 16 ++++++++++++++++ cmake/ports/xlink/portfile.cmake | 15 +++++++++++++++ cmake/ports/xlink/vcpkg.json | 15 +++++++++++++++ cmake/ports/zlib/portfile.cmake | 16 ++++++++++++++++ cmake/ports/zlib/vcpkg.json | 16 ++++++++++++++++ vcpkg-configuration.json | 5 ++++- vcpkg.json | 14 +++++++------- 10 files changed, 109 insertions(+), 42 deletions(-) create mode 100644 cmake/ports/httplib/portfile.cmake create mode 100644 cmake/ports/httplib/vcpkg.json create mode 100644 cmake/ports/xlink/portfile.cmake create mode 100644 cmake/ports/xlink/vcpkg.json create mode 100644 cmake/ports/zlib/portfile.cmake create mode 100644 cmake/ports/zlib/vcpkg.json diff --git a/cmake/Hunter/config.cmake b/cmake/Hunter/config.cmake index b5fa5162c8..13c55c68c5 100644 --- a/cmake/Hunter/config.cmake +++ b/cmake/Hunter/config.cmake @@ -1,22 +1,3 @@ -# hunter_config( -# nlohmann_json -# VERSION "3.9.1" -# URL "https://github.com/nlohmann/json/archive/v3.9.1.tar.gz" -# SHA1 "f8a20a7e19227906d77de0ede97468fbcfea03e7" -# ) -hunter_config( - nlohmann_json - VERSION "3.9.1" -) - -hunter_config( - XLink - VERSION "luxonis-develop-server" - URL "https://github.com/luxonis/XLink/archive/585a38fe4707e5f023de277135d8cb6ff9c4e0c4.tar.gz" - SHA1 "d82827dec8b6f2702f4b31d8186fd70265cd0ca4" - CMAKE_ARGS - XLINK_ENABLE_LIBUSB=${DEPTHAI_ENABLE_LIBUSB} -) hunter_config( BZip2 @@ -112,13 +93,6 @@ hunter_config( SHA1 "4c308576c856a43dc88949a8f64ef90ebf94ae1b" ) -# ZLib - Luxonis fix for alias on imported target for old CMake versions -hunter_config( - ZLIB - VERSION "1.2.11-p2" - URL "https://github.com/luxonis/zlib/archive/refs/tags/v1.2.11-p2.tar.gz" - SHA1 "fb8b6486183b13a86040f793a939b128f6d27095" -) # LZ4 for mcap hunter_config( diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake index 8318a6cf36..d5a626a152 100644 --- a/cmake/depthaiDependencies.cmake +++ b/cmake/depthaiDependencies.cmake @@ -9,16 +9,10 @@ if(CONFIG_MODE) set(_QUIET "QUIET") else() set(DEPTHAI_SHARED_LIBS ${BUILD_SHARED_LIBS}) - hunter_add_package(nlohmann_json) - if(NOT DEPTHAI_XLINK_LOCAL) - hunter_add_package(XLink) - endif() hunter_add_package(BZip2) hunter_add_package(FP16) hunter_add_package(libarchive-luxonis) - hunter_add_package(spdlog) hunter_add_package(lz4-luxonis) - hunter_add_package(httplib) hunter_add_package(mp4v2) if(DEPTHAI_ENABLE_CURL) hunter_add_package(CURL) @@ -48,6 +42,8 @@ if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS)) # libarchive for firmware packages find_package(archive_static ${_QUIET} CONFIG REQUIRED) find_package(lzma ${_QUIET} CONFIG REQUIRED) + # httplib for Gate communication + find_package(httplib ${_QUIET} CONFIG REQUIRED) # ZLIB for compressing Apps find_package(ZLIB CONFIG REQUIRED) find_package(lz4 CONFIG REQUIRED) @@ -55,8 +51,6 @@ if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS)) # spdlog for library and device logging find_package(spdlog ${_QUIET} CONFIG REQUIRED) - # httplib for Gate communication - find_package(httplib ${_QUIET} CONFIG REQUIRED) # Log collection dependencies if(DEPTHAI_ENABLE_CURL) find_package(CURL ${_QUIET} CONFIG REQUIRED) diff --git a/cmake/ports/httplib/portfile.cmake b/cmake/ports/httplib/portfile.cmake new file mode 100644 index 0000000000..c3f1656e77 --- /dev/null +++ b/cmake/ports/httplib/portfile.cmake @@ -0,0 +1,18 @@ + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO luxonis/cpp-httplib + REF 3ba99c06f655a52e701c9a7ae5dc48850582d95b + SHA512 282b4fd205d2de8ffc9ee901c2f2628ce10d992e5c9979de8e7509ac5fca94e1dae4cd6205b91885b9113465c9e5b64a78ae87dcc951eedcebaf27d0ee80050d + HEAD_REF master +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + HTTPLIB_USE_OPENSSL_IF_AVAILABLE=OFF + HTTPLIB_USE_BROTLI_IF_AVAILABLE=OFF +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/httplib") diff --git a/cmake/ports/httplib/vcpkg.json b/cmake/ports/httplib/vcpkg.json new file mode 100644 index 0000000000..1db0363506 --- /dev/null +++ b/cmake/ports/httplib/vcpkg.json @@ -0,0 +1,16 @@ + +{ + "name": "httplib", + "version-string": "0.11.2", + "description": "A C++ header-only HTTP/HTTPS server and client library", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } +] +} diff --git a/cmake/ports/xlink/portfile.cmake b/cmake/ports/xlink/portfile.cmake new file mode 100644 index 0000000000..4cc7be7c12 --- /dev/null +++ b/cmake/ports/xlink/portfile.cmake @@ -0,0 +1,15 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO luxonis/XLink + REF 585a38fe4707e5f023de277135d8cb6ff9c4e0c4 + SHA512 e27834680374f348ffb590e181b3592df77c33d2de2c3b78061ff20d3315be5d4688da4ecfca8b3f914955367713ed53d50e61049b2f4eb95d6606b2426de7be + HEAD_REF master +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + XLINK_ENABLE_LIBUSB=${DEPTHAI_ENABLE_LIBUSB} +) + +vcpkg_cmake_install() + diff --git a/cmake/ports/xlink/vcpkg.json b/cmake/ports/xlink/vcpkg.json new file mode 100644 index 0000000000..f7405a50ae --- /dev/null +++ b/cmake/ports/xlink/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "xlink", + "version-string": "luxonis-develop-server", + "description": "A cross-platform library for communicating with devices over various physical links.", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } +] +} diff --git a/cmake/ports/zlib/portfile.cmake b/cmake/ports/zlib/portfile.cmake new file mode 100644 index 0000000000..6605a0a509 --- /dev/null +++ b/cmake/ports/zlib/portfile.cmake @@ -0,0 +1,16 @@ + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO luxonis/zlib + REF 0e5eb7e3ca8e2cd929148968dc0c8f54ed4c4ede + SHA512 096f008157da402c72f74aedf6480aca755c9c4eb8e594437427b46d2b29f721b87443ac6de11466d3787e93ff57c767e8a8ecd030cc93ddc1885c1e6ab41a97 + HEAD_REF hunter-1.2.11 +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + XLINK_ENABLE_LIBUSB=${DEPTHAI_ENABLE_LIBUSB} +) + +vcpkg_cmake_install() + diff --git a/cmake/ports/zlib/vcpkg.json b/cmake/ports/zlib/vcpkg.json new file mode 100644 index 0000000000..cf00b90e7c --- /dev/null +++ b/cmake/ports/zlib/vcpkg.json @@ -0,0 +1,16 @@ + +{ + "name": "zlib", + "version-string": "1.2.11-p2", + "description": "A massively spiffy yet delicately unobtrusive compression library.", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } +] +} diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index 911e73c11d..a27db75cf2 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -10,5 +10,8 @@ "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", "name": "microsoft" } - ] + ], + "overlay-ports": [ + "./cmake/ports" + ] } diff --git a/vcpkg.json b/vcpkg.json index 2db3d29a6c..575c8ac8df 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -3,9 +3,15 @@ "dependencies": [ "websocketpp", "protobuf", + "openssl", "libpng", "tiff", - "yaml-cpp" + "yaml-cpp", + "nlohmann-json", + "spdlog", + "xlink", + "httplib", + "zlib" ], "features": { "rtabmap": { @@ -27,10 +33,4 @@ } }, "builtin-baseline": "f5ec6f30ff70f04f841436a0f36600bdbabfcfbf" - "dependencies": [ - "websocketpp", - "protobuf", - "openssl" - ], - "builtin-baseline": "f5ec6f30ff70f04f841436a0f36600bdbabfcfbf" } From f81d04b37e1228f4e3e0c77d5deb1627378e2208 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 29 Oct 2024 14:57:29 +0100 Subject: [PATCH 004/131] downloading deps from vcpkg --- CMakeLists.txt | 62 +++--- bindings/python/CMakeLists.txt | 1 - cmake/Hunter/config.cmake | 200 ------------------ cmake/depthaiDependencies.cmake | 32 +-- cmake/ports/basalt-headers/portfile.cmake | 14 ++ cmake/ports/basalt-headers/vcpkg.json | 20 ++ cmake/ports/basalt/portfile.cmake | 17 ++ cmake/ports/basalt/vcpkg.json | 18 ++ cmake/ports/cpr/portfile.cmake | 16 ++ cmake/ports/cpr/vcpkg.json | 19 ++ cmake/ports/fp16/portfile.cmake | 18 ++ cmake/ports/fp16/vcpkg.json | 17 ++ cmake/ports/httplib/portfile.cmake | 5 +- cmake/ports/httplib/vcpkg.json | 1 - cmake/ports/libarchive-luxonis/portfile.cmake | 45 ++++ cmake/ports/libarchive-luxonis/vcpkg.json | 16 ++ cmake/ports/libnop/portfile.cmake | 13 ++ cmake/ports/libnop/vcpkg.json | 15 ++ cmake/ports/lz4-luxonis/portfile.cmake | 15 ++ cmake/ports/lz4-luxonis/vcpkg.json | 15 ++ cmake/ports/mp4v2/portfile.cmake | 18 ++ cmake/ports/mp4v2/vcpkg.json | 17 ++ cmake/ports/pybind11/portfile.cmake | 13 ++ cmake/ports/pybind11/vcpkg.json | 16 ++ cmake/ports/spdlog/portfile.cmake | 20 ++ cmake/ports/spdlog/vcpkg.json | 17 ++ cmake/ports/xlink/portfile.cmake | 3 +- cmake/ports/zlib/portfile.cmake | 1 - tests/CMakeLists.txt | 1 - vcpkg.json | 40 +++- 30 files changed, 442 insertions(+), 263 deletions(-) create mode 100644 cmake/ports/basalt-headers/portfile.cmake create mode 100644 cmake/ports/basalt-headers/vcpkg.json create mode 100644 cmake/ports/basalt/portfile.cmake create mode 100644 cmake/ports/basalt/vcpkg.json create mode 100644 cmake/ports/cpr/portfile.cmake create mode 100644 cmake/ports/cpr/vcpkg.json create mode 100644 cmake/ports/fp16/portfile.cmake create mode 100644 cmake/ports/fp16/vcpkg.json create mode 100644 cmake/ports/libarchive-luxonis/portfile.cmake create mode 100644 cmake/ports/libarchive-luxonis/vcpkg.json create mode 100644 cmake/ports/libnop/portfile.cmake create mode 100644 cmake/ports/libnop/vcpkg.json create mode 100644 cmake/ports/lz4-luxonis/portfile.cmake create mode 100644 cmake/ports/lz4-luxonis/vcpkg.json create mode 100644 cmake/ports/mp4v2/portfile.cmake create mode 100644 cmake/ports/mp4v2/vcpkg.json create mode 100644 cmake/ports/pybind11/portfile.cmake create mode 100644 cmake/ports/pybind11/vcpkg.json create mode 100644 cmake/ports/spdlog/portfile.cmake create mode 100644 cmake/ports/spdlog/vcpkg.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 451f817d3c..fd428f748c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.4) # For Hunter + # Build AprilTag node code (note, that even if set to OFF, an AprilTagNode can be used with setRunOnHost(false)) option(DEPTHAI_ENABLE_APRIL_TAG "Enable AprilTag node" ON) set(DEPTHAI_HAS_APRIL_TAG ${DEPTHAI_ENABLE_APRIL_TAG}) @@ -13,15 +14,45 @@ option(DEPTHAI_RTABMAP_SUPPORT "Enable optional RTABMap support" OFF) if(DEPTHAI_RTABMAP_SUPPORT) list(APPEND VCPKG_MANIFEST_FEATURES "rtabmap") endif() +option(DEPTHAI_BASALT_SUPPORT "Enable optional Basalt support" OFF) +if(DEPTHAI_BASALT_SUPPORT) +list(APPEND VCPKG_MANIFEST_FEATURES "basalt") +endif() +# Enable backward stack printing on crash +if(ANDROID OR EMSCRIPTEN) + # Backward not supported currently on Android + set(DEPTHAI_ENABLE_BACKWARD OFF CACHE BOOL "" FORCE) +else() + option(DEPTHAI_ENABLE_BACKWARD "Enable stacktrace printing on crash using Backward" ON) + # Additional function information for 'backward' stacktrace + if(DEPTHAI_ENABLE_BACKWARD) + set(CMAKE_ENABLE_EXPORTS ON) + list(APPEND VCPKG_MANIFEST_FEATURES "backward") + endif() +endif() + + +# Check if on 32 bit linux - default without CURL support +if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND UNIX) + set(DEPTHAI_DEFAULT_CURL_SUPPORT OFF) +else() + set(DEPTHAI_DEFAULT_CURL_SUPPORT ON) +endif() + +option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT}) +if(DEPTHAI_ENABLE_CURL) + list(APPEND VCPKG_MANIFEST_FEATURES "curl") +endif() +# Early options +option(DEPTHAI_ENABLE_LIBUSB "Enable usage of libusb and interaction with USB devices" ON) include(cmake/vcpkg.cmake) + # MSVC variable isn't available before 'project' call # Generalize to Win32 platform for now if(NOT WIN32) set(HUNTER_CONFIGURATION_TYPES "Release" CACHE STRING "Hunter dependencies list of build configurations") endif() -# Early options -option(DEPTHAI_ENABLE_LIBUSB "Enable usage of libusb and interaction with USB devices" ON) # Set to use native tls for windows before including Hunter (used for Curl) if(WIN32) @@ -129,26 +160,7 @@ option(DEPTHAI_INSTALL "Enable install target for depthai-core targets" ON) set(DEPTHAI_XLINK_LOCAL "" CACHE STRING "Path to local XLink source to use instead of Hunter") set(DEPTHAI_BOOTLOADER_SHARED_LOCAL "" CACHE STRING "Path to local depthai-bootloader-shared source to use instead of submodule") -# Enable backward stack printing on crash -if(ANDROID OR EMSCRIPTEN) - # Backward not supported currently on Android - set(DEPTHAI_ENABLE_BACKWARD OFF CACHE BOOL "" FORCE) -else() - option(DEPTHAI_ENABLE_BACKWARD "Enable stacktrace printing on crash using Backward" ON) - # Additional function information for 'backward' stacktrace - if(DEPTHAI_ENABLE_BACKWARD) - set(CMAKE_ENABLE_EXPORTS ON) - endif() -endif() - -# Check if on 32 bit linux - default without CURL support -if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND UNIX) - set(DEPTHAI_DEFAULT_CURL_SUPPORT OFF) -else() - set(DEPTHAI_DEFAULT_CURL_SUPPORT ON) -endif() -option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT}) # Force Colored output when using Ninja # Global option - affects all targets @@ -208,7 +220,6 @@ endif() option(DEPTHAI_XTENSOR_SUPPORT "Enable optional xtensor support" ON) option(DEPTHAI_OPENCV_SUPPORT "Enable optional OpenCV support" ON) option(DEPTHAI_PCL_SUPPORT "Enable optional PCL support" OFF) -option(DEPTHAI_BASALT_SUPPORT "Enable optional Basalt support" OFF) option(DEPTHAI_MERGED_TARGET "Enable merged target build" ON) @@ -694,7 +705,7 @@ target_link_libraries(${TARGET_CORE_NAME} PRIVATE XLink Threads::Threads - BZip2::bz2 + BZip2::BZip2 FP16::fp16 archive_static ZLIB::zlib @@ -932,14 +943,13 @@ endif() # Basalt Support ######################## -set(THIRDPARTY_BASALT_LIBRARIES "TBB::tbb;Eigen3::Eigen;basalt_sdk::basalt_sdk" CACHE STRING "Optional libraries to link Basalt support, e.g. TBB::tbb") +set(THIRDPARTY_BASALT_LIBRARIES "basalt_sdk::basalt_sdk" CACHE STRING "Optional libraries to link Basalt support, e.g. TBB::tbb") set(TARGET_BASALT_NAME ${PROJECT_NAME}-basalt) set(TARGET_BASALT_ALIAS basalt) if(DEPTHAI_BASALT_SUPPORT) # Check if required libraries are available find_package(basalt_sdk CONFIG REQUIRED) - find_package(TBB CONFIG REQUIRED) set(BASALT_SUPPORT_AVAILABLE ${basalt_sdk_FOUND}) if(BASALT_SUPPORT_AVAILABLE) @@ -1100,7 +1110,7 @@ configure_file("cmake/${PROJECT_NAME}Dependencies.cmake" ${PROJECT_NAME}Dependen write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY AnyNewerVersion) # Configure config file (one for exporting build directory, one for installation) -file(RELATIVE_PATH DEPTHAI_DEPENDENCIES_INSTALLATION_PATH_REL "${CMAKE_CURRENT_BINARY_DIR}" "${HUNTER_INSTALL_PREFIX}") +# file(RELATIVE_PATH DEPTHAI_DEPENDENCIES_INSTALLATION_PATH_REL "${CMAKE_CURRENT_BINARY_DIR}" "${HUNTER_INSTALL_PREFIX}") configure_file(cmake/${PROJECT_NAME}Config.cmake.in ${PROJECT_NAME}Config.cmake @ONLY) # Config for installation diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index 77c93ebf8d..bbd805e788 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -43,7 +43,6 @@ option(DEPTHAI_PYTHON_EMBEDDED_MODULE "Create an embeddable module" OFF) # Add pybind11 dependency #add_subdirectory(pybind11-2.5.0) -hunter_add_package(pybind11) # Disable LTO if MINGW compiler if(MINGW) diff --git a/cmake/Hunter/config.cmake b/cmake/Hunter/config.cmake index 13c55c68c5..c65f12a1f1 100644 --- a/cmake/Hunter/config.cmake +++ b/cmake/Hunter/config.cmake @@ -1,90 +1,4 @@ -hunter_config( - BZip2 - VERSION "1.0.8-p0" -) - -hunter_config( - spdlog - VERSION "1.8.2" - URL "https://github.com/gabime/spdlog/archive/v1.8.2.tar.gz" - SHA1 "4437f350ca7fa89a0cd8faca1198afb36823f775" - CMAKE_ARGS - SPDLOG_BUILD_EXAMPLE=OFF - SPDLOG_FMT_EXTERNAL=OFF - CMAKE_CXX_VISIBILITY_PRESET=hidden - CMAKE_C_VISIBILITY_PRESET=hidden -) - -# libarchive, luxonis fork -hunter_config( - libarchive-luxonis - VERSION "hunter-3.5.2" - URL "https://github.com/luxonis/libarchive/archive/45baa3a3e57104519e1165bcd5ac29c3bd8c9f3a.tar.gz" - SHA1 "ca5cd0f1c31b9c187d7119cb1aa7467f8c231d29" - CMAKE_ARGS - ENABLE_ACL=OFF - ENABLE_BZip2=OFF - ENABLE_CAT=OFF - ENABLE_CAT_SHARED=OFF - ENABLE_CNG=OFF - ENABLE_COVERAGE=OFF - ENABLE_CPIO=OFF - ENABLE_CPIO_SHARED=OFF - ENABLE_EXPAT=OFF - ENABLE_ICONV=OFF - ENABLE_INSTALL=ON - ENABLE_LIBB2=OFF - ENABLE_LIBXML2=OFF - ENABLE_LZ4=OFF - ENABLE_LZMA=ON - ENABLE_LZO=OFF - ENABLE_LibGCC=OFF - ENABLE_MBEDTLS=OFF - ENABLE_NETTLE=OFF - ENABLE_OPENSSL=OFF - ENABLE_PCREPOSIX=OFF - ENABLE_SAFESEH=AUTO - ENABLE_TAR=OFF - ENABLE_TAR_SHARED=OFF - ENABLE_TEST=OFF - ENABLE_WERROR=OFF - ENABLE_XATTR=OFF - ENABLE_ZLIB=OFF - ENABLE_ZSTD=OFF -) - -# Luxonis FP16 fork which doesn't use git cloning for its dependencies -hunter_config( - FP16 - VERSION "luxonis-0.0.0" - URL "https://github.com/luxonis/FP16/archive/c911175d2717e562976e606c6e5f799bf40cf94e.tar.gz" - SHA1 "40e9723c87c2fe21781132c0f2f8b90338500e32" - CMAKE_ARGS - FP16_BUILD_BENCHMARKS=OFF - FP16_BUILD_TESTS=OFF -) - -if(NOT EMSCRIPTEN) - # Backward - Stacktrace printer - hunter_config( - Backward - VERSION "1.6" - URL "https://github.com/bombela/backward-cpp/archive/refs/tags/v1.6.tar.gz" - SHA1 "4ecb711eabfd15bc88ff9dd9342907fc5da46b62" - CMAKE_ARGS - BACKWARD_TESTS=OFF - ) -endif() - -# libnop - Serialization -hunter_config( - libnop - VERSION "1.0-ec8f75a" - URL "https://github.com/luxonis/libnop/archive/ab842f51dc2eb13916dc98417c2186b78320ed10.tar.gz" - SHA1 "32f40f084615ba7940ce9d29f05f3294371aabeb" -) - # Specific Catch2 version hunter_config( Catch2 @@ -94,13 +8,6 @@ hunter_config( ) -# LZ4 for mcap -hunter_config( - lz4-luxonis - VERSION "1.9.4-p2" - URL "https://github.com/luxonis/lz4/archive/ba358ed311d125333d245e4c284464a72a168983.tar.gz" - SHA1 "43ae0d2343147e32cdd8b85cefb5a311c3ee5504" -) # TMP, could be read from XLink # libusb without udev @@ -115,26 +22,6 @@ hunter_config( BUILD_SHARED_LIBS=ON ) -# cpp-httplib -hunter_config( - httplib - VERSION "0.11.2" - URL "https://github.com/luxonis/cpp-httplib/archive/3ba99c06f655a52e701c9a7ae5dc48850582d95b.tar.gz" - SHA1 "84ddd5d58a210b6203c50760d2ebde75b0ff6376" - CMAKE_ARGS - HTTPLIB_USE_OPENSSL_IF_AVAILABLE=OFF - HTTPLIB_USE_BROTLI_IF_AVAILABLE=OFF -) - - -# Pybind11 2.9.2 -# # Pybind11 2.11.0-smart_holder -# hunter_config( -# pybind11 -# VERSION "2.11.0-smart_holder" -# URL "https://github.com/pybind/pybind11/archive/10283c2ef44a9100bc88d066a4972c4f51ded2b0.tar.gz" -# SHA1 "0da09bdd6987a33feb800e4b7f129df5c9aa5aed" -# ) # Pybind11 2.9.2-smart_holder hunter_config( @@ -144,93 +31,6 @@ hunter_config( SHA1 "d53247e4d1af52be040b647de0c25eb336bc85c7" ) -hunter_config( - mp4v2 - VERSION "2.1.3" - URL "https://github.com/luxonis/mp4v2/archive/1dc9f4d24645ea43405582e5c813dec3eaa8fd3e.tar.gz" - SHA1 "2ac9e4348c78d09a3b4fc6e147b9eeb356ba31f1" - CMAKE_ARGS - BUILD_SHARED=OFF - BUILD_UTILS=OFF -) - - -hunter_config( - basalt-headers - VERSION 0.1.0 - URL "https://github.com/luxonis/basalt-headers/archive/e3ee456469f21a356a0a59088779b32721918f11.tar.gz" - SHA1 "73955ab90ae77ee32c88744b945b3fd8b175833b" -) - -hunter_config( - oneTBB - VERSION 2021.12.0 - URL "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.12.0.zip" - SHA1 "f6b0eb4e45af600684282341115a3c2fb9834978" - CMAKE_ARGS - TBB_PREVIEW_GLOBAL_CONTROL=ON - TBB_TEST=OFF - CMAKE_CXX_VISIBILITY_PRESET=hidden - CMAKE_C_VISIBILITY_PRESET=hidden -) - - -hunter_config( - basalt - VERSION 0.1.0 - URL "https://github.com/luxonis/basalt/archive/5763210cd48e2dfc560f80ee0d3648163e69a901.tar.gz" - SHA1 "d5301f8edfce5372962851b3d7928c053f0b1628" - CMAKE_ARGS - BASALT_SDK_ONLY=ON -) - -hunter_config( - Sophus - VERSION 1.22.10 - URL "https://github.com/luxonis/Sophus/archive/54e9b230edc4df47f819cef0d15b1fcc165342df.tar.gz" - SHA1 "4c67d2d3415511446ed65705f00b23854dae6cd6" - CMAKE_ARGS - BUILD_SOPHUS_TESTS=OFF - BUILD_SOPHUS_EXAMPLES=OFF -) - - -hunter_config( - magic_enum - URL "https://github.com/Neargye/magic_enum/archive/3d1f6a5a2a3fbcba077e00ad0ccc2dd9fefc2ca7.zip" - SHA1 "c9a27f6ff8311f0c6b2adb959d0598f079fcc9f3" -) -hunter_config( - CURL - VERSION "7.88.1-p0-custom" - URL "https://github.com/cpp-pm/curl/archive/25d45e89d140d6ab27103cd7f8f6d7d6cf548d47.tar.gz" - SHA1 "db96d87e078e529a90dfb74de8d360a785c053aa" - CMAKE_ARGS - BUILD_CURL_TESTS=OFF - BUILD_CURL_EXE=OFF - CURL_USE_SCHANNEL=${DEPTHAI_CURL_USE_SCHANNEL} - CURL_USE_OPENSSL=${DEPTHAI_CURL_USE_OPENSSL} # Override hunter flags - no OpenSSL needed on Windows - BUILD_STATIC_CURL=ON - BUILD_SHARED_LIBS=OFF - BUILD_STATIC_LIBS=ON -) - -# A hunterized and patched version of cpr- see https://github.com/luxonis/cpr/pull/1 -hunter_config( - cpr - VERSION "1.4.0" - URL "https://github.com/luxonis/cpr/archive/50a1321738554e0152b0a6f1b0ca24e4fdecff5c.tar.gz" - SHA1 "2e2ba9920ed99c19887592ca89d9be5ffce4722b" -) - -hunter_config( - yaml-cpp - VERSION "0.6.3l" - URL "https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.6.3.tar.gz" - SHA1 "98d98632b3a62fdf1172442f8ad8190fc11cbef7" - CMAKE_ARGS - YAML_BUILD_SHARED_LIBS=ON -) hunter_config( semver diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake index d5a626a152..a792755459 100644 --- a/cmake/depthaiDependencies.cmake +++ b/cmake/depthaiDependencies.cmake @@ -9,44 +9,24 @@ if(CONFIG_MODE) set(_QUIET "QUIET") else() set(DEPTHAI_SHARED_LIBS ${BUILD_SHARED_LIBS}) - hunter_add_package(BZip2) - hunter_add_package(FP16) - hunter_add_package(libarchive-luxonis) - hunter_add_package(lz4-luxonis) - hunter_add_package(mp4v2) - if(DEPTHAI_ENABLE_CURL) - hunter_add_package(CURL) - hunter_add_package(cpr) - endif() - if(DEPTHAI_ENABLE_BACKWARD) - hunter_add_package(Backward) - endif() - hunter_add_package(libnop) - if(DEPTHAI_BASALT_SUPPORT) - hunter_add_package(Eigen) - hunter_add_package(basalt-headers) - hunter_add_package(basalt) - hunter_add_package(oneTBB) - endif() - hunter_add_package(semver) endif() # If library was build as static, find all dependencies if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS)) # BZip2 (for bspatch) - find_package(BZip2 ${_QUIET} CONFIG REQUIRED) + find_package(BZip2 ${_QUIET} REQUIRED) + find_package(lz4 CONFIG REQUIRED) # FP16 for conversions find_package(FP16 ${_QUIET} CONFIG REQUIRED) # libarchive for firmware packages find_package(archive_static ${_QUIET} CONFIG REQUIRED) - find_package(lzma ${_QUIET} CONFIG REQUIRED) + find_package(liblzma ${_QUIET} CONFIG REQUIRED) # httplib for Gate communication find_package(httplib ${_QUIET} CONFIG REQUIRED) # ZLIB for compressing Apps find_package(ZLIB CONFIG REQUIRED) - find_package(lz4 CONFIG REQUIRED) # spdlog for library and device logging find_package(spdlog ${_QUIET} CONFIG REQUIRED) @@ -143,12 +123,8 @@ set(CMAKE_PREFIX_PATH ${PREFIX_TEMP}) set(EIGEN_ROOT ${EIGEN_ROOT_TEMP}) if(DEPTHAI_BASALT_SUPPORT) - find_package(Eigen3 ${_QUIET} CONFIG REQUIRED) +find_package(basalt-headers ${_QUIET} CONFIG REQUIRED) find_package(basalt_sdk ${_QUIET} CONFIG REQUIRED) - find_package(TBB 2021.12.0 EXACT CONFIG REQUIRED) - find_package(Sophus ${_QUIET} CONFIG REQUIRED) - find_package(magic_enum ${_QUIET} CONFIG REQUIRED) - find_package(fmt ${_QUIET} CONFIG REQUIRED) endif() # include optional dependency cmake diff --git a/cmake/ports/basalt-headers/portfile.cmake b/cmake/ports/basalt-headers/portfile.cmake new file mode 100644 index 0000000000..031c155deb --- /dev/null +++ b/cmake/ports/basalt-headers/portfile.cmake @@ -0,0 +1,14 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO luxonis/basalt-headers + REF 9172c4e6d8c8533d5ebae8289bba2a299f30eb50 + SHA512 39b4b88b147f4d8fb9b2423559c8f07b6e7e43a5136ff461058ab2fe33edfbd1790e6e8684abc2cbe647457752f4ff835c4ed0ed4a370141e345d1e529af2369 + HEAD_REF vcpkg_deps +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/basalt-headers") diff --git a/cmake/ports/basalt-headers/vcpkg.json b/cmake/ports/basalt-headers/vcpkg.json new file mode 100644 index 0000000000..7de67c49d2 --- /dev/null +++ b/cmake/ports/basalt-headers/vcpkg.json @@ -0,0 +1,20 @@ + +{ + "name": "basalt-headers", + "version-string": "0.1.0", + "description": "Reusable components of Basalt project as header-only library", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "eigen3", + "sophus", + "cereal", + "fmt" +] +} diff --git a/cmake/ports/basalt/portfile.cmake b/cmake/ports/basalt/portfile.cmake new file mode 100644 index 0000000000..eb3bcc4a36 --- /dev/null +++ b/cmake/ports/basalt/portfile.cmake @@ -0,0 +1,17 @@ + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO luxonis/basalt + REF 2627a83aafa88217370cf3549b19281502e4e205 + SHA512 fb2a3310ecd3bdea00b14a933231072e089620ab4d10a66997757324c8894f75692dff3282c25dfeb2a75ff901ce9912f4a8a454fbd082dce58c331687e0b9c1 + HEAD_REF deps_test +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DBUILD_SHARED_LIBS=OFF + -DBASALT_SDK_ONLY=ON +) + +vcpkg_cmake_install() + diff --git a/cmake/ports/basalt/vcpkg.json b/cmake/ports/basalt/vcpkg.json new file mode 100644 index 0000000000..d0021e65ea --- /dev/null +++ b/cmake/ports/basalt/vcpkg.json @@ -0,0 +1,18 @@ + +{ + "name": "basalt", + "version-string": "0.1.0", + "description": "Basalt: Visual-Inertial Mapping with Non-Linear Factor Recovery", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "basalt-headers", + "magic-enum" +] +} diff --git a/cmake/ports/cpr/portfile.cmake b/cmake/ports/cpr/portfile.cmake new file mode 100644 index 0000000000..f9a51fc2cb --- /dev/null +++ b/cmake/ports/cpr/portfile.cmake @@ -0,0 +1,16 @@ + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO Serafadam/cpr + REF c898870a8992c1a679c04b8da3979b8cbcb91a6d + SHA512 efa68d4e41668345988ce2403e4ef1f98d0e7f6bdca797174f8c6f5eb5dbdd818faa75aa583ce89391154e2cfe528e0128f1657421a2c8a0ddc71fe43b559a84 + HEAD_REF vcpkg +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DBUILD_CPR_TESTS=OFF +) + +vcpkg_cmake_install() + diff --git a/cmake/ports/cpr/vcpkg.json b/cmake/ports/cpr/vcpkg.json new file mode 100644 index 0000000000..00f409c841 --- /dev/null +++ b/cmake/ports/cpr/vcpkg.json @@ -0,0 +1,19 @@ + +{ + "name": "cpr", + "version-string": "1.4.0", + "description": "C++ Requests: Curl for People, a spiritual port of Python Requests.", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "curl", + "mongoose", + "gtest" +] +} diff --git a/cmake/ports/fp16/portfile.cmake b/cmake/ports/fp16/portfile.cmake new file mode 100644 index 0000000000..36509359b9 --- /dev/null +++ b/cmake/ports/fp16/portfile.cmake @@ -0,0 +1,18 @@ + + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO luxonis/FP16 + REF c911175d2717e562976e606c6e5f799bf40cf94e + SHA512 4b892070e43dbaac3a457996981e4a9b6a0faaf7703d99f5f515604d8dcb2ff90c037c2660e36f68bdbb3481cb0fad5d2d7adf564ab19cefa420ee3f84bda4b6 + HEAD_REF master +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DFP16_BUILD_BENCHMARKS=OFF + -DFP16_BUILD_TESTS=OFF +) + +vcpkg_cmake_install() + diff --git a/cmake/ports/fp16/vcpkg.json b/cmake/ports/fp16/vcpkg.json new file mode 100644 index 0000000000..3d82078248 --- /dev/null +++ b/cmake/ports/fp16/vcpkg.json @@ -0,0 +1,17 @@ + + +{ + "name": "fp16", + "version-string": "luxonis-0.0.0", + "description": "Conversion to/from half-precision floating point formats", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } +] +} diff --git a/cmake/ports/httplib/portfile.cmake b/cmake/ports/httplib/portfile.cmake index c3f1656e77..44357c6e7a 100644 --- a/cmake/ports/httplib/portfile.cmake +++ b/cmake/ports/httplib/portfile.cmake @@ -1,4 +1,3 @@ - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO luxonis/cpp-httplib @@ -9,8 +8,8 @@ vcpkg_from_github( vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - HTTPLIB_USE_OPENSSL_IF_AVAILABLE=OFF - HTTPLIB_USE_BROTLI_IF_AVAILABLE=OFF + -DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=OFF + -DHTTPLIB_USE_BROTLI_IF_AVAILABLE=OFF ) vcpkg_cmake_install() diff --git a/cmake/ports/httplib/vcpkg.json b/cmake/ports/httplib/vcpkg.json index 1db0363506..e6c64e43eb 100644 --- a/cmake/ports/httplib/vcpkg.json +++ b/cmake/ports/httplib/vcpkg.json @@ -1,4 +1,3 @@ - { "name": "httplib", "version-string": "0.11.2", diff --git a/cmake/ports/libarchive-luxonis/portfile.cmake b/cmake/ports/libarchive-luxonis/portfile.cmake new file mode 100644 index 0000000000..ce44ebeed4 --- /dev/null +++ b/cmake/ports/libarchive-luxonis/portfile.cmake @@ -0,0 +1,45 @@ + + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO luxonis/libarchive + REF 45baa3a3e57104519e1165bcd5ac29c3bd8c9f3a + SHA512 8963cd567f471907cce941d5e6af7808b71cd289799b690fca84e7d7bb37d63816df387f5f4086fe47c33c80379b23cf3efcc455181214383ba7633202c5e783 + HEAD_REF hunter-3.5.2 +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DENABLE_ACL=OFF + -DENABLE_BZip2=OFF + -DENABLE_CAT=OFF + -DENABLE_CAT_SHARED=OFF + -DENABLE_CNG=OFF + -DENABLE_COVERAGE=OFF + -DENABLE_CPIO=OFF + -DENABLE_CPIO_SHARED=OFF + -DENABLE_EXPAT=OFF + -DENABLE_ICONV=OFF + -DENABLE_INSTALL=ON + -DENABLE_LIBB2=OFF + -DENABLE_LIBXML2=OFF + -DENABLE_LZ4=OFF + -DENABLE_LZMA=OFF + -DENABLE_LZO=OFF + -DENABLE_LibGCC=OFF + -DENABLE_MBEDTLS=OFF + -DENABLE_NETTLE=OFF + -DENABLE_OPENSSL=OFF + -DENABLE_PCREPOSIX=OFF + -DENABLE_SAFESEH=AUTO + -DENABLE_TAR=OFF + -DENABLE_TAR_SHARED=OFF + -DENABLE_TEST=OFF + -DENABLE_WERROR=OFF + -DENABLE_XATTR=OFF + -DENABLE_ZLIB=OFF + -DENABLE_ZSTD=OFF +) + +vcpkg_cmake_install() + diff --git a/cmake/ports/libarchive-luxonis/vcpkg.json b/cmake/ports/libarchive-luxonis/vcpkg.json new file mode 100644 index 0000000000..f4fc854c16 --- /dev/null +++ b/cmake/ports/libarchive-luxonis/vcpkg.json @@ -0,0 +1,16 @@ +{ + "name": "libarchive-luxonis", + "version-string": "hunter-3.5.2", + "description": "Multi-format archive and compression library", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "lz4-luxonis" + ] +} diff --git a/cmake/ports/libnop/portfile.cmake b/cmake/ports/libnop/portfile.cmake new file mode 100644 index 0000000000..5aadbf4304 --- /dev/null +++ b/cmake/ports/libnop/portfile.cmake @@ -0,0 +1,13 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO luxonis/libnop + REF ab842f51dc2eb13916dc98417c2186b78320ed10 + SHA512 6353765ac8c489e66e0c91dc1da899e5a89200eb3834c95a1697b5e22e4d7186d920c24a67272ff92fdf22a0fac5b6b838345ad077e67693f35815c1cc9dbf17 + HEAD_REF develop +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) + +vcpkg_cmake_install() + diff --git a/cmake/ports/libnop/vcpkg.json b/cmake/ports/libnop/vcpkg.json new file mode 100644 index 0000000000..40837a65d6 --- /dev/null +++ b/cmake/ports/libnop/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "libnop", + "version-string": "1.0-ec8f75a", + "description": "libnop: C++ Native Object Protocols", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } +] +} diff --git a/cmake/ports/lz4-luxonis/portfile.cmake b/cmake/ports/lz4-luxonis/portfile.cmake new file mode 100644 index 0000000000..932615e067 --- /dev/null +++ b/cmake/ports/lz4-luxonis/portfile.cmake @@ -0,0 +1,15 @@ + + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO luxonis/lz4 + REF ba358ed311d125333d245e4c284464a72a168983 + SHA512 33955bf214c59ed094ea6961e28b6f59284e8e409ff57d9ba333b1ff12911b392cbb9594a0e88d5d151356471e7297597b445950b977bdca79c21fb69d0291c9 + HEAD_REF dev +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) + +vcpkg_cmake_install() + diff --git a/cmake/ports/lz4-luxonis/vcpkg.json b/cmake/ports/lz4-luxonis/vcpkg.json new file mode 100644 index 0000000000..c73d4b292b --- /dev/null +++ b/cmake/ports/lz4-luxonis/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "lz4-luxonis", + "version-string": "1.9.4-p2", + "description": "Extremely Fast Compression algorithm", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } +] +} diff --git a/cmake/ports/mp4v2/portfile.cmake b/cmake/ports/mp4v2/portfile.cmake new file mode 100644 index 0000000000..16a14b330a --- /dev/null +++ b/cmake/ports/mp4v2/portfile.cmake @@ -0,0 +1,18 @@ + + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO luxonis/mp4v2 + REF 1dc9f4d24645ea43405582e5c813dec3eaa8fd3e + SHA512 d1acef4d4fc03154f55dd04f0319c5ade8fa85ffc4d7f8240f68ff9f053079c337945e4c2a860d520b442b05cea8c873aede6ef104957bf64ee548020d7b641c + HEAD_REF master +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DBUILD_SHARED=OFF + -DBUILD_UTILS=OFF +) + +vcpkg_cmake_install() + diff --git a/cmake/ports/mp4v2/vcpkg.json b/cmake/ports/mp4v2/vcpkg.json new file mode 100644 index 0000000000..1559a9d245 --- /dev/null +++ b/cmake/ports/mp4v2/vcpkg.json @@ -0,0 +1,17 @@ + + +{ + "name": "mp4v2", + "version-string": "2.1.3", + "description": "Fork of the MP4v2 project", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } +] +} diff --git a/cmake/ports/pybind11/portfile.cmake b/cmake/ports/pybind11/portfile.cmake new file mode 100644 index 0000000000..277635976d --- /dev/null +++ b/cmake/ports/pybind11/portfile.cmake @@ -0,0 +1,13 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO luxonis/pybind11 + REF f760e2b984b66be2cfa202c93da9d341a557fb5d + SHA512 8baad5c326553075926901b9e2d5fcb574d298b382f17ba8ae0abf022fe3c92f4704b4a3fdce9b63d12ef31a436afc04d11a2050639f254be886a88d201a8b85 + HEAD_REF luxonis-smart-holder +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) + +vcpkg_cmake_install() + diff --git a/cmake/ports/pybind11/vcpkg.json b/cmake/ports/pybind11/vcpkg.json new file mode 100644 index 0000000000..238e4d25d4 --- /dev/null +++ b/cmake/ports/pybind11/vcpkg.json @@ -0,0 +1,16 @@ + +{ + "name": "pybind11", + "version-string": "luxonis-smart-holder", + "description": "Seamless operability between C++11 and Python", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } +] +} diff --git a/cmake/ports/spdlog/portfile.cmake b/cmake/ports/spdlog/portfile.cmake new file mode 100644 index 0000000000..18616e9b22 --- /dev/null +++ b/cmake/ports/spdlog/portfile.cmake @@ -0,0 +1,20 @@ + + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO gabime/spdlog + REF de0dbfa3596a18cd70a4619b6a9766847a941276 + SHA512 3157cb8769df2e01f89d4f376f71f3a50b28956467978d80d5ec32f9004a3edcbec2ea1969a420a900b326972e534484001297bd7db7e27488108c57d88e1627 + HEAD_REF master +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DSPDLOG_BUILD_EXAMPLE=OFF + -DSPDLOG_FMT_EXTERNAL=OFF + -DCMAKE_CXX_VISIBILITY_PRESET=hidden + -DCMAKE_C_VISIBILITY_PRESET=hidden +) + +vcpkg_cmake_install() + diff --git a/cmake/ports/spdlog/vcpkg.json b/cmake/ports/spdlog/vcpkg.json new file mode 100644 index 0000000000..6a4d2e407c --- /dev/null +++ b/cmake/ports/spdlog/vcpkg.json @@ -0,0 +1,17 @@ + + +{ + "name": "spdlog", + "version-string": "0.11.2", + "description": "Fast C++ logging library.", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } +] +} diff --git a/cmake/ports/xlink/portfile.cmake b/cmake/ports/xlink/portfile.cmake index 4cc7be7c12..5b2e791e63 100644 --- a/cmake/ports/xlink/portfile.cmake +++ b/cmake/ports/xlink/portfile.cmake @@ -8,7 +8,8 @@ vcpkg_from_github( vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - XLINK_ENABLE_LIBUSB=${DEPTHAI_ENABLE_LIBUSB} + # temporary + -DXLINK_ENABLE_LIBUSB=ON ) vcpkg_cmake_install() diff --git a/cmake/ports/zlib/portfile.cmake b/cmake/ports/zlib/portfile.cmake index 6605a0a509..4fb486e8af 100644 --- a/cmake/ports/zlib/portfile.cmake +++ b/cmake/ports/zlib/portfile.cmake @@ -9,7 +9,6 @@ vcpkg_from_github( vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - XLINK_ENABLE_LIBUSB=${DEPTHAI_ENABLE_LIBUSB} ) vcpkg_cmake_install() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 077f6ccc6c..38ad6cfd54 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -3,7 +3,6 @@ include(CTest) enable_testing() # Add Catch2 for writing tests -hunter_add_package(Catch2) find_package(Catch2 CONFIG REQUIRED) # Print details of the Catch2 package diff --git a/vcpkg.json b/vcpkg.json index 575c8ac8df..763bc187cf 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -11,7 +11,18 @@ "spdlog", "xlink", "httplib", - "zlib" + "zlib", + "spdlog", + "bzip2", + "lz4-luxonis", + "libarchive-luxonis", + "liblzma", + "fp16", + "mp4v2", + "libnop", + "neargye-semver", + "pybind11", + "catch2" ], "features": { "rtabmap": { @@ -30,6 +41,33 @@ "name": "apriltag" } ] + }, + "backward": { + "description": "Enable backward-cpp support", + "dependencies": [ + { + "name": "backward-cpp" + } + ] + }, + "curl": { + "description": "Enable cURL support", + "dependencies": [ + { + "name": "curl" + }, + { + "name": "cpr" + } + ] + }, + "basalt": { + "description": "Enable Basalt support", + "dependencies": [ + { + "name": "basalt" + } + ] } }, "builtin-baseline": "f5ec6f30ff70f04f841436a0f36600bdbabfcfbf" From b8524e5ecc566677eb49c433d1363537db50ef43 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 29 Oct 2024 15:14:06 +0100 Subject: [PATCH 005/131] httplib from main repo --- cmake/ports/httplib/portfile.cmake | 17 ----------------- cmake/ports/httplib/vcpkg.json | 15 --------------- vcpkg.json | 2 +- 3 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 cmake/ports/httplib/portfile.cmake delete mode 100644 cmake/ports/httplib/vcpkg.json diff --git a/cmake/ports/httplib/portfile.cmake b/cmake/ports/httplib/portfile.cmake deleted file mode 100644 index 44357c6e7a..0000000000 --- a/cmake/ports/httplib/portfile.cmake +++ /dev/null @@ -1,17 +0,0 @@ -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO luxonis/cpp-httplib - REF 3ba99c06f655a52e701c9a7ae5dc48850582d95b - SHA512 282b4fd205d2de8ffc9ee901c2f2628ce10d992e5c9979de8e7509ac5fca94e1dae4cd6205b91885b9113465c9e5b64a78ae87dcc951eedcebaf27d0ee80050d - HEAD_REF master -) -vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=OFF - -DHTTPLIB_USE_BROTLI_IF_AVAILABLE=OFF -) - -vcpkg_cmake_install() - -vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/httplib") diff --git a/cmake/ports/httplib/vcpkg.json b/cmake/ports/httplib/vcpkg.json deleted file mode 100644 index e6c64e43eb..0000000000 --- a/cmake/ports/httplib/vcpkg.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "httplib", - "version-string": "0.11.2", - "description": "A C++ header-only HTTP/HTTPS server and client library", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - } -] -} diff --git a/vcpkg.json b/vcpkg.json index 763bc187cf..234e904b4e 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -4,13 +4,13 @@ "websocketpp", "protobuf", "openssl", + "cpp-httplib", "libpng", "tiff", "yaml-cpp", "nlohmann-json", "spdlog", "xlink", - "httplib", "zlib", "spdlog", "bzip2", From 4a12c6dc9606122e63a52a78b01f359fc940c940 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 30 Oct 2024 09:10:48 +0100 Subject: [PATCH 006/131] install build essential in ci --- .github/workflows/python-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index d3c01a16b8..607f266322 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -44,7 +44,7 @@ jobs: run: | sudo apt update python -m pip install --upgrade pip - sudo apt install libusb-1.0-0-dev libopencv-dev libpcl-dev + sudo apt install build-essential libusb-1.0-0-dev libopencv-dev libpcl-dev python -m pip install -r bindings/python/docs/requirements_mkdoc.txt - name: Configure project run: cmake -S . -B build -DDEPTHAI_BUILD_PYTHON=ON -DDEPTHAI_PYTHON_FORCE_DOCSTRINGS=ON -DDEPTHAI_BASALT_SUPPORT=ON -DDEPTHAI_PCL_SUPPORT=ON -DDEPTHAI_RTABMAP_SUPPORT=ON -DDEPTHAI_PYTHON_DOCSTRINGS_OUTPUT="$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" From 3808c2c923cbb7de18cf1f2c71c263be97a9e919 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 30 Oct 2024 09:23:29 +0100 Subject: [PATCH 007/131] install make in ci --- .github/workflows/python-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 607f266322..6cdf2ada2c 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -44,7 +44,7 @@ jobs: run: | sudo apt update python -m pip install --upgrade pip - sudo apt install build-essential libusb-1.0-0-dev libopencv-dev libpcl-dev + sudo apt install make libusb-1.0-0-dev libopencv-dev libpcl-dev python -m pip install -r bindings/python/docs/requirements_mkdoc.txt - name: Configure project run: cmake -S . -B build -DDEPTHAI_BUILD_PYTHON=ON -DDEPTHAI_PYTHON_FORCE_DOCSTRINGS=ON -DDEPTHAI_BASALT_SUPPORT=ON -DDEPTHAI_PCL_SUPPORT=ON -DDEPTHAI_RTABMAP_SUPPORT=ON -DDEPTHAI_PYTHON_DOCSTRINGS_OUTPUT="$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" From 7de9ad65ab08d05c190c1c435773107658230ed9 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 30 Oct 2024 11:02:12 +0100 Subject: [PATCH 008/131] switch to official lz4 --- cmake/depthaiDependencies.cmake | 10 +++++----- cmake/ports/libarchive-luxonis/vcpkg.json | 2 +- vcpkg.json | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake index a792755459..a5d484dfee 100644 --- a/cmake/depthaiDependencies.cmake +++ b/cmake/depthaiDependencies.cmake @@ -20,6 +20,7 @@ if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS)) # FP16 for conversions find_package(FP16 ${_QUIET} CONFIG REQUIRED) +find_package(PNG REQUIRED) # libarchive for firmware packages find_package(archive_static ${_QUIET} CONFIG REQUIRED) find_package(liblzma ${_QUIET} CONFIG REQUIRED) @@ -76,7 +77,6 @@ find_package(mp4v2 ${_QUIET} CONFIG REQUIRED) # TODO(Morato) - potentially move this to a private library find_package(Protobuf ${_QUIET} CONFIG REQUIRED) - # XLink if(DEPTHAI_XLINK_LOCAL AND (NOT CONFIG_MODE)) set(_BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}") @@ -92,10 +92,6 @@ else() endif() # OpenCV 4 - (optional) -message("DEPTHAI_OPENCV_SUPPORT: ${DEPTHAI_OPENCV_SUPPORT}") -if(DEPTHAI_OPENCV_SUPPORT) - find_package(OpenCV 4 ${_QUIET} CONFIG REQUIRED) -endif() if(DEPTHAI_PCL_SUPPORT AND NOT TARGET JsonCpp::JsonCpp) find_package(jsoncpp) @@ -110,6 +106,10 @@ set(EIGEN_ROOT "") set(CMAKE_FIND_ROOT_PATH_TMP ${CMAKE_FIND_ROOT_PATH}) set(CMAKE_FIND_ROOT_PATH "") +message("DEPTHAI_OPENCV_SUPPORT: ${DEPTHAI_OPENCV_SUPPORT}") +if(DEPTHAI_OPENCV_SUPPORT) + find_package(OpenCV 4 ${_QUIET} CONFIG REQUIRED) +endif() if(DEPTHAI_PCL_SUPPORT) find_package(PCL CONFIG COMPONENTS common) endif() diff --git a/cmake/ports/libarchive-luxonis/vcpkg.json b/cmake/ports/libarchive-luxonis/vcpkg.json index f4fc854c16..4068e3ce19 100644 --- a/cmake/ports/libarchive-luxonis/vcpkg.json +++ b/cmake/ports/libarchive-luxonis/vcpkg.json @@ -11,6 +11,6 @@ "name": "vcpkg-cmake-config", "host": true }, - "lz4-luxonis" + "lz4" ] } diff --git a/vcpkg.json b/vcpkg.json index 234e904b4e..9baa4ad3de 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -14,7 +14,7 @@ "zlib", "spdlog", "bzip2", - "lz4-luxonis", + "lz4", "libarchive-luxonis", "liblzma", "fp16", From 47128fb716f329f0f9585360a675ea40f27c6e11 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 30 Oct 2024 12:18:36 +0100 Subject: [PATCH 009/131] update workflow --- .github/workflows/python-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 6cdf2ada2c..d3c01a16b8 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -44,7 +44,7 @@ jobs: run: | sudo apt update python -m pip install --upgrade pip - sudo apt install make libusb-1.0-0-dev libopencv-dev libpcl-dev + sudo apt install libusb-1.0-0-dev libopencv-dev libpcl-dev python -m pip install -r bindings/python/docs/requirements_mkdoc.txt - name: Configure project run: cmake -S . -B build -DDEPTHAI_BUILD_PYTHON=ON -DDEPTHAI_PYTHON_FORCE_DOCSTRINGS=ON -DDEPTHAI_BASALT_SUPPORT=ON -DDEPTHAI_PCL_SUPPORT=ON -DDEPTHAI_RTABMAP_SUPPORT=ON -DDEPTHAI_PYTHON_DOCSTRINGS_OUTPUT="$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" From 4bd1e167923a901cbf559ff2565471bc1ef97bba Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 30 Oct 2024 12:26:08 +0100 Subject: [PATCH 010/131] clean build from vcpkg --- CMakePresets.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 758e72c9e9..04adf83eb4 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -5,8 +5,9 @@ "name": "default", "binaryDir": "${sourceDir}/build", "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "VCPKG_INSTALL_OPTIONS": "--clean-buildtrees-after-build;--clean-packages-after-build" } } ] -} \ No newline at end of file +} From 777ef54ed00fd59a1d7cb2801188872c60cdc8ce Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 30 Oct 2024 15:28:28 +0100 Subject: [PATCH 011/131] custom port for rtabmap --- cmake/depthaiDependencies.cmake | 4 +- cmake/ports/opencv/portfile.cmake | 2 + cmake/ports/opencv/vcpkg.json | 5 + cmake/ports/pcl/portfile.cmake | 1 + cmake/ports/pcl/vcpkg.json | 5 + cmake/ports/rtabmap/apple.patch | 13 ++ cmake/ports/rtabmap/fix_link.patch | 15 ++ cmake/ports/rtabmap/gklib.patch | 13 ++ cmake/ports/rtabmap/link-keywords.patch | 12 ++ cmake/ports/rtabmap/multi-definition.patch | 96 +++++++++++++ cmake/ports/rtabmap/portfile.cmake | 129 +++++++++++++++++ cmake/ports/rtabmap/rtabmap-res-tool.patch | 11 ++ cmake/ports/rtabmap/sqlite3.patch | 48 +++++++ cmake/ports/rtabmap/vcpkg.json | 155 +++++++++++++++++++++ cmake/ports/zlib/portfile.cmake | 15 -- cmake/ports/zlib/vcpkg.json | 16 --- 16 files changed, 507 insertions(+), 33 deletions(-) create mode 100644 cmake/ports/opencv/portfile.cmake create mode 100644 cmake/ports/opencv/vcpkg.json create mode 100644 cmake/ports/pcl/portfile.cmake create mode 100644 cmake/ports/pcl/vcpkg.json create mode 100644 cmake/ports/rtabmap/apple.patch create mode 100644 cmake/ports/rtabmap/fix_link.patch create mode 100644 cmake/ports/rtabmap/gklib.patch create mode 100644 cmake/ports/rtabmap/link-keywords.patch create mode 100644 cmake/ports/rtabmap/multi-definition.patch create mode 100644 cmake/ports/rtabmap/portfile.cmake create mode 100644 cmake/ports/rtabmap/rtabmap-res-tool.patch create mode 100644 cmake/ports/rtabmap/sqlite3.patch create mode 100644 cmake/ports/rtabmap/vcpkg.json delete mode 100644 cmake/ports/zlib/portfile.cmake delete mode 100644 cmake/ports/zlib/vcpkg.json diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake index a5d484dfee..07132a9914 100644 --- a/cmake/depthaiDependencies.cmake +++ b/cmake/depthaiDependencies.cmake @@ -20,14 +20,14 @@ if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS)) # FP16 for conversions find_package(FP16 ${_QUIET} CONFIG REQUIRED) -find_package(PNG REQUIRED) + find_package(PNG REQUIRED) # libarchive for firmware packages find_package(archive_static ${_QUIET} CONFIG REQUIRED) find_package(liblzma ${_QUIET} CONFIG REQUIRED) # httplib for Gate communication find_package(httplib ${_QUIET} CONFIG REQUIRED) # ZLIB for compressing Apps - find_package(ZLIB CONFIG REQUIRED) + find_package(ZLIB REQUIRED) # spdlog for library and device logging find_package(spdlog ${_QUIET} CONFIG REQUIRED) diff --git a/cmake/ports/opencv/portfile.cmake b/cmake/ports/opencv/portfile.cmake new file mode 100644 index 0000000000..df3ab59c3b --- /dev/null +++ b/cmake/ports/opencv/portfile.cmake @@ -0,0 +1,2 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + diff --git a/cmake/ports/opencv/vcpkg.json b/cmake/ports/opencv/vcpkg.json new file mode 100644 index 0000000000..df2cc1b1d3 --- /dev/null +++ b/cmake/ports/opencv/vcpkg.json @@ -0,0 +1,5 @@ +{ + "name": "opencv", + "version": "4.5.4", + "port-version": 0 +} diff --git a/cmake/ports/pcl/portfile.cmake b/cmake/ports/pcl/portfile.cmake new file mode 100644 index 0000000000..065116c276 --- /dev/null +++ b/cmake/ports/pcl/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/cmake/ports/pcl/vcpkg.json b/cmake/ports/pcl/vcpkg.json new file mode 100644 index 0000000000..cce2561d24 --- /dev/null +++ b/cmake/ports/pcl/vcpkg.json @@ -0,0 +1,5 @@ +{ + "name": "pcl", + "version": "1.14.0", + "port-version": 0 +} diff --git a/cmake/ports/rtabmap/apple.patch b/cmake/ports/rtabmap/apple.patch new file mode 100644 index 0000000000..1af23670de --- /dev/null +++ b/cmake/ports/rtabmap/apple.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 024c729..ddb1cae 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -119,8 +119,6 @@ endif() + #Other paths... + IF(APPLE) + # For Mac ports +- SET(CMAKE_INCLUDE_PATH "/opt/local/include;${CMAKE_INCLUDE_PATH}") +- SET(CMAKE_LIBRARY_PATH "/opt/local/lib;${CMAKE_LIBRARY_PATH}") + ENDIF() + + ####### Build libraries as shared or static ####### diff --git a/cmake/ports/rtabmap/fix_link.patch b/cmake/ports/rtabmap/fix_link.patch new file mode 100644 index 0000000000..77681a0501 --- /dev/null +++ b/cmake/ports/rtabmap/fix_link.patch @@ -0,0 +1,15 @@ +diff --git a/corelib/src/global_map/OctoMap.cpp b/corelib/src/global_map/OctoMap.cpp +index d4c22499..87acefcd 100644 +--- a/corelib/src/global_map/OctoMap.cpp ++++ b/corelib/src/global_map/OctoMap.cpp +@@ -278,10 +278,8 @@ RtabmapColorOcTree::StaticMemberInitializer::StaticMemberInitializer() { + AbstractOcTree::registerTreeType(tree); + } + +-#ifndef _WIN32 + // On Windows, the app freezes on start if the following is defined + RtabmapColorOcTree::StaticMemberInitializer RtabmapColorOcTree::RtabmapColorOcTreeMemberInit; +-#endif + + + ////////////////////////////////////// diff --git a/cmake/ports/rtabmap/gklib.patch b/cmake/ports/rtabmap/gklib.patch new file mode 100644 index 0000000000..2a66fcba18 --- /dev/null +++ b/cmake/ports/rtabmap/gklib.patch @@ -0,0 +1,13 @@ +--- 0.21.4.1-44dcfeb2ff/corelib/src/CMakeLists.txt.old 2024-04-12 09:59:07.656980900 +0200 ++++ 0.21.4.1-44dcfeb2ff/corelib/src/CMakeLists.txt 2024-04-12 09:59:46.701218300 +0200 +@@ -747,8 +747,8 @@ IF(GTSAM_FOUND) + ) + IF(WIN32) + #explicitly add metis target on windows (after gtsam target) +- SET(LIBRARIES +- ${LIBRARIES} ++ SET(PUBLIC_LIBRARIES ++ ${PUBLIC_LIBRARIES} + metis + ) + ENDIF(WIN32) diff --git a/cmake/ports/rtabmap/link-keywords.patch b/cmake/ports/rtabmap/link-keywords.patch new file mode 100644 index 0000000000..891266d274 --- /dev/null +++ b/cmake/ports/rtabmap/link-keywords.patch @@ -0,0 +1,12 @@ +diff --git a/corelib/src/CMakeLists.txt b/corelib/src/CMakeLists.txt +index 6a4a9ab..85ede4e 100644 +--- a/corelib/src/CMakeLists.txt ++++ b/corelib/src/CMakeLists.txt +@@ -167,7 +167,6 @@ SET(LIBRARIES + # Issue that qhull dependency uses optimized and debug keywords, + # which are converted to \$<\$> and \$<\$ + # in RTABMap_coreTargets.cmake (not sure why?!). +-list(REMOVE_ITEM PCL_LIBRARIES "debug" "optimized") + SET(PUBLIC_LIBRARIES + ${OpenCV_LIBS} + ${PCL_LIBRARIES} diff --git a/cmake/ports/rtabmap/multi-definition.patch b/cmake/ports/rtabmap/multi-definition.patch new file mode 100644 index 0000000000..060396bba5 --- /dev/null +++ b/cmake/ports/rtabmap/multi-definition.patch @@ -0,0 +1,96 @@ +diff --git a/corelib/include/rtabmap/core/stereo/stereoRectifyFisheye.h b/corelib/include/rtabmap/core/stereo/stereoRectifyFisheye.h +index 2fc12a2..5219a38 100644 +--- a/corelib/include/rtabmap/core/stereo/stereoRectifyFisheye.h ++++ b/corelib/include/rtabmap/core/stereo/stereoRectifyFisheye.h +@@ -39,6 +39,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #if CV_MAJOR_VERSION >= 4 + #include + ++#include ++ ++namespace { ++ + // Opencv4 doesn't expose those functions below anymore, we should recopy all of them! + int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian CV_DEFAULT(0)) + { +@@ -919,13 +923,17 @@ void cvConvertPointsHomogeneous( const CvMat* _src, CvMat* _dst ) + + #endif // OpenCV3 + ++} // namespace ++ + namespace rtabmap + { + + void ++RTABMAP_CORE_EXPORT + icvGetRectanglesFisheye( const CvMat* cameraMatrix, const CvMat* distCoeffs, + const CvMat* R, const CvMat* newCameraMatrix, CvSize imgSize, + cv::Rect_& inner, cv::Rect_& outer ) ++#ifdef RTABMAP_STEREORECTIFIYFISHEYE_IMPLEMENTATION + { + const int N = 9; + int x, y, k; +@@ -967,12 +975,17 @@ icvGetRectanglesFisheye( const CvMat* cameraMatrix, const CvMat* distCoeffs, + inner = cv::Rect_(iX0, iY0, iX1-iX0, iY1-iY0); + outer = cv::Rect_(oX0, oY0, oX1-oX0, oY1-oY0); + } ++#else ++; ++#endif + +-void cvStereoRectifyFisheye( const CvMat* _cameraMatrix1, const CvMat* _cameraMatrix2, ++void RTABMAP_CORE_EXPORT ++ cvStereoRectifyFisheye( const CvMat* _cameraMatrix1, const CvMat* _cameraMatrix2, + const CvMat* _distCoeffs1, const CvMat* _distCoeffs2, + CvSize imageSize, const CvMat* matR, const CvMat* matT, + CvMat* _R1, CvMat* _R2, CvMat* _P1, CvMat* _P2, + CvMat* matQ, int flags, double alpha, CvSize newImgSize ) ++#ifdef RTABMAP_STEREORECTIFIYFISHEYE_IMPLEMENTATION + { + double _om[3], _t[3] = {0}, _uu[3]={0,0,0}, _r_r[3][3], _pp[3][4]; + double _ww[3], _wr[3][3], _z[3] = {0,0,0}, _ri[3][3], _w3[3]; +@@ -1177,14 +1190,20 @@ void cvStereoRectifyFisheye( const CvMat* _cameraMatrix1, const CvMat* _cameraMa + cvConvert( &Q, matQ ); + } + } ++#else ++; ++#endif ++ + +-void stereoRectifyFisheye( cv::InputArray _cameraMatrix1, cv::InputArray _distCoeffs1, ++void RTABMAP_CORE_EXPORT ++ stereoRectifyFisheye( cv::InputArray _cameraMatrix1, cv::InputArray _distCoeffs1, + cv::InputArray _cameraMatrix2, cv::InputArray _distCoeffs2, + cv::Size imageSize, cv::InputArray _Rmat, cv::InputArray _Tmat, + cv::OutputArray _Rmat1, cv::OutputArray _Rmat2, + cv::OutputArray _Pmat1, cv::OutputArray _Pmat2, + cv::OutputArray _Qmat, int flags, + double alpha, cv::Size newImageSize) ++#ifdef RTABMAP_STEREORECTIFIYFISHEYE_IMPLEMENTATION + { + cv::Mat cameraMatrix1 = _cameraMatrix1.getMat(), cameraMatrix2 = _cameraMatrix2.getMat(); + cv::Mat distCoeffs1 = _distCoeffs1.getMat(), distCoeffs2 = _distCoeffs2.getMat(); +@@ -1238,6 +1257,9 @@ void stereoRectifyFisheye( cv::InputArray _cameraMatrix1, cv::InputArray _distCo + CvSize(newImageSize)); + #endif + } ++#else ++; ++#endif + + } + +diff --git a/corelib/src/StereoCameraModel.cpp b/corelib/src/StereoCameraModel.cpp +index 421d3f4..e7c166c 100644 +--- a/corelib/src/StereoCameraModel.cpp ++++ b/corelib/src/StereoCameraModel.cpp +@@ -34,6 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include + + #if CV_MAJOR_VERSION > 2 or (CV_MAJOR_VERSION == 2 and (CV_MINOR_VERSION >4 or (CV_MINOR_VERSION == 4 and CV_SUBMINOR_VERSION >=10))) ++#define RTABMAP_STEREORECTIFIYFISHEYE_IMPLEMENTATION + #include + #endif + diff --git a/cmake/ports/rtabmap/portfile.cmake b/cmake/ports/rtabmap/portfile.cmake new file mode 100644 index 0000000000..b31a0e4582 --- /dev/null +++ b/cmake/ports/rtabmap/portfile.cmake @@ -0,0 +1,129 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO introlab/rtabmap + REF 623d056436946c35beb12199831f178a84eaad73 + SHA512 e06bf06066f9f567fa5d1c7d09765e0e76c1f920a1087bda32589260e4406042554347f6eb09abb2b225f57ae85ed645d7645f0974dcee06871040d61eb05ac4 + HEAD_REF master + PATCHES + apple.patch + fix_link.patch + link-keywords.patch + multi-definition.patch + rtabmap-res-tool.patch + gklib.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + gui WITH_QT + k4w2 WITH_K4W2 + octomap WITH_OCTOMAP + openni2 WITH_OPENNI2 + realsense2 WITH_REALSENSE2 + tools BUILD_APP + tools BUILD_TOOLS +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + DISABLE_PARALLEL_CONFIGURE + OPTIONS + ${FEATURE_OPTIONS} + -DBUILD_TOOLS=OFF + -DBUILD_APP=OFF + -DBUILD_AS_BUNDLE=OFF + -DBUILD_EXAMPLES=OFF + -DRTABMAP_QT_VERSION=6 + "-DRTABMAP_RES_TOOL=${CURRENT_HOST_INSTALLED_DIR}/tools/rtabmap-res-tool/rtabmap-res_tool${VCPKG_TARGET_EXECUTABLE_SUFFIX}" + -DWITH_ALICE_VISION=OFF + -DWITH_CCCORELIB=OFF + -DWITH_CERES=ON + -DWITH_CPUTSDF=OFF + -DWITH_CVSBA=OFF + -DWITH_DC1394=OFF + -DWITH_DEPTHAI=OFF + -DWITH_DVO=OFF + -DWITH_FASTCV=OFF + -DWITH_FLYCAPTURE2=OFF + -DWITH_FOVIS=OFF + -DWITH_FREENECT=OFF + -DWITH_FREENECT2=OFF + -DWITH_G2O=ON + -DWITH_GTSAM=OFF + -DWITH_K4A=OFF + -DWITH_LOAM=OFF + -DWITH_MADGWICK=OFF + -DWITH_MSCKF_VIO=OFF + -DWITH_MYNTEYE=OFF + -DWITH_OKVIS=OFF + -DWITH_OPENCHISEL=OFF + -DWITH_OPENVINS=OFF + -DWITH_ORB_OCTREE=ON # GPLv3 + -DWITH_ORB_SLAM=OFF + -DWITH_PDAL=OFF + -DWITH_POINTMATCHER=OFF + -DWITH_PYTHON_THREADING=OFF + -DWITH_PYTHON=OFF + -DWITH_REALSENSE_SLAM=OFF + -DWITH_REALSENSE=OFF + -DWITH_TORCH=OFF + -DWITH_VERTIGO=OFF + -DWITH_VINS=OFF + -DWITH_VISO2=OFF + -DWITH_ZED=OFF + -DWITH_ZEDOC=OFF +) + +vcpkg_cmake_install() + +if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_cmake_config_fixup(CONFIG_PATH CMake) +else() + vcpkg_cmake_config_fixup(CONFIG_PATH lib/rtabmap-0.21) +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +if("tools" IN_LIST FEATURES) + vcpkg_copy_tools( + TOOL_NAMES + rtabmap-camera + rtabmap-console + rtabmap-detectMoreLoopClosures + rtabmap-export + rtabmap-extractObject + rtabmap-info + rtabmap-kitti_dataset + rtabmap-recovery + rtabmap-report + rtabmap-reprocess + rtabmap-rgbd_dataset + rtabmap-euroc_dataset + rtabmap-cleanupLocalGrids + rtabmap-globalBundleAdjustment + AUTO_CLEAN + ) + if("gui" IN_LIST FEATURES) + vcpkg_copy_tools( + TOOL_NAMES + rtabmap + rtabmap-calibration + rtabmap-databaseViewer + rtabmap-dataRecorder + rtabmap-odometryViewer + rtabmap-rgbd_camera + AUTO_CLEAN + ) + file(COPY "${CURRENT_INSTALLED_DIR}/tools/Qt6/bin/qt.conf" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/qt.conf" "./../../../" "./../../") + endif() +endif() + +vcpkg_install_copyright( + COMMENT [[ +The RTAB-Map main license is BSD-3-Clause, but some parts of the +source code are under other licenses possibly including GPL-3.0-only. +]] + FILE_LIST "${SOURCE_PATH}/LICENSE" +) diff --git a/cmake/ports/rtabmap/rtabmap-res-tool.patch b/cmake/ports/rtabmap/rtabmap-res-tool.patch new file mode 100644 index 0000000000..6d72bcaaf8 --- /dev/null +++ b/cmake/ports/rtabmap/rtabmap-res-tool.patch @@ -0,0 +1,11 @@ +diff --git a/utilite/resource_generator/CMakeLists.txt b/utilite/resource_generator/CMakeLists.txt +index 82f1253..eedab31 100644 +--- a/utilite/resource_generator/CMakeLists.txt ++++ b/utilite/resource_generator/CMakeLists.txt +@@ -1,5 +1,5 @@ + +-if (CMAKE_CROSSCOMPILING OR ANDROID OR IOS) ++if (RTABMAP_RES_TOOL) + # See this page about tools being required in the build: + # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/CrossCompiling#using-executables-in-the-build-created-during-the-build + diff --git a/cmake/ports/rtabmap/sqlite3.patch b/cmake/ports/rtabmap/sqlite3.patch new file mode 100644 index 0000000000..5dcf2f6461 --- /dev/null +++ b/cmake/ports/rtabmap/sqlite3.patch @@ -0,0 +1,48 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1ecd3ae..024c729 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -252,10 +252,10 @@ endif() + + FIND_PACKAGE(ZLIB REQUIRED QUIET) + +-FIND_PACKAGE(Sqlite3 QUIET) +-IF(Sqlite3_FOUND) +- MESSAGE(STATUS "Found Sqlite3: ${Sqlite3_INCLUDE_DIRS} ${Sqlite3_LIBRARIES}") +-ENDIF(Sqlite3_FOUND) ++FIND_PACKAGE(SQLite3 QUIET) ++IF(SQLite3_FOUND) ++ MESSAGE(STATUS "Found Sqlite3: ${SQLite3_INCLUDE_DIRS} ${SQLite3_LIBRARIES}") ++ENDIF(SQLite3_FOUND) + + if(NOT "${PCL_LIBRARIES}" STREQUAL "") + # fix libproj.so not found on Xenial +@@ -1332,7 +1332,7 @@ ELSE() + MESSAGE(STATUS " With Qt = NO (Qt not found)") + ENDIF() + +-IF(Sqlite3_FOUND) ++IF(SQLite3_FOUND) + MESSAGE(STATUS " With external SQLite3 = YES (License: Public Domain)") + ELSE() + MESSAGE(STATUS " With external SQLite3 = NO (sqlite3 not found, internal version is used for convenience)") +--- a/corelib/src/CMakeLists.txt ++++ b/corelib/src/CMakeLists.txt +@@ -173,14 +173,14 @@ SET(PUBLIC_LIBRARIES + ${PCL_LIBRARIES} + ) + +-IF(Sqlite3_FOUND) ++IF(SQLite3_FOUND) + SET(INCLUDE_DIRS + ${INCLUDE_DIRS} +- ${Sqlite3_INCLUDE_DIRS} ++ ${SQLite3_INCLUDE_DIRS} + ) + SET(LIBRARIES + ${LIBRARIES} +- ${Sqlite3_LIBRARIES} ++ ${SQLite3_LIBRARIES} + ) + ELSE() + SET(SRC_FILES diff --git a/cmake/ports/rtabmap/vcpkg.json b/cmake/ports/rtabmap/vcpkg.json new file mode 100644 index 0000000000..3ac88550da --- /dev/null +++ b/cmake/ports/rtabmap/vcpkg.json @@ -0,0 +1,155 @@ +{ + "name": "rtabmap", + "version": "0.21.4.1", + "port-version": 1, + "description": "Real-Time Appearance-Based Mapping", + "homepage": "https://introlab.github.io/rtabmap/", + "license": null, + "dependencies": [ + "ceres", + "g2o", + { + "name": "opencv", + "default-features": false + }, + { + "name": "pcl", + "default-features": false + }, + { + "name": "rtabmap-res-tool", + "host": true + }, + "sqlite3", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib", + "boost-asio", + "boost-date-time", + "boost-dynamic-bitset", + "boost-filesystem", + "boost-foreach", + "boost-graph", + "boost-interprocess", + "boost-iostreams", + "boost-multi-array", + "boost-property-map", + "boost-ptr-container", + "boost-random", + "boost-signals2", + "boost-sort", + "boost-system", + "boost-thread", + "boost-uuid" + ], + "default-features": [ + "gui", + "opencv-contrib", + "opencv-nonfree", + "tools" + ], + "features": { + "gui": { + "description": "Build RTAB-Map with GUI support (Qt)", + "dependencies": [ + { + "name": "pcl", + "default-features": false, + "features": [ + "qt", + "visualization" + ] + }, + { + "name": "qtbase", + "default-features": false, + "features": [ + "gui", + "opengl", + "widgets" + ] + }, + { + "name": "vtk", + "default-features": false + } + ] + }, + "k4w2": { + "description": "Build RTAB-Map with Kinect For Windows SDK 2.0 camera driver", + "dependencies": [ + "kinectsdk2" + ] + }, + "octomap": { + "description": "Build RTAB-Map with OctoMap support", + "dependencies": [ + "octomap" + ] + }, + "opencv-contrib": { + "description": "Use OpenCV with contrib modules (e.g., xfeatures2d, aruco)", + "dependencies": [ + { + "name": "opencv", + "default-features": false, + "features": [ + "contrib" + ] + } + ] + }, + "opencv-cuda": { + "description": "Use OpenCV with CUDA (accelerated SIFT ad SURF GPU options)", + "dependencies": [ + { + "name": "opencv", + "default-features": false, + "features": [ + "cuda" + ] + } + ] + }, + "opencv-nonfree": { + "description": "Use OpenCV with nonfree module (surf feature)", + "dependencies": [ + { + "name": "opencv", + "default-features": false, + "features": [ + "nonfree" + ] + } + ] + }, + "openni2": { + "description": "Build RTAB-Map with OpenNI2 camera driver", + "dependencies": [ + "kinectsdk1", + "openni2" + ] + }, + "realsense2": { + "description": "Build RTAB-Map with RealSense2 camera driver", + "dependencies": [ + { + "name": "realsense2", + "default-features": false + } + ] + }, + "tools": { + "description": "Build RTAB-Map's tools", + "dependencies": [ + "yaml-cpp" + ] + } + } +} diff --git a/cmake/ports/zlib/portfile.cmake b/cmake/ports/zlib/portfile.cmake deleted file mode 100644 index 4fb486e8af..0000000000 --- a/cmake/ports/zlib/portfile.cmake +++ /dev/null @@ -1,15 +0,0 @@ - -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO luxonis/zlib - REF 0e5eb7e3ca8e2cd929148968dc0c8f54ed4c4ede - SHA512 096f008157da402c72f74aedf6480aca755c9c4eb8e594437427b46d2b29f721b87443ac6de11466d3787e93ff57c767e8a8ecd030cc93ddc1885c1e6ab41a97 - HEAD_REF hunter-1.2.11 -) -vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS -) - -vcpkg_cmake_install() - diff --git a/cmake/ports/zlib/vcpkg.json b/cmake/ports/zlib/vcpkg.json deleted file mode 100644 index cf00b90e7c..0000000000 --- a/cmake/ports/zlib/vcpkg.json +++ /dev/null @@ -1,16 +0,0 @@ - -{ - "name": "zlib", - "version-string": "1.2.11-p2", - "description": "A massively spiffy yet delicately unobtrusive compression library.", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - } -] -} From 633ce8e503e4b29b789e72928ed7ff6726f310fc Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 31 Oct 2024 08:59:51 +0100 Subject: [PATCH 012/131] remove hunter gate --- CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd428f748c..e385e0c2e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,12 +89,6 @@ else() endif() -include("cmake/HunterGate.cmake") -HunterGate( - URL "https://github.com/cpp-pm/hunter/archive/9d9242b60d5236269f894efd3ddd60a9ca83dd7f.tar.gz" - SHA1 "16cc954aa723bccd16ea45fc91a858d0c5246376" - LOCAL # Local config for dependencies -) # Move binary dir if windows, to shorten the path if(WIN32) From 4c265b4d38f82b0eeacd2432d1500c0546c9e00d Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 31 Oct 2024 11:50:48 +0100 Subject: [PATCH 013/131] fixing zlib linking and adding hunter private data method --- CMakeLists.txt | 43 ++++++++++++++++++++++++++++++--- cmake/depthaiDependencies.cmake | 11 ++++++--- cmake/ports/rtabmap/vcpkg.json | 16 +----------- 3 files changed, 48 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e385e0c2e8..baa959004f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -484,7 +484,6 @@ if(DEPTHAI_HAVE_PCL_SUPPORT AND DEPTHAI_MERGED_TARGET) target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_TARGET_PCL) target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_HAVE_PCL_SUPPORT) - target_include_directories(${TARGET_CORE_NAME} PUBLIC ${PCL_INCLUDE_DIRS}) target_link_directories(${TARGET_CORE_NAME} PUBLIC ${PCL_LIBRARY_DIRS}) target_compile_definitions(${TARGET_CORE_NAME} PUBLIC ${PCL_DEFINITIONS}) endif() @@ -689,7 +688,7 @@ target_link_libraries(${TARGET_CORE_NAME} nlohmann_json::nlohmann_json libnop spdlog::spdlog - yaml-cpp + yaml-cpp::yaml-cpp # TODO(Morato) - potentiially move this to private foxglove-websocket::foxglove-websocket protobuf::libprotobuf @@ -702,7 +701,7 @@ target_link_libraries(${TARGET_CORE_NAME} BZip2::BZip2 FP16::fp16 archive_static - ZLIB::zlib + ZLIB::ZLIB LZ4::lz4 httplib::httplib mp4v2::mp4v2 @@ -1037,6 +1036,44 @@ if(DEPTHAI_SANITIZE) endif() endif() endif() +function(hunter_private_data) + set(one URL SHA1 CREDENTIALS LOCATION FILE) + set(multiple HTTPHEADER) + + cmake_parse_arguments(x "" "${one}" "${multiple}" "${ARGN}") + + if(x_HTTPHEADER) + message(FATAL_ERROR "HTTPHEADER argument of hunter_private_data not supported if HUNTER_ENABLED is OFF") + endif() + if(x_CREDENTIALS) + message(FATAL_ERROR "CREDENTIALS argument of hunter_private_data not supported if HUNTER_ENABLED is OFF") + endif() + + if(NOT x_URL) + message(FATAL_ERROR "URL not provided to hunter_private_data") + endif() + if(NOT x_SHA1) + message(FATAL_ERROR "SHA1 not provided to hunter_private_data") + endif() + if(NOT x_FILE) + message(FATAL_ERROR "FILE not provided to hunter_private_data") + endif() + if(NOT x_LOCATION) + message(FATAL_ERROR "LOCATION not provided to hunter_private_data") + endif() + + set(x_DOWNLOAD_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/_hunter_private_data/${x_FILE}") + + file(DOWNLOAD + ${x_URL} + ${x_DOWNLOAD_LOCATION} + EXPECTED_HASH SHA1=${x_SHA1} + TLS_VERIFY ON + ) + + # Set the output variable + set(${x_LOCATION} "${x_DOWNLOAD_LOCATION}" PARENT_SCOPE) +endfunction() ######################## # Testing infrastructure diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake index 07132a9914..01f47190b4 100644 --- a/cmake/depthaiDependencies.cmake +++ b/cmake/depthaiDependencies.cmake @@ -27,7 +27,7 @@ if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS)) # httplib for Gate communication find_package(httplib ${_QUIET} CONFIG REQUIRED) # ZLIB for compressing Apps - find_package(ZLIB REQUIRED) + find_package(ZLIB REQUIRED) # spdlog for library and device logging find_package(spdlog ${_QUIET} CONFIG REQUIRED) @@ -92,6 +92,9 @@ else() endif() # OpenCV 4 - (optional) +if(DEPTHAI_OPENCV_SUPPORT) + find_package(OpenCV 4 ${_QUIET} CONFIG REQUIRED) +endif() if(DEPTHAI_PCL_SUPPORT AND NOT TARGET JsonCpp::JsonCpp) find_package(jsoncpp) @@ -107,15 +110,15 @@ set(CMAKE_FIND_ROOT_PATH_TMP ${CMAKE_FIND_ROOT_PATH}) set(CMAKE_FIND_ROOT_PATH "") message("DEPTHAI_OPENCV_SUPPORT: ${DEPTHAI_OPENCV_SUPPORT}") -if(DEPTHAI_OPENCV_SUPPORT) - find_package(OpenCV 4 ${_QUIET} CONFIG REQUIRED) -endif() if(DEPTHAI_PCL_SUPPORT) find_package(PCL CONFIG COMPONENTS common) endif() set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH_TMP}) if(DEPTHAI_RTABMAP_SUPPORT) find_package(RTABMap ${_QUIET} CONFIG REQUIRED COMPONENTS core utilite) +find_package(g2o ${_QUIET} CONFIG REQUIRED) + find_package(Ceres ${_QUIET} CONFIG REQUIRED) +find_package(OpenMP ${_QUIET} REQUIRED) endif() set(CMAKE_MODULE_PATH ${MODULE_TEMP}) diff --git a/cmake/ports/rtabmap/vcpkg.json b/cmake/ports/rtabmap/vcpkg.json index 3ac88550da..d756b47d34 100644 --- a/cmake/ports/rtabmap/vcpkg.json +++ b/cmake/ports/rtabmap/vcpkg.json @@ -30,23 +30,9 @@ "host": true }, "zlib", - "boost-asio", - "boost-date-time", - "boost-dynamic-bitset", "boost-filesystem", - "boost-foreach", "boost-graph", - "boost-interprocess", - "boost-iostreams", - "boost-multi-array", - "boost-property-map", - "boost-ptr-container", - "boost-random", - "boost-signals2", - "boost-sort", - "boost-system", - "boost-thread", - "boost-uuid" + "boost-iostreams" ], "default-features": [ "gui", From a5b46cdde8898edad3f4325885bde59f498f6362 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 31 Oct 2024 13:12:28 +0100 Subject: [PATCH 014/131] lz4 from luxonis --- cmake/ports/libarchive-luxonis/vcpkg.json | 2 +- vcpkg.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/ports/libarchive-luxonis/vcpkg.json b/cmake/ports/libarchive-luxonis/vcpkg.json index 4068e3ce19..f4fc854c16 100644 --- a/cmake/ports/libarchive-luxonis/vcpkg.json +++ b/cmake/ports/libarchive-luxonis/vcpkg.json @@ -11,6 +11,6 @@ "name": "vcpkg-cmake-config", "host": true }, - "lz4" + "lz4-luxonis" ] } diff --git a/vcpkg.json b/vcpkg.json index 9baa4ad3de..234e904b4e 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -14,7 +14,7 @@ "zlib", "spdlog", "bzip2", - "lz4", + "lz4-luxonis", "libarchive-luxonis", "liblzma", "fp16", From 79a3b500b70d7c64050c2e8630a390f80adefd60 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 31 Oct 2024 13:50:41 +0100 Subject: [PATCH 015/131] xlink-usb --- CMakeLists.txt | 5 +++++ cmake/ports/xlink/portfile.cmake | 8 ++++++-- cmake/ports/xlink/vcpkg.json | 8 +++++++- vcpkg.json | 20 +++++++++++++++++++- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index baa959004f..68a7bc6d9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,11 @@ if(DEPTHAI_ENABLE_CURL) endif() # Early options option(DEPTHAI_ENABLE_LIBUSB "Enable usage of libusb and interaction with USB devices" ON) +if(DEPTHAI_ENABLE_LIBUSB) + list(APPEND VCPKG_MANIFEST_FEATURES "xlink-usb") +else() + list(APPEND VCPKG_MANIFEST_FEATURES "xlink") +endif() include(cmake/vcpkg.cmake) # MSVC variable isn't available before 'project' call diff --git a/cmake/ports/xlink/portfile.cmake b/cmake/ports/xlink/portfile.cmake index 5b2e791e63..dbe95aadd5 100644 --- a/cmake/ports/xlink/portfile.cmake +++ b/cmake/ports/xlink/portfile.cmake @@ -5,11 +5,15 @@ vcpkg_from_github( SHA512 e27834680374f348ffb590e181b3592df77c33d2de2c3b78061ff20d3315be5d4688da4ecfca8b3f914955367713ed53d50e61049b2f4eb95d6606b2426de7be HEAD_REF master ) +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + libusb DXLINK_ENABLE_LIBUSB +) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - # temporary - -DXLINK_ENABLE_LIBUSB=ON + # temporary + ${FEATURE_OPTIONS} ) vcpkg_cmake_install() diff --git a/cmake/ports/xlink/vcpkg.json b/cmake/ports/xlink/vcpkg.json index f7405a50ae..6b9fdcea7e 100644 --- a/cmake/ports/xlink/vcpkg.json +++ b/cmake/ports/xlink/vcpkg.json @@ -11,5 +11,11 @@ "name": "vcpkg-cmake-config", "host": true } -] +], + "features": { + "libusb": { + "description": "Build with libusb support" + + } + } } diff --git a/vcpkg.json b/vcpkg.json index 234e904b4e..63931f9465 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -10,7 +10,6 @@ "yaml-cpp", "nlohmann-json", "spdlog", - "xlink", "zlib", "spdlog", "bzip2", @@ -68,6 +67,25 @@ "name": "basalt" } ] + }, + "xlink": { + "description": "Enable XLink support", + "dependencies": [ + { + "name": "xlink" + } + ] + }, + "xlink-usb": { + "description": "Enable XLink support", + "dependencies": [ + { + "name": "xlink", + "features": [ + "libusb" + ] + } + ] } }, "builtin-baseline": "f5ec6f30ff70f04f841436a0f36600bdbabfcfbf" From d071de8cadcff5263e2213e5df9feacc8ef234f7 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 4 Nov 2024 13:04:03 +0100 Subject: [PATCH 016/131] tbb port for basalt --- cmake/ports/basalt/portfile.cmake | 4 ++-- cmake/ports/basalt/vcpkg.json | 3 ++- cmake/ports/tbb/portfile.cmake | 20 ++++++++++++++++++++ cmake/ports/tbb/vcpkg.json | 15 +++++++++++++++ 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 cmake/ports/tbb/portfile.cmake create mode 100644 cmake/ports/tbb/vcpkg.json diff --git a/cmake/ports/basalt/portfile.cmake b/cmake/ports/basalt/portfile.cmake index eb3bcc4a36..273112542d 100644 --- a/cmake/ports/basalt/portfile.cmake +++ b/cmake/ports/basalt/portfile.cmake @@ -2,8 +2,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO luxonis/basalt - REF 2627a83aafa88217370cf3549b19281502e4e205 - SHA512 fb2a3310ecd3bdea00b14a933231072e089620ab4d10a66997757324c8894f75692dff3282c25dfeb2a75ff901ce9912f4a8a454fbd082dce58c331687e0b9c1 + REF b4ec0d98a9b09781958573cc9c3c04f89fb773ca + SHA512 1291995a57b9a509aa0e70afe840f9231240b3bc0ba025f92461be06227cd10fc76e09aed63dbee8eaa28e7787220e613016c23d4c86ccd79dfabd3cc9401b2b HEAD_REF deps_test ) vcpkg_cmake_configure( diff --git a/cmake/ports/basalt/vcpkg.json b/cmake/ports/basalt/vcpkg.json index d0021e65ea..efb4e83250 100644 --- a/cmake/ports/basalt/vcpkg.json +++ b/cmake/ports/basalt/vcpkg.json @@ -13,6 +13,7 @@ "host": true }, "basalt-headers", - "magic-enum" + "magic-enum", + "tbb" ] } diff --git a/cmake/ports/tbb/portfile.cmake b/cmake/ports/tbb/portfile.cmake new file mode 100644 index 0000000000..11e2cd6472 --- /dev/null +++ b/cmake/ports/tbb/portfile.cmake @@ -0,0 +1,20 @@ + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO oneapi-src/oneTBB + REF v2021.12.0 + SHA512 64022bcb61cf7b2030a1bcc11168445ef9f0d69b70290233a7febb71cc7a12cc2282dddc045f84e30893efe276342f02fd78d176706268eeaefe9aac7446d4e9 + HEAD_REF master +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + TBB_PREVIEW_GLOBAL_CONTROL=ON + TBB_TEST=OFF + CMAKE_CXX_VISIBILITY_PRESET=hidden + CMAKE_C_VISIBILITY_PRESET=hidden +) + +vcpkg_cmake_install() + + diff --git a/cmake/ports/tbb/vcpkg.json b/cmake/ports/tbb/vcpkg.json new file mode 100644 index 0000000000..eec1ba823e --- /dev/null +++ b/cmake/ports/tbb/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "tbb", + "version-string": "2021.12.0", + "description": "oneAPI Threading Building Blocks (oneTBB)", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } +] +} From 416feae3c7a82f52ca44599d58e5399377d0aba0 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 4 Nov 2024 16:56:37 +0100 Subject: [PATCH 017/131] try lz4 without w4 flag --- cmake/ports/lz4-luxonis/portfile.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/ports/lz4-luxonis/portfile.cmake b/cmake/ports/lz4-luxonis/portfile.cmake index 932615e067..12bdc7bc45 100644 --- a/cmake/ports/lz4-luxonis/portfile.cmake +++ b/cmake/ports/lz4-luxonis/portfile.cmake @@ -2,10 +2,10 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH - REPO luxonis/lz4 - REF ba358ed311d125333d245e4c284464a72a168983 - SHA512 33955bf214c59ed094ea6961e28b6f59284e8e409ff57d9ba333b1ff12911b392cbb9594a0e88d5d151356471e7297597b445950b977bdca79c21fb69d0291c9 - HEAD_REF dev + REPO Serafadam/lz4 + REF 4067f26aa0f6054cb8a92642518e50ad94591b37 + SHA512 9dc1f48442cd41039dda8eeed1e8fccbc0531983473c7484c121823415ed432f1677182b19533a3d88891dab74ab00295e402333c1513226e974b13fe57dcb0d + HEAD_REF flag_cleanup ) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" From f41d1ea8f04231b7fffe1403408a48e0f0fcb8b8 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 5 Nov 2024 14:31:26 +0100 Subject: [PATCH 018/131] cpp standard for lz4 --- cmake/ports/lz4-luxonis/portfile.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/ports/lz4-luxonis/portfile.cmake b/cmake/ports/lz4-luxonis/portfile.cmake index 12bdc7bc45..fdd5e66501 100644 --- a/cmake/ports/lz4-luxonis/portfile.cmake +++ b/cmake/ports/lz4-luxonis/portfile.cmake @@ -9,6 +9,9 @@ vcpkg_from_github( ) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DCMAKE_CXX_STANDARD=17 + -DCMAKE_C_STANDARD=11 ) vcpkg_cmake_install() From 4087afe8763e7123e28fc4bf627ee84fff40ffd2 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 5 Nov 2024 15:15:40 +0100 Subject: [PATCH 019/131] tbb port args --- cmake/ports/tbb/portfile.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/ports/tbb/portfile.cmake b/cmake/ports/tbb/portfile.cmake index 11e2cd6472..defcaf65a3 100644 --- a/cmake/ports/tbb/portfile.cmake +++ b/cmake/ports/tbb/portfile.cmake @@ -9,10 +9,12 @@ vcpkg_from_github( vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - TBB_PREVIEW_GLOBAL_CONTROL=ON - TBB_TEST=OFF - CMAKE_CXX_VISIBILITY_PRESET=hidden - CMAKE_C_VISIBILITY_PRESET=hidden + -DTBB_PREVIEW_GLOBAL_CONTROL=ON + -DTBB_TEST=OFF + -DCMAKE_CXX_VISIBILITY_PRESET=hidden + -DCMAKE_C_VISIBILITY_PRESET=hidden + -DCMAKE_CXX_STANDARD=17 + -DCMAKE_C_STANDARD=11 ) vcpkg_cmake_install() From 70c31d4ca420647f405afee2762130d2061621f4 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 6 Nov 2024 11:11:12 +0100 Subject: [PATCH 020/131] add mongoose port --- cmake/ports/mongoose/CMakeLists.txt | 28 ++++++++++++++++++++ cmake/ports/mongoose/portfile.cmake | 41 +++++++++++++++++++++++++++++ cmake/ports/mongoose/vcpkg.json | 26 ++++++++++++++++++ cmake/ports/tbb/portfile.cmake | 1 - 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 cmake/ports/mongoose/CMakeLists.txt create mode 100644 cmake/ports/mongoose/portfile.cmake create mode 100644 cmake/ports/mongoose/vcpkg.json diff --git a/cmake/ports/mongoose/CMakeLists.txt b/cmake/ports/mongoose/CMakeLists.txt new file mode 100644 index 0000000000..ae2cce34ca --- /dev/null +++ b/cmake/ports/mongoose/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.14) + +project(mongoose C) + +include(GNUInstallDirs) + +option(ENABLE_SSL "Build with openssl support" OFF) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_library(mongoose mongoose.c) +target_include_directories(mongoose PUBLIC $) +set_target_properties(mongoose PROPERTIES PUBLIC_HEADER mongoose.h) + +if (ENABLE_SSL) + find_package(OpenSSL REQUIRED) + target_compile_options(mongoose PRIVATE -DMG_ENABLE_SSL) + target_link_libraries(mongoose PRIVATE OpenSSL::SSL OpenSSL::Crypto) +endif() + +install(TARGETS mongoose EXPORT unofficial-mongoose-config) + +install( + EXPORT unofficial-mongoose-config + NAMESPACE unofficial::mongoose:: + DESTINATION share/unofficial-mongoose + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ +) diff --git a/cmake/ports/mongoose/portfile.cmake b/cmake/ports/mongoose/portfile.cmake new file mode 100644 index 0000000000..e2b92d72d1 --- /dev/null +++ b/cmake/ports/mongoose/portfile.cmake @@ -0,0 +1,41 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO cesanta/mongoose + REF "${VERSION}" + SHA512 1db358a3f6fb30db62271ba6a57d0410d80b8460819cbf02973b7fceb3128b9039cc8a70fc1edd52a01597b034a08772542eb7fd080a79ee3e30c47b9900dd72 + HEAD_REF master +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + ssl ENABLE_SSL +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + -DCMAKE_CXX_STANDARD=17 + -DCMAKE_C_STANDARD=11 +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT} CONFIG_PATH share/unofficial-${PORT}) + +if("ssl" IN_LIST FEATURES) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-${PORT}-config.cmake" + [[# Generated by CMake]] + [[# Generated by CMake +include(CMakeFindDependencyMacro) +find_dependency(OpenSSL)]]) +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +# Handle copyright +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/cmake/ports/mongoose/vcpkg.json b/cmake/ports/mongoose/vcpkg.json new file mode 100644 index 0000000000..563bdb5060 --- /dev/null +++ b/cmake/ports/mongoose/vcpkg.json @@ -0,0 +1,26 @@ +{ + "name": "mongoose", + "version": "7.15", + "description": "Embedded web server / embedded networking library", + "homepage": "https://cesanta.com/", + "license": null, + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "ssl": { + "description": "Build with openssl", + "dependencies": [ + "openssl" + ] + } + } +} diff --git a/cmake/ports/tbb/portfile.cmake b/cmake/ports/tbb/portfile.cmake index defcaf65a3..29d0ea35f3 100644 --- a/cmake/ports/tbb/portfile.cmake +++ b/cmake/ports/tbb/portfile.cmake @@ -9,7 +9,6 @@ vcpkg_from_github( vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - -DTBB_PREVIEW_GLOBAL_CONTROL=ON -DTBB_TEST=OFF -DCMAKE_CXX_VISIBILITY_PRESET=hidden -DCMAKE_C_VISIBILITY_PRESET=hidden From 1fb8a959b7d5789127ff85c526af33005ddc7814 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 6 Nov 2024 11:28:32 +0100 Subject: [PATCH 021/131] standard for xlink --- cmake/ports/xlink/portfile.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/ports/xlink/portfile.cmake b/cmake/ports/xlink/portfile.cmake index dbe95aadd5..07c55a27d8 100644 --- a/cmake/ports/xlink/portfile.cmake +++ b/cmake/ports/xlink/portfile.cmake @@ -14,6 +14,8 @@ vcpkg_cmake_configure( OPTIONS # temporary ${FEATURE_OPTIONS} + -DCMAKE_CXX_STANDARD=17 + -DCMAKE_C_STANDARD=11 ) vcpkg_cmake_install() From aad83a08d1ce427ac13cba44b35556aed110de72 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 6 Nov 2024 16:53:26 +0100 Subject: [PATCH 022/131] tbb overflow patch --- cmake/ports/tbb/overflow-warning.patch | 14 ++++++++++++++ cmake/ports/tbb/portfile.cmake | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 cmake/ports/tbb/overflow-warning.patch diff --git a/cmake/ports/tbb/overflow-warning.patch b/cmake/ports/tbb/overflow-warning.patch new file mode 100644 index 0000000000..941b85b664 --- /dev/null +++ b/cmake/ports/tbb/overflow-warning.patch @@ -0,0 +1,14 @@ +diff --git a/cmake/compilers/GNU.cmake b/cmake/compilers/GNU.cmake +index 871b72a..76e1900 100644 +--- a/cmake/compilers/GNU.cmake ++++ b/cmake/compilers/GNU.cmake +@@ -26,7 +26,7 @@ else() + set(TBB_DEF_FILE_PREFIX lin${TBB_ARCH}) + endif() + +-set(TBB_WARNING_LEVEL -Wall -Wextra $<$:-Werror> -Wfatal-errors) ++set(TBB_WARNING_LEVEL -Wall -Wextra $<$:-Werror> -Wfatal-errors -Wno-error=stringop-overflow) + set(TBB_TEST_WARNING_FLAGS -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor) + + # Depfile options (e.g. -MD) are inserted automatically in some cases. + diff --git a/cmake/ports/tbb/portfile.cmake b/cmake/ports/tbb/portfile.cmake index 29d0ea35f3..e11cdd844a 100644 --- a/cmake/ports/tbb/portfile.cmake +++ b/cmake/ports/tbb/portfile.cmake @@ -5,6 +5,8 @@ vcpkg_from_github( REF v2021.12.0 SHA512 64022bcb61cf7b2030a1bcc11168445ef9f0d69b70290233a7febb71cc7a12cc2282dddc045f84e30893efe276342f02fd78d176706268eeaefe9aac7446d4e9 HEAD_REF master + PATCHES + overflow-warning.patch ) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" From eaa211fe32119cd451795c5378fb84f8a8fa1bc4 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 6 Nov 2024 18:04:54 +0100 Subject: [PATCH 023/131] custom gklib port --- cmake/ports/gklib/android.patch | 14 +++++ cmake/ports/gklib/build-fixes.patch | 90 +++++++++++++++++++++++++++++ cmake/ports/gklib/portfile.cmake | 27 +++++++++ cmake/ports/gklib/vcpkg.json | 17 ++++++ 4 files changed, 148 insertions(+) create mode 100644 cmake/ports/gklib/android.patch create mode 100644 cmake/ports/gklib/build-fixes.patch create mode 100644 cmake/ports/gklib/portfile.cmake create mode 100644 cmake/ports/gklib/vcpkg.json diff --git a/cmake/ports/gklib/android.patch b/cmake/ports/gklib/android.patch new file mode 100644 index 0000000000..0a9f038dcd --- /dev/null +++ b/cmake/ports/gklib/android.patch @@ -0,0 +1,14 @@ +diff --git a/GKlibSystem.cmake b/GKlibSystem.cmake +index 31a1cf1..848fd05 100644 +--- a/GKlibSystem.cmake ++++ b/GKlibSystem.cmake +@@ -113,7 +113,9 @@ endif(GKRAND) + + + # Check for features. ++if(NOT ANDROID OR ANDROID_NATIVE_API_LEVEL GREATER 32) + check_include_file(execinfo.h HAVE_EXECINFO_H) ++endif() + if(HAVE_EXECINFO_H) + set(GKlib_COPTIONS "${GKlib_COPTIONS} -DHAVE_EXECINFO_H") + endif(HAVE_EXECINFO_H) diff --git a/cmake/ports/gklib/build-fixes.patch b/cmake/ports/gklib/build-fixes.patch new file mode 100644 index 0000000000..9a711154ff --- /dev/null +++ b/cmake/ports/gklib/build-fixes.patch @@ -0,0 +1,90 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9cd1b4b..3912b26 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 2.8) ++cmake_minimum_required(VERSION 3.22) + project(GKlib C) + + option(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" OFF) +@@ -22,10 +22,11 @@ if(UNIX) + target_link_libraries(GKlib m) + endif(UNIX) + +-include_directories("test") +-add_subdirectory("test") + + install(TARGETS GKlib +- ARCHIVE DESTINATION lib/${LINSTALL_PATH} +- LIBRARY DESTINATION lib/${LINSTALL_PATH}) ++ EXPORT GKlibTargets ++ INCLUDES DESTINATION "include/GKlib" ++) ++install(EXPORT GKlibTargets FILE "GKlibConfig.cmake" DESTINATION "share/gklib") ++install(FILES "win32/adapt.h" DESTINATION "include/${HINSTALL_PATH}/win32") + install(FILES ${GKlib_includes} DESTINATION include/${HINSTALL_PATH}) +diff --git a/GKlibSystem.cmake b/GKlibSystem.cmake +index 31a1cf1..172a386 100644 +--- a/GKlibSystem.cmake ++++ b/GKlibSystem.cmake +@@ -18,7 +18,6 @@ option(NO_X86 "enable NO_X86 support" OFF) + + # Add compiler flags. + if(MSVC) +- set(GKlib_COPTS "/Ox") + set(GKlib_COPTIONS "-DWIN32 -DMSC -D_CRT_SECURE_NO_DEPRECATE -DUSE_GKREGEX") + elseif(MINGW) + set(GKlib_COPTS "-DUSE_GKREGEX") +@@ -33,6 +32,8 @@ if(CMAKE_COMPILER_IS_GNUCC) + set(GKlib_COPTIONS "${GKlib_COPTIONS} -std=c99 -fno-strict-aliasing") + if(VALGRIND) + set(GKlib_COPTIONS "${GK_COPTIONS} -march=x86-64 -mtune=generic") ++elseif(1) ++ # Use flags from toolchain and triplet + else() + # -march=native is not a valid flag on PPC: + if(CMAKE_SYSTEM_PROCESSOR MATCHES "power|ppc|powerpc|ppc64|powerpc64" OR (APPLE AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc|ppc64")) +@@ -46,6 +47,7 @@ endif(VALGRIND) + endif(NOT MINGW) + # GCC warnings. + set(GKlib_COPTIONS "${GKlib_COPTIONS} -Werror -Wall -pedantic -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label") ++ string(REPLACE " -Werror " " " GKlib_COPTIONS "${GKlib_COPTIONS}") + elseif(${CMAKE_C_COMPILER_ID} MATCHES "Sun") + # Sun insists on -xc99. + set(GKlib_COPTIONS "${GKlib_COPTIONS} -xc99") +@@ -75,6 +77,8 @@ endif(NO_X86) + if(GDB) + set(GKlib_COPTS "${GKlib_COPTS} -g") + set(GKlib_COPTIONS "${GKlib_COPTIONS} -Werror") ++elseif(1) ++ # Use flags from toolchain and triplet + else() + set(GKlib_COPTS "-O3") + endif(GDB) +diff --git a/gk_ms_inttypes.h b/gk_ms_inttypes.h +index b89fc10..7247c38 100644 +--- a/gk_ms_inttypes.h ++++ b/gk_ms_inttypes.h +@@ -35,6 +35,8 @@ + + #ifndef _MSC_INTTYPES_H_ // [ + #define _MSC_INTTYPES_H_ ++#include ++#elif 0 + + #if _MSC_VER > 1000 + #pragma once +diff --git a/gk_ms_stdint.h b/gk_ms_stdint.h +index 7e200dc..1c51958 100644 +--- a/gk_ms_stdint.h ++++ b/gk_ms_stdint.h +@@ -35,6 +35,8 @@ + + #ifndef _MSC_STDINT_H_ // [ + #define _MSC_STDINT_H_ ++#include ++#elif 0 + + #if _MSC_VER > 1000 + #pragma once diff --git a/cmake/ports/gklib/portfile.cmake b/cmake/ports/gklib/portfile.cmake new file mode 100644 index 0000000000..d35457b0fd --- /dev/null +++ b/cmake/ports/gklib/portfile.cmake @@ -0,0 +1,27 @@ +if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO KarypisLab/GKlib + REF 8bd6bad750b2b0d90800c632cf18e8ee93ad72d7 + SHA512 128cd9a48047b18b8013288162556f0b0f1d81845f5445f7cc62590ab28c06ee0a6c602cc999ce268ab27237eca3e8295df6432d377e45071946b98558872997 + PATCHES + android.patch + build-fixes.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DHINSTALL_PATH=GKlib + -DCMAKE_C_FLAGS="-D_POSIX_C_SOURCE=199309L" +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt") diff --git a/cmake/ports/gklib/vcpkg.json b/cmake/ports/gklib/vcpkg.json new file mode 100644 index 0000000000..5878b88bf3 --- /dev/null +++ b/cmake/ports/gklib/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "gklib", + "version-date": "2023-03-27", + "description": "General helper libraries for KarypisLab.", + "homepage": "https://github.com/KarypisLab/GKlib/", + "license": "Apache-2.0", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} From 52e4a4e0259f01f91d0e4ed4693184d396051b56 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 6 Nov 2024 18:32:23 +0100 Subject: [PATCH 024/131] g2o port update --- cmake/ports/g2o/csparse.diff | 32 +++++++++++++++++++++++ cmake/ports/g2o/portfile.cmake | 46 ++++++++++++++++++++++++++++++++++ cmake/ports/g2o/vcpkg.json | 21 ++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 cmake/ports/g2o/csparse.diff create mode 100644 cmake/ports/g2o/portfile.cmake create mode 100644 cmake/ports/g2o/vcpkg.json diff --git a/cmake/ports/g2o/csparse.diff b/cmake/ports/g2o/csparse.diff new file mode 100644 index 0000000000..c939deef0c --- /dev/null +++ b/cmake/ports/g2o/csparse.diff @@ -0,0 +1,32 @@ +diff --git a/cmake_modules/FindCSparse.cmake b/cmake_modules/FindCSparse.cmake +index 5af693d..8be574f 100644 +--- a/cmake_modules/FindCSparse.cmake ++++ b/cmake_modules/FindCSparse.cmake +@@ -15,6 +15,8 @@ find_path(CSPARSE_INCLUDE_DIR NAMES cs.h + ) + + find_library(CSPARSE_LIBRARY NAMES cxsparse libcxsparse ++ cxsparsed libcxsparsed ++ NAMES_PER_DIR + PATHS + /usr/lib + /usr/local/lib +diff --git a/g2o/solvers/csparse/CMakeLists.txt b/g2o/solvers/csparse/CMakeLists.txt +index 60d1269..e6b80fc 100644 +--- a/g2o/solvers/csparse/CMakeLists.txt ++++ b/g2o/solvers/csparse/CMakeLists.txt +@@ -2,13 +2,13 @@ if(NOT G2O_USE_CSPARSE) + return() + endif() + +-include_directories(${CSPARSE_INCLUDE_DIR}) + + add_library(csparse_extension ${G2O_LGPL_LIB_TYPE} + csparse_helper.cpp csparse_helper.h + csparse_extension.cpp csparse_extension.h + g2o_csparse_extension_api.h + ) ++target_include_directories(csparse_extension PUBLIC ${CSPARSE_INCLUDE_DIR}) + set_target_properties(csparse_extension PROPERTIES OUTPUT_NAME ${LIB_PREFIX}csparse_extension) + if (APPLE) + set_target_properties(csparse_extension PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") diff --git a/cmake/ports/g2o/portfile.cmake b/cmake/ports/g2o/portfile.cmake new file mode 100644 index 0000000000..8075ebda83 --- /dev/null +++ b/cmake/ports/g2o/portfile.cmake @@ -0,0 +1,46 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO RainerKuemmerle/g2o + REF fcba4eaca6f20d9a5792404cc8ef303aeb8ba5d2 + SHA512 41e5a6d40db10d66182653d56f937f29264bf4f9412dfa651be949caeb055741c9d9ba75a122180892aafe7d45b334d50470284121148c0561e1d49f6ba5e20a + HEAD_REF master + PATCHES + csparse.diff +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_LGPL_SHARED_LIBS) +file(REMOVE "${SOURCE_PATH}/cmake_modules/FindBLAS.cmake") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DBUILD_LGPL_SHARED_LIBS=${BUILD_LGPL_SHARED_LIBS} + -DG2O_BUILD_EXAMPLES=OFF + -DG2O_BUILD_APPS=OFF + -DG2O_USE_OPENGL=OFF +) + +vcpkg_cmake_install() + +vcpkg_copy_pdbs() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/g2o) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + file(GLOB_RECURSE HEADERS "${CURRENT_PACKAGES_DIR}/include/*") + foreach(HEADER ${HEADERS}) + file(READ ${HEADER} HEADER_CONTENTS) + string(REPLACE "#ifdef G2O_SHARED_LIBS" "#if 1" HEADER_CONTENTS "${HEADER_CONTENTS}") + file(WRITE ${HEADER} "${HEADER_CONTENTS}") + endforeach() +endif() + +file(GLOB EXE "${CURRENT_PACKAGES_DIR}/bin/*.exe") +file(GLOB DEBUG_EXE "${CURRENT_PACKAGES_DIR}/debug/bin/*.exe") +if(EXE OR DEBUG_EXE) + file(REMOVE ${EXE} ${DEBUG_EXE}) +endif() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +file(INSTALL "${SOURCE_PATH}/doc/license-bsd.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/cmake/ports/g2o/vcpkg.json b/cmake/ports/g2o/vcpkg.json new file mode 100644 index 0000000000..efabcdf092 --- /dev/null +++ b/cmake/ports/g2o/vcpkg.json @@ -0,0 +1,21 @@ +{ + "name": "g2o", + "version-date": "2020-02-07", + "port-version": 6, + "description": "g2o: A General Framework for Graph Optimization", + "homepage": "https://openslam.org/g2o.html", + "dependencies": [ + "ceres", + "eigen3", + "lapack", + "suitesparse", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} From e196c5f7ae93c3a2b8dc2012c42ade6f90492e85 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 7 Nov 2024 10:36:14 +0100 Subject: [PATCH 025/131] enable devtoolset in manylinux x86_64 --- .github/workflows/python-main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index d3c01a16b8..d2553e9f09 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -428,6 +428,7 @@ jobs: - name: Build and install depthai-core run: | + scl enable devtoolset-10 -- bash cmake -S . -B build_core -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$PWD/cmake/toolchain/pic.cmake cmake --build build_core --target install --parallel 4 echo "DEPTHAI_INSTALLATION_DIR=$PWD/build_core/install/" >> $GITHUB_ENV From 42c024b30803caf2477f0499b04475b39bf03fe1 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 7 Nov 2024 12:27:58 +0100 Subject: [PATCH 026/131] enable toolset for arm --- .github/workflows/python-main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index d2553e9f09..eaf6669735 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -514,7 +514,9 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') != true run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV - name: Building wheels - run: cd bindings/python && for PYBIN in /opt/python/cp3{${{ matrix.python-set }}}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done + run: | + scl enable devtoolset-10 -- bash + cd bindings/python && for PYBIN in /opt/python/cp3{${{ matrix.python-set }}}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Auditing wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done - name: Archive wheel artifacts From 6b4e3e4f3072ddc69500f403147f3f6da65f90a4 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 7 Nov 2024 13:17:46 +0100 Subject: [PATCH 027/131] try vcpkg caching in ci --- .github/workflows/python-main.yml | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index eaf6669735..a42253d1ed 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -25,6 +25,8 @@ jobs: # Job which builds docstrings for the rest of the wheel builds build-docstrings: runs-on: ubuntu-latest + env: + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" steps: - name: Cache .hunter folder uses: actions/cache@v3 @@ -33,6 +35,12 @@ jobs: key: hunter-ubuntu-latest-v3-develop - name: List .hunter cache directory run: ls -a -l ~/.hunter/_Base/ || true + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - uses: actions/checkout@v3 with: submodules: 'recursive' @@ -61,6 +69,8 @@ jobs: # Build and test bindings pytest: needs: build-docstrings + env: + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" strategy: matrix: # os: [ubuntu-latest, windows-latest, macos-latest] @@ -82,6 +92,12 @@ jobs: with: path: C:/.hunter/ key: hunter-pytest-${{ matrix.os }}-v3-develop + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - uses: actions/checkout@v3 with: @@ -187,6 +203,8 @@ jobs: build-windows-x86_64: needs: build-docstrings runs-on: windows-latest + env: + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" strategy: matrix: python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12'] @@ -204,6 +222,12 @@ jobs: - uses: actions/checkout@v3 with: submodules: 'recursive' + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - uses: actions/download-artifact@v3 with: @@ -256,6 +280,8 @@ jobs: # This job builds wheels for macOS arch build-macos: needs: build-docstrings + env: + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" strategy: matrix: python-version: [3.8, 3.9, '3.10', '3.11', '3.12'] @@ -276,6 +302,12 @@ jobs: run: | ls -a -l ~/.hunter/_Base/ || true echo "PATH=$PATH" + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - uses: actions/checkout@v3 with: @@ -400,12 +432,19 @@ jobs: DEPTHAI_BUILD_BASALT: ON DEPTHAI_BUILD_PCL: ON DEPTHAI_BUILD_RTABMAP: ON + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" steps: - name: Cache .hunter folder uses: actions/cache@v3 with: path: ~/.hunter key: hunter-x86_64-v3-develop + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - uses: actions/checkout@v3 with: submodules: 'recursive' @@ -480,10 +519,17 @@ jobs: ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true DEPTHAI_VCPKG_CFLAGS: "-std=c99" # Needed so vpckg can bootstrap itself with the old GCC on the manylinux image VCPKG_FORCE_SYSTEM_BINARIES: "1" # Needed so vpckg can bootstrap itself + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" # DEPTHAI_BUILD_BASALT: ON # DEPTHAI_BUILD_PCL: ON # DEPTHAI_BUILD_RTABMAP: ON steps: + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - uses: actions/checkout@v3 with: submodules: 'recursive' From 5e89bbba813f795f471c05bb70ec2f3572f48310 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 7 Nov 2024 13:19:36 +0100 Subject: [PATCH 028/131] typo fix --- .github/workflows/python-main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index a42253d1ed..9a31290712 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -203,8 +203,6 @@ jobs: build-windows-x86_64: needs: build-docstrings runs-on: windows-latest - env: - VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" strategy: matrix: python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12'] @@ -213,6 +211,7 @@ jobs: fail-fast: false env: DEPTHAI_BUILD_BASALT: ON + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" steps: - name: Cache .hunter folder uses: actions/cache@v3 From 97c88d08c9db33201d09249ee0310e909c6d5076 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 7 Nov 2024 16:03:12 +0100 Subject: [PATCH 029/131] update basalt ports --- cmake/ports/basalt-headers/portfile.cmake | 4 ++-- cmake/ports/basalt/portfile.cmake | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/ports/basalt-headers/portfile.cmake b/cmake/ports/basalt-headers/portfile.cmake index 031c155deb..e1ad78009e 100644 --- a/cmake/ports/basalt-headers/portfile.cmake +++ b/cmake/ports/basalt-headers/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO luxonis/basalt-headers - REF 9172c4e6d8c8533d5ebae8289bba2a299f30eb50 - SHA512 39b4b88b147f4d8fb9b2423559c8f07b6e7e43a5136ff461058ab2fe33edfbd1790e6e8684abc2cbe647457752f4ff835c4ed0ed4a370141e345d1e529af2369 + REF 5392967dc6825838a52fa6d6ed38188a55a6acf7 + SHA512 7b22090aacf609e9b8417dd852607d09f0d0db144980852ec1cd73ae2e5fa0f095ef450011a8d7bf6b630f9af8a8ca5870d590de25b8c0783d843344aa48866b HEAD_REF vcpkg_deps ) vcpkg_cmake_configure( diff --git a/cmake/ports/basalt/portfile.cmake b/cmake/ports/basalt/portfile.cmake index 273112542d..f1f9838edd 100644 --- a/cmake/ports/basalt/portfile.cmake +++ b/cmake/ports/basalt/portfile.cmake @@ -2,8 +2,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO luxonis/basalt - REF b4ec0d98a9b09781958573cc9c3c04f89fb773ca - SHA512 1291995a57b9a509aa0e70afe840f9231240b3bc0ba025f92461be06227cd10fc76e09aed63dbee8eaa28e7787220e613016c23d4c86ccd79dfabd3cc9401b2b + REF ac3cd0fbef91e889db27a1a779a5105ba715fef7 + SHA512 1e7694168f92af5f48f462a793fff528c46a4bd01d3417daf2031b651acba70ee9d61d38a33a1be217cc6e97baa67425e1a8fcc4e57a46033954757112326206 HEAD_REF deps_test ) vcpkg_cmake_configure( From a6655483d38965cc446f79ec44ef197535c50c8a Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 7 Nov 2024 18:54:50 +0100 Subject: [PATCH 030/131] new manylinux, opencv and pcl from vcpkg --- .github/workflows/python-main.yml | 8 +++---- cmake/ports/basalt/vcpkg.json | 1 + cmake/ports/libarchive-luxonis/portfile.cmake | 2 -- .../ports/{lz4-luxonis => lz4}/portfile.cmake | 0 cmake/ports/{lz4-luxonis => lz4}/vcpkg.json | 2 +- cmake/ports/opencv/portfile.cmake | 2 -- cmake/ports/opencv/vcpkg.json | 5 ----- cmake/ports/pcl/portfile.cmake | 1 - cmake/ports/pcl/vcpkg.json | 5 ----- vcpkg.json | 22 ++++++++++++++++++- 10 files changed, 27 insertions(+), 21 deletions(-) rename cmake/ports/{lz4-luxonis => lz4}/portfile.cmake (100%) rename cmake/ports/{lz4-luxonis => lz4}/vcpkg.json (90%) delete mode 100644 cmake/ports/opencv/portfile.cmake delete mode 100644 cmake/ports/opencv/vcpkg.json delete mode 100644 cmake/ports/pcl/portfile.cmake delete mode 100644 cmake/ports/pcl/vcpkg.json diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 9a31290712..3d59875b98 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -418,9 +418,9 @@ jobs: needs: build-docstrings runs-on: ubuntu-latest container: - image: mmorato/depthai-manylinux2014:0.4 # TODO(mmorato) temporary location, push to luxonis namespace + image: quay.io/pypa/manylinux_2_28_x86_64 # TODO(mmorato) temporary location, push to luxonis namespace env: - PLAT: manylinux2014_x86_64 + PLAT: manylinux_2_28_x86_64 strategy: matrix: python-set: ["7..9", "10..12"] @@ -503,9 +503,9 @@ jobs: runs-on: [self-hosted, linux, ARM64] timeout-minutes: 1440 # Set timeout to 24 hours container: - image: mmorato/depthai-manylinux2014_aarch64:0.4 + image: quay.io/pypa/manylinux_2_28_aarch64 env: - PLAT: manylinux2014_aarch64 + PLAT: manylinux_2_28_aarch66 # Mount local hunter cache directory, instead of transfering to Github and back volumes: - /.hunter:/github/home/.hunter diff --git a/cmake/ports/basalt/vcpkg.json b/cmake/ports/basalt/vcpkg.json index efb4e83250..5691e04ed3 100644 --- a/cmake/ports/basalt/vcpkg.json +++ b/cmake/ports/basalt/vcpkg.json @@ -12,6 +12,7 @@ "name": "vcpkg-cmake-config", "host": true }, + "opencv", "basalt-headers", "magic-enum", "tbb" diff --git a/cmake/ports/libarchive-luxonis/portfile.cmake b/cmake/ports/libarchive-luxonis/portfile.cmake index ce44ebeed4..20d788c329 100644 --- a/cmake/ports/libarchive-luxonis/portfile.cmake +++ b/cmake/ports/libarchive-luxonis/portfile.cmake @@ -1,5 +1,3 @@ - - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO luxonis/libarchive diff --git a/cmake/ports/lz4-luxonis/portfile.cmake b/cmake/ports/lz4/portfile.cmake similarity index 100% rename from cmake/ports/lz4-luxonis/portfile.cmake rename to cmake/ports/lz4/portfile.cmake diff --git a/cmake/ports/lz4-luxonis/vcpkg.json b/cmake/ports/lz4/vcpkg.json similarity index 90% rename from cmake/ports/lz4-luxonis/vcpkg.json rename to cmake/ports/lz4/vcpkg.json index c73d4b292b..98d63a8ac9 100644 --- a/cmake/ports/lz4-luxonis/vcpkg.json +++ b/cmake/ports/lz4/vcpkg.json @@ -1,5 +1,5 @@ { - "name": "lz4-luxonis", + "name": "lz4", "version-string": "1.9.4-p2", "description": "Extremely Fast Compression algorithm", "dependencies": [ diff --git a/cmake/ports/opencv/portfile.cmake b/cmake/ports/opencv/portfile.cmake deleted file mode 100644 index df3ab59c3b..0000000000 --- a/cmake/ports/opencv/portfile.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set(VCPKG_POLICY_EMPTY_PACKAGE enabled) - diff --git a/cmake/ports/opencv/vcpkg.json b/cmake/ports/opencv/vcpkg.json deleted file mode 100644 index df2cc1b1d3..0000000000 --- a/cmake/ports/opencv/vcpkg.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "opencv", - "version": "4.5.4", - "port-version": 0 -} diff --git a/cmake/ports/pcl/portfile.cmake b/cmake/ports/pcl/portfile.cmake deleted file mode 100644 index 065116c276..0000000000 --- a/cmake/ports/pcl/portfile.cmake +++ /dev/null @@ -1 +0,0 @@ -set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/cmake/ports/pcl/vcpkg.json b/cmake/ports/pcl/vcpkg.json deleted file mode 100644 index cce2561d24..0000000000 --- a/cmake/ports/pcl/vcpkg.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "pcl", - "version": "1.14.0", - "port-version": 0 -} diff --git a/vcpkg.json b/vcpkg.json index 63931f9465..09a5178a4e 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -13,7 +13,7 @@ "zlib", "spdlog", "bzip2", - "lz4-luxonis", + "lz4", "libarchive-luxonis", "liblzma", "fp16", @@ -27,6 +27,18 @@ "rtabmap": { "description": "Enable RTAB-Map support", "dependencies": [ + { + "name": "pcl", + "default-features": false + }, + { + "name": "opencv", + "default-features": false + }, + { + "name": "opencv4", + "default-features": false + }, { "name": "rtabmap", "default-features": false @@ -63,6 +75,14 @@ "basalt": { "description": "Enable Basalt support", "dependencies": [ + { + "name": "opencv", + "default-features": false + }, + { + "name": "opencv4", + "default-features": false + }, { "name": "basalt" } From e9eafdc47e206daf395e4216b1cdd78764800fa6 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 7 Nov 2024 18:59:13 +0100 Subject: [PATCH 031/131] lz4 name change --- cmake/ports/libarchive-luxonis/vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/ports/libarchive-luxonis/vcpkg.json b/cmake/ports/libarchive-luxonis/vcpkg.json index f4fc854c16..4068e3ce19 100644 --- a/cmake/ports/libarchive-luxonis/vcpkg.json +++ b/cmake/ports/libarchive-luxonis/vcpkg.json @@ -11,6 +11,6 @@ "name": "vcpkg-cmake-config", "host": true }, - "lz4-luxonis" + "lz4" ] } From f9d94fc5eccf0cdfa171264bedf1183fac993dad Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 7 Nov 2024 19:03:52 +0100 Subject: [PATCH 032/131] disable features for opencv --- cmake/ports/basalt/vcpkg.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/ports/basalt/vcpkg.json b/cmake/ports/basalt/vcpkg.json index 5691e04ed3..b96f21f399 100644 --- a/cmake/ports/basalt/vcpkg.json +++ b/cmake/ports/basalt/vcpkg.json @@ -12,7 +12,10 @@ "name": "vcpkg-cmake-config", "host": true }, - "opencv", + { + "name": "opencv4", + "default-features": false + }, "basalt-headers", "magic-enum", "tbb" From e76c50c2959e84d51631dbdd7148938b46751b39 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 7 Nov 2024 19:19:52 +0100 Subject: [PATCH 033/131] switch order --- vcpkg.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vcpkg.json b/vcpkg.json index 09a5178a4e..ad39b2ba3c 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -32,11 +32,11 @@ "default-features": false }, { - "name": "opencv", + "name": "opencv4", "default-features": false }, { - "name": "opencv4", + "name": "opencv", "default-features": false }, { @@ -76,11 +76,11 @@ "description": "Enable Basalt support", "dependencies": [ { - "name": "opencv", + "name": "opencv4", "default-features": false }, { - "name": "opencv4", + "name": "opencv", "default-features": false }, { From 54967cd2d893993c1c88f247ca609095e5ad6153 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 7 Nov 2024 19:25:54 +0100 Subject: [PATCH 034/131] pcl and oepncv from vcpkg in docstrings ci --- .github/workflows/python-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 3d59875b98..393bb8ab82 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -52,7 +52,7 @@ jobs: run: | sudo apt update python -m pip install --upgrade pip - sudo apt install libusb-1.0-0-dev libopencv-dev libpcl-dev + sudo apt install libusb-1.0-0-dev python -m pip install -r bindings/python/docs/requirements_mkdoc.txt - name: Configure project run: cmake -S . -B build -DDEPTHAI_BUILD_PYTHON=ON -DDEPTHAI_PYTHON_FORCE_DOCSTRINGS=ON -DDEPTHAI_BASALT_SUPPORT=ON -DDEPTHAI_PCL_SUPPORT=ON -DDEPTHAI_RTABMAP_SUPPORT=ON -DDEPTHAI_PYTHON_DOCSTRINGS_OUTPUT="$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" From c9e649487a8bd69b5091ea7fd3f5a7a3653fa930 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Fri, 8 Nov 2024 12:01:17 +0100 Subject: [PATCH 035/131] use mainstream lz4 --- cmake/ports/lz4/portfile.cmake | 18 ------------------ cmake/ports/lz4/vcpkg.json | 15 --------------- cmake/ports/rtabmap/vcpkg.json | 5 +---- 3 files changed, 1 insertion(+), 37 deletions(-) delete mode 100644 cmake/ports/lz4/portfile.cmake delete mode 100644 cmake/ports/lz4/vcpkg.json diff --git a/cmake/ports/lz4/portfile.cmake b/cmake/ports/lz4/portfile.cmake deleted file mode 100644 index fdd5e66501..0000000000 --- a/cmake/ports/lz4/portfile.cmake +++ /dev/null @@ -1,18 +0,0 @@ - - -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO Serafadam/lz4 - REF 4067f26aa0f6054cb8a92642518e50ad94591b37 - SHA512 9dc1f48442cd41039dda8eeed1e8fccbc0531983473c7484c121823415ed432f1677182b19533a3d88891dab74ab00295e402333c1513226e974b13fe57dcb0d - HEAD_REF flag_cleanup -) -vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -DCMAKE_CXX_STANDARD=17 - -DCMAKE_C_STANDARD=11 -) - -vcpkg_cmake_install() - diff --git a/cmake/ports/lz4/vcpkg.json b/cmake/ports/lz4/vcpkg.json deleted file mode 100644 index 98d63a8ac9..0000000000 --- a/cmake/ports/lz4/vcpkg.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "lz4", - "version-string": "1.9.4-p2", - "description": "Extremely Fast Compression algorithm", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - } -] -} diff --git a/cmake/ports/rtabmap/vcpkg.json b/cmake/ports/rtabmap/vcpkg.json index d756b47d34..b1ff61f422 100644 --- a/cmake/ports/rtabmap/vcpkg.json +++ b/cmake/ports/rtabmap/vcpkg.json @@ -29,10 +29,7 @@ "name": "vcpkg-cmake-config", "host": true }, - "zlib", - "boost-filesystem", - "boost-graph", - "boost-iostreams" + "zlib" ], "default-features": [ "gui", From 474abb1e5e0a3cc57ef67d068fc829dfb706736e Mon Sep 17 00:00:00 2001 From: Serafadam Date: Fri, 8 Nov 2024 13:37:02 +0100 Subject: [PATCH 036/131] update g2o commit --- cmake/ports/g2o/portfile.cmake | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmake/ports/g2o/portfile.cmake b/cmake/ports/g2o/portfile.cmake index 8075ebda83..4d8da8119a 100644 --- a/cmake/ports/g2o/portfile.cmake +++ b/cmake/ports/g2o/portfile.cmake @@ -1,11 +1,9 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO RainerKuemmerle/g2o - REF fcba4eaca6f20d9a5792404cc8ef303aeb8ba5d2 - SHA512 41e5a6d40db10d66182653d56f937f29264bf4f9412dfa651be949caeb055741c9d9ba75a122180892aafe7d45b334d50470284121148c0561e1d49f6ba5e20a + REF 11440dc477508329775dc79e4cdb572f51336d82 + SHA512 da88b0900e11e60df33dceb00737d2425579601c025e7deec93f5cf3616f36f043799226356d786731d75106da0026786f0cf91feca21b36e31c20107bfb126b HEAD_REF master - PATCHES - csparse.diff ) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_LGPL_SHARED_LIBS) From ab58a4bad21e2a6f6a56982c73b33492c79ed92f Mon Sep 17 00:00:00 2001 From: Serafadam Date: Fri, 8 Nov 2024 13:44:57 +0100 Subject: [PATCH 037/131] comment out pcl library dirs for now --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 68a7bc6d9f..d68bb0633e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -489,7 +489,7 @@ if(DEPTHAI_HAVE_PCL_SUPPORT AND DEPTHAI_MERGED_TARGET) target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_TARGET_PCL) target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_HAVE_PCL_SUPPORT) - target_link_directories(${TARGET_CORE_NAME} PUBLIC ${PCL_LIBRARY_DIRS}) + #target_link_directories(${TARGET_CORE_NAME} PUBLIC ${PCL_LIBRARY_DIRS}) target_compile_definitions(${TARGET_CORE_NAME} PUBLIC ${PCL_DEFINITIONS}) endif() if(DEPTHAI_MERGED_TARGET) From 5535e7452dccb1d425ab50a7b04ba2355b9de3ae Mon Sep 17 00:00:00 2001 From: Serafadam Date: Fri, 8 Nov 2024 14:41:57 +0100 Subject: [PATCH 038/131] pcl include dirs update --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d68bb0633e..e43bb7d8a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -488,8 +488,10 @@ if(DEPTHAI_HAVE_PCL_SUPPORT AND DEPTHAI_MERGED_TARGET) # Specify that we are building target pcl target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_TARGET_PCL) target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_HAVE_PCL_SUPPORT) - - #target_link_directories(${TARGET_CORE_NAME} PUBLIC ${PCL_LIBRARY_DIRS}) + target_link_directories(${TARGET_CORE_NAME} PUBLIC + $ + $ + ) target_compile_definitions(${TARGET_CORE_NAME} PUBLIC ${PCL_DEFINITIONS}) endif() if(DEPTHAI_MERGED_TARGET) From e206d79cbc0b065302859b62277ed50144acc8a6 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Fri, 8 Nov 2024 14:50:06 +0100 Subject: [PATCH 039/131] update workflow --- .github/workflows/python-main.yml | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 393bb8ab82..0c510abfd9 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -126,17 +126,11 @@ jobs: run: | python -m pip install --upgrade pip brew install libusb - brew install opencv - name: Setup cmake if: matrix.os == 'macos-latest' uses: jwlawson/actions-setup-cmake@v1.13 - - name: Install dependencies (Windows) - if: matrix.os == 'windows-latest' - run: | - choco install opencv - echo "OpenCV_DIR=C:\tools\opencv\build" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Install pytest run: | @@ -235,18 +229,6 @@ jobs: - name: Specify docstring to use while building the wheel run: echo "DEPTHAI_PYTHON_DOCSTRINGS_INPUT=$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - name: Install dependencies for x86 - if: matrix.python-architecture == 'x86' - run: | - choco install opencv --x86 - echo "OpenCV_DIR=C:\tools\opencv\build" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Install dependencies for x64 - if: matrix.python-architecture == 'x64' - run: | - choco install opencv - echo "OpenCV_DIR=C:\tools\opencv\build" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - name: Select Windows SDK run: echo "CMAKE_ARGS=-DCMAKE_SYSTEM_VERSION=${{ env.CMAKE_WINDOWS_SDK_VERSION }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append @@ -330,7 +312,6 @@ jobs: run: | python -m pip install --upgrade pip brew install libusb - brew install opencv # brew install pcl python -m pip install delocate - name: Building wheels @@ -448,7 +429,7 @@ jobs: with: submodules: 'recursive' - name: Installing libusb1-devel dependency - run: yum install -y --disableplugin=fastestmirror libusb1-devel perl-core curl zip unzip tar ninja-build + run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build - name: Installing cmake dependency run: | cd bindings/python @@ -466,7 +447,6 @@ jobs: - name: Build and install depthai-core run: | - scl enable devtoolset-10 -- bash cmake -S . -B build_core -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$PWD/cmake/toolchain/pic.cmake cmake --build build_core --target install --parallel 4 echo "DEPTHAI_INSTALLATION_DIR=$PWD/build_core/install/" >> $GITHUB_ENV @@ -533,7 +513,7 @@ jobs: with: submodules: 'recursive' - name: Installing libusb1-devel dependency - run: yum install -y --disableplugin=fastestmirror libusb1-devel perl-core curl zip unzip tar ninja-build + run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build - name: Installing cmake dependency run: | cd bindings/python @@ -560,7 +540,6 @@ jobs: run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV - name: Building wheels run: | - scl enable devtoolset-10 -- bash cd bindings/python && for PYBIN in /opt/python/cp3{${{ matrix.python-set }}}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Auditing wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done From 128c878bad4757c381b0c60775feb53952637d6d Mon Sep 17 00:00:00 2001 From: Adam Serafin Date: Fri, 8 Nov 2024 15:59:11 +0100 Subject: [PATCH 040/131] Update vcpkg.json --- vcpkg.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index ad39b2ba3c..8667b97eba 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -21,7 +21,11 @@ "libnop", "neargye-semver", "pybind11", - "catch2" + "catch2", + { + "name": "opencv4", + "default-features": false + } ], "features": { "rtabmap": { From 43f1650c7f8c6af31b892c881172396d14082cc3 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Fri, 8 Nov 2024 16:53:47 +0100 Subject: [PATCH 041/131] remove hunter install dependencies --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e43bb7d8a7..7d3e0e7375 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1184,7 +1184,7 @@ if(DEPTHAI_INSTALL) # Install depthai-bootloader-shared public headers install(DIRECTORY "${DEPTHAI_BOOTLOADER_SHARED_PUBLIC_INCLUDE}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") # Install Hunter dependencies - install(DIRECTORY "${HUNTER_INSTALL_PREFIX}/" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/dependencies") + # install(DIRECTORY "${HUNTER_INSTALL_PREFIX}/" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/dependencies") # Install depthai-core dependencies install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/3rdparty" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake") # Install resources if not RC'd From 67ea4dce19891c129a13da2974b7ee6c873f3932 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 11 Nov 2024 13:30:49 +0100 Subject: [PATCH 042/131] updates in xlink and cpr ports --- cmake/ports/cpr/disable_werror.patch | 13 ++++++ cmake/ports/cpr/multi_cert.patch | 46 +++++++++++++++++++++ cmake/ports/cpr/portfile.cmake | 34 ++++++++++++--- cmake/ports/cpr/vcpkg.json | 59 +++++++++++++++++++-------- cmake/ports/xlink/portfile.cmake | 2 + cmake/ports/xlink/werror-switch.patch | 16 ++++++++ 6 files changed, 146 insertions(+), 24 deletions(-) create mode 100644 cmake/ports/cpr/disable_werror.patch create mode 100644 cmake/ports/cpr/multi_cert.patch create mode 100644 cmake/ports/xlink/werror-switch.patch diff --git a/cmake/ports/cpr/disable_werror.patch b/cmake/ports/cpr/disable_werror.patch new file mode 100644 index 0000000000..73cc120439 --- /dev/null +++ b/cmake/ports/cpr/disable_werror.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 70d3296..293ce95 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -379,7 +379,7 @@ if(CPR_BUILD_TESTS) + restore_variable(DESTINATION CMAKE_CXX_CLANG_TIDY BACKUP CMAKE_CXX_CLANG_TIDY_BKP) + endif() + +-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") ++if (1) + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror") + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") diff --git a/cmake/ports/cpr/multi_cert.patch b/cmake/ports/cpr/multi_cert.patch new file mode 100644 index 0000000000..3d448e81d6 --- /dev/null +++ b/cmake/ports/cpr/multi_cert.patch @@ -0,0 +1,46 @@ +diff --git a/cpr/session.cpp b/cpr/session.cpp +index b2263ec..c22b27b 100644 +--- a/cpr/session.cpp ++++ b/cpr/session.cpp +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -134,6 +135,33 @@ Session::Session() : curl_(new CurlHolder()) { + curl_easy_setopt(curl_->handle, CURLOPT_NOPROGRESS, 1L); + curl_easy_setopt(curl_->handle, CURLOPT_ERRORBUFFER, curl_->error.data()); + curl_easy_setopt(curl_->handle, CURLOPT_COOKIEFILE, ""); ++ ++#ifdef __linux__ ++ static const char* cert_path = nullptr; ++ ++ // Find the system certificate store ++ if (cert_path == nullptr) { ++ // List of possible paths: ++ // https://github.com/cpp-pm/curl/blob/25d45e89d140d6ab27103cd7f8f6d7d6cf548d47/CMakeLists.txt#L919 ++ static constexpr const char* certificatePaths[] = { ++ "/etc/ssl/certs/ca-certificates.crt", "/etc/pki/tls/certs/ca-bundle.crt", ++ "/usr/share/ssl/certs/ca-bundle.crt", "/usr/local/share/certs/ca-root-nss.crt", ++ "/etc/ssl/cert.pem"}; ++ ++ for (const auto& path : certificatePaths) { ++ if (std::filesystem::exists(path)) { ++ cert_path = path; ++ break; ++ } ++ } ++ } ++ ++ // Set certificate path ++ if (cert_path != nullptr) { ++ curl_easy_setopt(curl_->handle, CURLOPT_CAINFO, cert_path); ++ } ++#endif ++ + #ifdef CPR_CURL_NOSIGNAL + curl_easy_setopt(curl_->handle, CURLOPT_NOSIGNAL, 1L); + #endif diff --git a/cmake/ports/cpr/portfile.cmake b/cmake/ports/cpr/portfile.cmake index f9a51fc2cb..af3e9bf1e4 100644 --- a/cmake/ports/cpr/portfile.cmake +++ b/cmake/ports/cpr/portfile.cmake @@ -1,16 +1,38 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH - REPO Serafadam/cpr - REF c898870a8992c1a679c04b8da3979b8cbcb91a6d - SHA512 efa68d4e41668345988ce2403e4ef1f98d0e7f6bdca797174f8c6f5eb5dbdd818faa75aa583ce89391154e2cfe528e0128f1657421a2c8a0ddc71fe43b559a84 - HEAD_REF vcpkg + REPO libcpr/cpr + REF ${VERSION} + SHA512 c314fc576fb8be36bf43326a8a2d8b22d6b2fbb3b494695b84dd8077fc0401981e49890172fc2229d1c68292be2820cd4231d58bcb64326cbe4b73933c092d76 + HEAD_REF master + PATCHES + disable_werror.patch + multi_cert.patch ) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + ssl CPR_ENABLE_SSL +) + vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -DBUILD_CPR_TESTS=OFF + OPTIONS + -DCPR_BUILD_TESTS=OFF + -DCPR_USE_SYSTEM_CURL=ON + ${FEATURE_OPTIONS} + # skip test for unused sanitizer flags + -DTHREAD_SANITIZER_AVAILABLE=OFF + -DADDRESS_SANITIZER_AVAILABLE=OFF + -DLEAK_SANITIZER_AVAILABLE=OFF + -DUNDEFINED_BEHAVIOUR_SANITIZER_AVAILABLE=OFF + -DALL_SANITIZERS_AVAILABLE=OFF ) vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/cpr) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/cmake/ports/cpr/vcpkg.json b/cmake/ports/cpr/vcpkg.json index 00f409c841..efc49a5991 100644 --- a/cmake/ports/cpr/vcpkg.json +++ b/cmake/ports/cpr/vcpkg.json @@ -1,19 +1,42 @@ - { - "name": "cpr", - "version-string": "1.4.0", - "description": "C++ Requests: Curl for People, a spiritual port of Python Requests.", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - }, - "curl", - "mongoose", - "gtest" -] -} + "name": "cpr", + "version-semver": "1.11.0", + "description": "C++ Requests is a simple wrapper around libcurl inspired by the excellent Python Requests project.", + "homepage": "https://github.com/libcpr/cpr", + "license": "MIT", + "dependencies": [ + { + "name": "curl", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "ssl" + ], + "features": { + "ssl": { + "description": "Enable SSL support", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "ssl" + ] + }, + { + "name": "openssl", + "platform": "linux" + } + ] + } + } + } diff --git a/cmake/ports/xlink/portfile.cmake b/cmake/ports/xlink/portfile.cmake index 07c55a27d8..ea902412d9 100644 --- a/cmake/ports/xlink/portfile.cmake +++ b/cmake/ports/xlink/portfile.cmake @@ -4,6 +4,8 @@ vcpkg_from_github( REF 585a38fe4707e5f023de277135d8cb6ff9c4e0c4 SHA512 e27834680374f348ffb590e181b3592df77c33d2de2c3b78061ff20d3315be5d4688da4ecfca8b3f914955367713ed53d50e61049b2f4eb95d6606b2426de7be HEAD_REF master + PATCHES + werror-switch.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES diff --git a/cmake/ports/xlink/werror-switch.patch b/cmake/ports/xlink/werror-switch.patch new file mode 100644 index 0000000000..471aeef6ed --- /dev/null +++ b/cmake/ports/xlink/werror-switch.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3161667..1389fce 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -60,7 +60,9 @@ include(cmake/Flags.cmake) + + # Create library target + add_library(${TARGET_NAME} ${XLINK_SOURCES}) +-add_flag_source(src/shared/XLinkDevice.c "-Werror=switch-enum") ++if ("${CMAKE_C_COMPILER_ID}" MATCHES "^(AppleClang|Clang|GNU)$") ++ add_flag_source(src/shared/XLinkDevice.c "-Werror=switch-enum") ++endif() + get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG) + if(is_multi_config) + set_target_properties(${TARGET_NAME} PROPERTIES DEBUG_POSTFIX "d") + From 999ae87da565773eab1491d3cd313594200a5989 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 11 Nov 2024 13:31:45 +0100 Subject: [PATCH 043/131] disable basalt on windows for now --- .github/workflows/python-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 0c510abfd9..ea3ba82ab3 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -204,7 +204,7 @@ jobs: python-architecture: [x64] # TODO(Morato) - re-enable x86 - it complains that OpenCV even though it's 32 bit is not compatible fail-fast: false env: - DEPTHAI_BUILD_BASALT: ON + DEPTHAI_BUILD_BASALT: OFF VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" steps: - name: Cache .hunter folder From 339579b860ee89e4102c86becc53eaecad943b06 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 11 Nov 2024 13:55:34 +0100 Subject: [PATCH 044/131] update to latest v3_develop --- CMakeLists.txt | 6 +- vcpkg.json | 276 +++++++++++++++++++++---------------------------- 2 files changed, 121 insertions(+), 161 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04555302ff..32ec8578f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,10 +39,6 @@ else() set(DEPTHAI_DEFAULT_CURL_SUPPORT ON) endif() -option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT}) -if(DEPTHAI_ENABLE_CURL) - list(APPEND VCPKG_MANIFEST_FEATURES "curl") -endif() # Early options option(DEPTHAI_ENABLE_LIBUSB "Enable usage of libusb and interaction with USB devices" ON) if(DEPTHAI_ENABLE_LIBUSB) @@ -741,7 +737,7 @@ target_link_libraries(${TARGET_CORE_NAME} nlohmann_json::nlohmann_json libnop spdlog::spdlog - yaml-cpp + yaml-cpp::yaml-cpp INTERFACE XLinkPublic PRIVATE diff --git a/vcpkg.json b/vcpkg.json index ab83897504..08e3a8fc40 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,159 +1,123 @@ { - "name": "depthai", - "dependencies": [ - "websocketpp", - "protobuf", - "openssl", - "cpp-httplib", - "libpng", - "tiff", - "yaml-cpp", - "nlohmann-json", - "spdlog", - "zlib", - "spdlog", - "bzip2", - "lz4", - "libarchive-luxonis", - "liblzma", - "fp16", - "mp4v2", - "libnop", - "neargye-semver", - "pybind11", - "catch2", - { - "name": "opencv4", - "default-features": false - } - ], - "features": { - "rtabmap": { - "description": "Enable RTAB-Map support", - "dependencies": [ - { - "name": "pcl", - "default-features": false - }, - { - "name": "opencv4", - "default-features": false - }, - { - "name": "opencv", - "default-features": false - }, - { - "name": "rtabmap", - "default-features": false - } - ] - }, - "apriltag": { - "description": "Enable AprilTag support", - "dependencies": [ - { - "name": "apriltag" - } - ] - }, - "backward": { - "description": "Enable backward-cpp support", - "dependencies": [ - { - "name": "backward-cpp" - } - ] - }, - "curl": { - "description": "Enable cURL support", - "dependencies": [ - { - "name": "curl" - }, - { - "name": "cpr" - } - ] - }, - "basalt": { - "description": "Enable Basalt support", - "dependencies": [ - { - "name": "opencv4", - "default-features": false - }, - { - "name": "opencv", - "default-features": false - }, - { - "name": "basalt" - } - ] - }, - "xlink": { - "description": "Enable XLink support", - "dependencies": [ - { - "name": "xlink" - } - ] - }, - "xlink-usb": { - "description": "Enable XLink support", - "dependencies": [ - { - "name": "xlink", - "features": [ - "libusb" - ] - } - ] - } - }, - "builtin-baseline": "f5ec6f30ff70f04f841436a0f36600bdbabfcfbf" -} - "dependencies": [ - "zlib" - ], - "features": { - "curl-support": { - "description": "Enable CURL support", - "dependencies": [ - "cpr" - ] - }, - "protobuf-support": { - "description": "Enable Protobuf support", - "dependencies": [ - "protobuf" - ] - }, - "remote-connection-support": { - "description": "Enable remote connection support", - "dependencies": [ - "websocketpp" - ] - } - }, - "overrides": [ - { - "name": "websocketpp", - "version": "0.8.2" - }, - { - "name": "protobuf", - "version": "3.21.12" - }, - { - "name": "cpr", - "version": "1.11.0" + "name": "depthai", + "dependencies": [ + "websocketpp", + "protobuf", + "openssl", + "cpp-httplib", + "libpng", + "tiff", + "yaml-cpp", + "nlohmann-json", + "spdlog", + "zlib", + "spdlog", + "bzip2", + "lz4", + "libarchive-luxonis", + "liblzma", + "fp16", + "mp4v2", + "libnop", + "neargye-semver", + "pybind11", + "catch2", + { + "name": "opencv4", + "default-features": false + } + ], + "features": { + "curl-support": { + "description": "Enable CURL support", + "dependencies": [ + "cpr" + ] + }, + "protobuf-support": { + "description": "Enable Protobuf support", + "dependencies": [ + "protobuf" + ] + }, + "remote-connection-support": { + "description": "Enable remote connection support", + "dependencies": [ + "websocketpp" + ] + }, + "rtabmap": { + "description": "Enable RTAB-Map support", + "dependencies": [ + { + "name": "pcl", + "default-features": false + }, + { + "name": "opencv4", + "default-features": false + }, + { + "name": "opencv", + "default-features": false + }, + { + "name": "rtabmap", + "default-features": false + } + ] + }, + "apriltag": { + "description": "Enable AprilTag support", + "dependencies": [ + { + "name": "apriltag" + } + ] + }, + "backward": { + "description": "Enable backward-cpp support", + "dependencies": [ + { + "name": "backward-cpp" + } + ] + }, + "basalt": { + "description": "Enable Basalt support", + "dependencies": [ + { + "name": "opencv4", + "default-features": false + }, + { + "name": "opencv", + "default-features": false + }, + { + "name": "basalt" + } + ] + }, + "xlink": { + "description": "Enable XLink support", + "dependencies": [ + { + "name": "xlink" + } + ] + }, + "xlink-usb": { + "description": "Enable XLink support", + "dependencies": [ + { + "name": "xlink", + "features": [ + "libusb" + ] + } + ] + } }, - { - "name": "zlib", - "version": "1.3.1" - } - ], - "builtin-baseline": "f5ec6f30ff70f04f841436a0f36600bdbabfcfbf" + "builtin-baseline": "f5ec6f30ff70f04f841436a0f36600bdbabfcfbf" } From 73334eccc7313f7316e241ddf4540ad8ea35c9f7 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 11 Nov 2024 14:02:09 +0100 Subject: [PATCH 045/131] xlink hunter bump --- cmake/ports/xlink/hunter-bump.patch | 14 ++++++++++++++ cmake/ports/xlink/portfile.cmake | 1 + 2 files changed, 15 insertions(+) create mode 100644 cmake/ports/xlink/hunter-bump.patch diff --git a/cmake/ports/xlink/hunter-bump.patch b/cmake/ports/xlink/hunter-bump.patch new file mode 100644 index 0000000000..9318229dcf --- /dev/null +++ b/cmake/ports/xlink/hunter-bump.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bf6f2d5..efbd68e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,8 +6,8 @@ cmake_minimum_required(VERSION 3.2) + + include("cmake/HunterGate.cmake") + HunterGate( +- URL "https://github.com/cpp-pm/hunter/archive/v0.25.320.tar.gz" +- SHA1 "9b4e732afd22f40482c11ad6342f7d336634226f" ++ URL "https://github.com/cpp-pm/hunter/archive/v0.25.7.tar.gz" ++ SHA1 "99f05ff154c682f7349546d66294d2f69f7193bc" + LOCAL # Local config for dependencies + ) diff --git a/cmake/ports/xlink/portfile.cmake b/cmake/ports/xlink/portfile.cmake index ea902412d9..d85547c28c 100644 --- a/cmake/ports/xlink/portfile.cmake +++ b/cmake/ports/xlink/portfile.cmake @@ -6,6 +6,7 @@ vcpkg_from_github( HEAD_REF master PATCHES werror-switch.patch + hunter-bump.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES From 84db9ff4ff72f6ecef488c1949f031b0221bb5b1 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 11 Nov 2024 14:13:29 +0100 Subject: [PATCH 046/131] typo --- cmake/ports/xlink/hunter-bump.patch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/ports/xlink/hunter-bump.patch b/cmake/ports/xlink/hunter-bump.patch index 9318229dcf..66467b0df1 100644 --- a/cmake/ports/xlink/hunter-bump.patch +++ b/cmake/ports/xlink/hunter-bump.patch @@ -1,14 +1,15 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index bf6f2d5..efbd68e 100644 +index 3161667..1389fce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,8 @@ cmake_minimum_required(VERSION 3.2) include("cmake/HunterGate.cmake") HunterGate( -- URL "https://github.com/cpp-pm/hunter/archive/v0.25.320.tar.gz" +- URL "https://github.com/cpp-pm/hunter/archive/v0.23.320.tar.gz" - SHA1 "9b4e732afd22f40482c11ad6342f7d336634226f" + URL "https://github.com/cpp-pm/hunter/archive/v0.25.7.tar.gz" + SHA1 "99f05ff154c682f7349546d66294d2f69f7193bc" LOCAL # Local config for dependencies ) + From 760f6081dbf44dcb1cf5490d2f8063406c275d09 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 11 Nov 2024 15:16:29 +0100 Subject: [PATCH 047/131] add eol --- cmake/ports/xlink/hunter-bump.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/ports/xlink/hunter-bump.patch b/cmake/ports/xlink/hunter-bump.patch index 66467b0df1..18c816e7e6 100644 --- a/cmake/ports/xlink/hunter-bump.patch +++ b/cmake/ports/xlink/hunter-bump.patch @@ -12,4 +12,4 @@ index 3161667..1389fce 100644 + SHA1 "99f05ff154c682f7349546d66294d2f69f7193bc" LOCAL # Local config for dependencies ) - + From 6c677f84b1921d11fcba46fa59b4162345d0e116 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 11 Nov 2024 15:36:35 +0100 Subject: [PATCH 048/131] xlink to latest --- cmake/ports/xlink/hunter-bump.patch | 15 --------------- cmake/ports/xlink/portfile.cmake | 7 ++----- cmake/ports/xlink/werror-switch.patch | 16 ---------------- 3 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 cmake/ports/xlink/hunter-bump.patch delete mode 100644 cmake/ports/xlink/werror-switch.patch diff --git a/cmake/ports/xlink/hunter-bump.patch b/cmake/ports/xlink/hunter-bump.patch deleted file mode 100644 index 18c816e7e6..0000000000 --- a/cmake/ports/xlink/hunter-bump.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3161667..1389fce 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -6,8 +6,8 @@ cmake_minimum_required(VERSION 3.2) - - include("cmake/HunterGate.cmake") - HunterGate( -- URL "https://github.com/cpp-pm/hunter/archive/v0.23.320.tar.gz" -- SHA1 "9b4e732afd22f40482c11ad6342f7d336634226f" -+ URL "https://github.com/cpp-pm/hunter/archive/v0.25.7.tar.gz" -+ SHA1 "99f05ff154c682f7349546d66294d2f69f7193bc" - LOCAL # Local config for dependencies - ) - diff --git a/cmake/ports/xlink/portfile.cmake b/cmake/ports/xlink/portfile.cmake index d85547c28c..9dad1f317f 100644 --- a/cmake/ports/xlink/portfile.cmake +++ b/cmake/ports/xlink/portfile.cmake @@ -1,12 +1,9 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO luxonis/XLink - REF 585a38fe4707e5f023de277135d8cb6ff9c4e0c4 - SHA512 e27834680374f348ffb590e181b3592df77c33d2de2c3b78061ff20d3315be5d4688da4ecfca8b3f914955367713ed53d50e61049b2f4eb95d6606b2426de7be + REF 2b517e1cb1ca77bea17679f9fdeb739812431174 + SHA512 f4c48411115a7708e60e73bda35350eaf2dfc23d84c7d5516dde8253ab06f2f226ff8529e567f26a135f9d909861f660336e4d6676326224c63d3be8828940cc HEAD_REF master - PATCHES - werror-switch.patch - hunter-bump.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES diff --git a/cmake/ports/xlink/werror-switch.patch b/cmake/ports/xlink/werror-switch.patch deleted file mode 100644 index 471aeef6ed..0000000000 --- a/cmake/ports/xlink/werror-switch.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3161667..1389fce 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -60,7 +60,9 @@ include(cmake/Flags.cmake) - - # Create library target - add_library(${TARGET_NAME} ${XLINK_SOURCES}) --add_flag_source(src/shared/XLinkDevice.c "-Werror=switch-enum") -+if ("${CMAKE_C_COMPILER_ID}" MATCHES "^(AppleClang|Clang|GNU)$") -+ add_flag_source(src/shared/XLinkDevice.c "-Werror=switch-enum") -+endif() - get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG) - if(is_multi_config) - set_target_properties(${TARGET_NAME} PROPERTIES DEBUG_POSTFIX "d") - From ba181c951b2a461eadd61634e1b6f86f8807dcc8 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 11 Nov 2024 16:12:43 +0100 Subject: [PATCH 049/131] try config fixup --- cmake/ports/libarchive-luxonis/portfile.cmake | 2 ++ cmake/ports/xlink/portfile.cmake | 1 + 2 files changed, 3 insertions(+) diff --git a/cmake/ports/libarchive-luxonis/portfile.cmake b/cmake/ports/libarchive-luxonis/portfile.cmake index 20d788c329..a550348cf2 100644 --- a/cmake/ports/libarchive-luxonis/portfile.cmake +++ b/cmake/ports/libarchive-luxonis/portfile.cmake @@ -41,3 +41,5 @@ vcpkg_cmake_configure( vcpkg_cmake_install() +vcpkg_fixup_pkgconfig() + diff --git a/cmake/ports/xlink/portfile.cmake b/cmake/ports/xlink/portfile.cmake index 9dad1f317f..e01d5b1b46 100644 --- a/cmake/ports/xlink/portfile.cmake +++ b/cmake/ports/xlink/portfile.cmake @@ -20,3 +20,4 @@ vcpkg_cmake_configure( vcpkg_cmake_install() +vcpkg_fixup_pkgconfig() From 0ffa613a9e3536d9913cc0f98297dad875f61777 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 12 Nov 2024 11:58:29 +0100 Subject: [PATCH 050/131] libarchive port, lz4 from vcpkg --- CMakeLists.txt | 4 +- cmake/depthaiDependencies.cmake | 2 +- cmake/ports/libarchive-luxonis/portfile.cmake | 45 - cmake/ports/libarchive-luxonis/vcpkg.json | 16 - cmake/ports/libarchive/disable-warnings.patch | 14 + cmake/ports/libarchive/fix-buildsystem.patch | 110 + cmake/ports/libarchive/fix-cpu-set.patch | 15 + cmake/ports/libarchive/fix-deps.patch | 252 ++ cmake/ports/libarchive/portfile.cmake | 95 + cmake/ports/libarchive/usage | 9 + .../libarchive/vcpkg-cmake-wrapper.cmake.in | 70 + cmake/ports/libarchive/vcpkg.json | 67 + cmake/ports/rtabmap/lz4.patch | 2871 +++++++++++++++++ cmake/ports/rtabmap/portfile.cmake | 1 + cmake/ports/xlink/portfile.cmake | 6 +- vcpkg-configuration.json | 2 +- vcpkg.json | 2 +- 17 files changed, 3512 insertions(+), 69 deletions(-) delete mode 100644 cmake/ports/libarchive-luxonis/portfile.cmake delete mode 100644 cmake/ports/libarchive-luxonis/vcpkg.json create mode 100644 cmake/ports/libarchive/disable-warnings.patch create mode 100644 cmake/ports/libarchive/fix-buildsystem.patch create mode 100644 cmake/ports/libarchive/fix-cpu-set.patch create mode 100644 cmake/ports/libarchive/fix-deps.patch create mode 100644 cmake/ports/libarchive/portfile.cmake create mode 100644 cmake/ports/libarchive/usage create mode 100644 cmake/ports/libarchive/vcpkg-cmake-wrapper.cmake.in create mode 100644 cmake/ports/libarchive/vcpkg.json create mode 100644 cmake/ports/rtabmap/lz4.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index 32ec8578f6..2bf687baa5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -745,9 +745,9 @@ target_link_libraries(${TARGET_CORE_NAME} Threads::Threads BZip2::BZip2 FP16::fp16 - archive_static + LibArchive::LibArchive ZLIB::ZLIB - LZ4::lz4 + lz4::lz4 httplib::httplib mp4v2::mp4v2 semver::semver diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake index d356a8f5f7..ac8134b33a 100644 --- a/cmake/depthaiDependencies.cmake +++ b/cmake/depthaiDependencies.cmake @@ -22,7 +22,7 @@ if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS)) find_package(PNG REQUIRED) # libarchive for firmware packages - find_package(archive_static ${_QUIET} CONFIG REQUIRED) + find_package(LibArchive ${_QUIET} REQUIRED) find_package(liblzma ${_QUIET} CONFIG REQUIRED) # httplib for Gate communication find_package(httplib ${_QUIET} CONFIG REQUIRED) diff --git a/cmake/ports/libarchive-luxonis/portfile.cmake b/cmake/ports/libarchive-luxonis/portfile.cmake deleted file mode 100644 index a550348cf2..0000000000 --- a/cmake/ports/libarchive-luxonis/portfile.cmake +++ /dev/null @@ -1,45 +0,0 @@ -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO luxonis/libarchive - REF 45baa3a3e57104519e1165bcd5ac29c3bd8c9f3a - SHA512 8963cd567f471907cce941d5e6af7808b71cd289799b690fca84e7d7bb37d63816df387f5f4086fe47c33c80379b23cf3efcc455181214383ba7633202c5e783 - HEAD_REF hunter-3.5.2 -) -vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -DENABLE_ACL=OFF - -DENABLE_BZip2=OFF - -DENABLE_CAT=OFF - -DENABLE_CAT_SHARED=OFF - -DENABLE_CNG=OFF - -DENABLE_COVERAGE=OFF - -DENABLE_CPIO=OFF - -DENABLE_CPIO_SHARED=OFF - -DENABLE_EXPAT=OFF - -DENABLE_ICONV=OFF - -DENABLE_INSTALL=ON - -DENABLE_LIBB2=OFF - -DENABLE_LIBXML2=OFF - -DENABLE_LZ4=OFF - -DENABLE_LZMA=OFF - -DENABLE_LZO=OFF - -DENABLE_LibGCC=OFF - -DENABLE_MBEDTLS=OFF - -DENABLE_NETTLE=OFF - -DENABLE_OPENSSL=OFF - -DENABLE_PCREPOSIX=OFF - -DENABLE_SAFESEH=AUTO - -DENABLE_TAR=OFF - -DENABLE_TAR_SHARED=OFF - -DENABLE_TEST=OFF - -DENABLE_WERROR=OFF - -DENABLE_XATTR=OFF - -DENABLE_ZLIB=OFF - -DENABLE_ZSTD=OFF -) - -vcpkg_cmake_install() - -vcpkg_fixup_pkgconfig() - diff --git a/cmake/ports/libarchive-luxonis/vcpkg.json b/cmake/ports/libarchive-luxonis/vcpkg.json deleted file mode 100644 index 4068e3ce19..0000000000 --- a/cmake/ports/libarchive-luxonis/vcpkg.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "libarchive-luxonis", - "version-string": "hunter-3.5.2", - "description": "Multi-format archive and compression library", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - }, - "lz4" - ] -} diff --git a/cmake/ports/libarchive/disable-warnings.patch b/cmake/ports/libarchive/disable-warnings.patch new file mode 100644 index 0000000000..38af15b60b --- /dev/null +++ b/cmake/ports/libarchive/disable-warnings.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b2634da..d037071 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -155,9 +155,6 @@ IF (MSVC) + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" +- # Enable level 4 C4062: The enumerate has no associated handler in a switch +- # statement and there is no default that can catch it. +- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /w14062") + # Enable level 4 C4254: A larger bit field was assigned to a smaller bit + # field. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /w14254") diff --git a/cmake/ports/libarchive/fix-buildsystem.patch b/cmake/ports/libarchive/fix-buildsystem.patch new file mode 100644 index 0000000000..75f8905aa5 --- /dev/null +++ b/cmake/ports/libarchive/fix-buildsystem.patch @@ -0,0 +1,110 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b2634da6..0d846877 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -148,10 +148,6 @@ IF (CMAKE_C_COMPILER_ID MATCHES "^XL$") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qinfo=pro:use") + ENDIF(CMAKE_C_COMPILER_ID MATCHES "^XL$") + IF (MSVC) +- if (ENABLE_WERROR) +- # /WX option is the same as gcc's -Werror option. +- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") +- endif () + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" +@@ -382,8 +378,6 @@ IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") + # Maybe DLL path is "C:/Program Files/GnuWin32/bin". + # The zlib and the bzip2 Setup program have installed programs and DLLs into + # "C:/Program Files/GnuWin32" by default. +- # This is convenience setting for Windows. +- SET(CMAKE_PREFIX_PATH ${__GNUWIN32PATH} $(CMAKE_PREFIX_PATH)) + # + # If you didn't use Setup program or installed into nonstandard path, + # cmake cannot find out your zlib or bzip2 libraries and include files, +@@ -420,14 +414,7 @@ IF(ZLIB_FOUND) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) + IF(WIN32 AND NOT CYGWIN) +- # +- # Test if ZLIB_WINAPI macro is needed to use. +- # +- TRY_MACRO_FOR_LIBRARY( +- "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" +- RUNS +- "#include \nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" +- ZLIB_WINAPI) ++ SET(ZLIB_WINAPI OFF) # skip following test, it crashes with weird message box + IF(ZLIB_WINAPI) + ADD_DEFINITIONS(-DZLIB_WINAPI) + ELSE(ZLIB_WINAPI) +@@ -1356,7 +1341,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(localtime_r HAVE_LOCALTIME_R) + CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT) + CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES) + CHECK_FUNCTION_EXISTS_GLIBC(mbrtowc HAVE_MBRTOWC) +-CHECK_FUNCTION_EXISTS_GLIBC(memmove HAVE_MEMMOVE) ++set(HAVE_MEMMOVE 1) + CHECK_FUNCTION_EXISTS_GLIBC(mkdir HAVE_MKDIR) + CHECK_FUNCTION_EXISTS_GLIBC(mkfifo HAVE_MKFIFO) + CHECK_FUNCTION_EXISTS_GLIBC(mknod HAVE_MKNOD) +@@ -1388,10 +1373,10 @@ CHECK_FUNCTION_EXISTS_GLIBC(utime HAVE_UTIME) + CHECK_FUNCTION_EXISTS_GLIBC(utimes HAVE_UTIMES) + CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT) + CHECK_FUNCTION_EXISTS_GLIBC(vfork HAVE_VFORK) +-CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB) +-CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP) +-CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY) +-CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN) +-CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB) ++set(HAVE_WCRTOMB 1) ++set(HAVE_WCSCMP 1) ++set(HAVE_WCSCPY 1) ++set(HAVE_WCSLEN 1) ++set(HAVE_WCTOMB 1) + CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64) + CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE) +@@ -1405,10 +1390,10 @@ CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH) + CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO) + CHECK_FUNCTION_EXISTS(strerror_r HAVE_STRERROR_R) + CHECK_FUNCTION_EXISTS(strftime HAVE_STRFTIME) +-CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF) +-CHECK_FUNCTION_EXISTS(wmemcmp HAVE_WMEMCMP) +-CHECK_FUNCTION_EXISTS(wmemcpy HAVE_WMEMCPY) +-CHECK_FUNCTION_EXISTS(wmemmove HAVE_WMEMMOVE) ++set(HAVE_VPRINTF 1) ++set(HAVE_WMEMCMP 1) ++set(HAVE_WMEMCPY 1) ++set(HAVE_WMEMMOVE 1) + + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + +@@ -2018,7 +2007,7 @@ INCLUDE(CreatePkgConfigFile) + # + # Register installation of PDF documents. + # +-IF(WIN32 AND NOT CYGWIN) ++IF(0) + # + # On Windows platform, It's better that we install PDF documents + # on one's computer. +diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt +index f7fdfb68a..98d287e8c 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -267,11 +267,12 @@ IF(ENABLE_INSTALL) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) ++ ELSE() ++ INSTALL(TARGETS archive_static ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) + ENDIF(BUILD_SHARED_LIBS) +- INSTALL(TARGETS archive_static +- RUNTIME DESTINATION bin +- LIBRARY DESTINATION lib +- ARCHIVE DESTINATION lib) + INSTALL_MAN(${libarchive_MANS}) + INSTALL(FILES ${include_HEADERS} DESTINATION include) + ENDIF() diff --git a/cmake/ports/libarchive/fix-cpu-set.patch b/cmake/ports/libarchive/fix-cpu-set.patch new file mode 100644 index 0000000000..3a957e4cc8 --- /dev/null +++ b/cmake/ports/libarchive/fix-cpu-set.patch @@ -0,0 +1,15 @@ +diff --git a/libarchive/archive_random.c b/libarchive/archive_random.c +index 65ea691..63217ec 100644 +--- a/libarchive/archive_random.c ++++ b/libarchive/archive_random.c +@@ -48,6 +48,10 @@ __FBSDID("$FreeBSD$"); + #include + #endif + #ifdef HAVE_PTHREAD_H ++#ifdef __GNUC__ ++#define _GNU_SOURCE ++#include ++#endif + #include + #endif + diff --git a/cmake/ports/libarchive/fix-deps.patch b/cmake/ports/libarchive/fix-deps.patch new file mode 100644 index 0000000000..bc148475fa --- /dev/null +++ b/cmake/ports/libarchive/fix-deps.patch @@ -0,0 +1,252 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index dc61b28..7dcdefd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -446,6 +446,8 @@ IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") + ENDIF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") + + SET(ADDITIONAL_LIBS "") ++SET(LIBARCHIVE_LIBS_PRIVATE "") # additional libs for which the pc module is unknown ++SET(LIBSREQUIRED "") # pc modules for additonal libs + # + # Find ZLIB + # +@@ -462,6 +464,7 @@ IF(ZLIB_FOUND) + SET(HAVE_ZLIB_H 1) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) ++ STRING(APPEND LIBSREQUIRED " zlib") + IF(WIN32 AND NOT CYGWIN) + SET(ZLIB_WINAPI OFF) # skip following test, it crashes with weird message box + IF(ZLIB_WINAPI) +@@ -494,6 +497,7 @@ IF(BZIP2_FOUND) + SET(HAVE_BZLIB_H 1) + INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${BZIP2_LIBRARIES}) ++ STRING(APPEND LIBSREQUIRED " bzip2") + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${BZIP2_INCLUDE_DIR}" "${BZIP2_LIBRARIES}" +@@ -522,6 +526,8 @@ ENDIF() + IF(LIBLZMA_FOUND) + SET(HAVE_LIBLZMA 1) + SET(HAVE_LZMA_H 1) ++ LIST(APPEND ADDITIONAL_LIBS LibLZMA::LibLZMA) ++ STRING(APPEND LIBSREQUIRED " liblzma") + CMAKE_PUSH_CHECK_STATE() + SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIR}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBLZMA_LIBRARIES}) +@@ -569,6 +575,7 @@ IF(LZO2_FOUND) + SET(HAVE_LZO_LZO1X_H 1) + INCLUDE_DIRECTORIES(${LZO2_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${LZO2_LIBRARY}) ++ STRING(APPEND LIBSREQUIRED " lzo2") + # + # TODO: test for static library. + # +@@ -597,6 +604,7 @@ IF(LIBB2_FOUND) + SET(ARCHIVE_BLAKE2 FALSE) + LIST(APPEND ADDITIONAL_LIBS ${LIBB2_LIBRARY}) + INCLUDE_DIRECTORIES(${LIBB2_INCLUDE_DIR}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBB2_LIBRARY}) + CMAKE_PUSH_CHECK_STATE() + SET(CMAKE_REQUIRED_LIBRARIES ${LIBB2_LIBRARY}) + SET(CMAKE_REQUIRED_INCLUDES ${LIBB2_INCLUDE_DIR}) +@@ -609,6 +617,8 @@ ENDIF(LIBB2_FOUND) + # Find LZ4 + # + IF(ENABLE_LZ4) ++ FIND_PACKAGE(LZ4 NAMES lz4 CONFIG REQUIRED) ++elseif(0) + IF (LZ4_INCLUDE_DIR) + # Already in cache, be silent + SET(LZ4_FIND_QUIETLY TRUE) +@@ -624,6 +634,10 @@ ENDIF(ENABLE_LZ4) + IF(LZ4_FOUND) + SET(HAVE_LIBLZ4 1) + SET(HAVE_LZ4_H 1) ++ SET(HAVE_LZ4HC_H 1) ++ LIST(APPEND ADDITIONAL_LIBS lz4::lz4) ++ STRING(APPEND LIBSREQUIRED " liblz4") ++elseif(0) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + SET(CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIR}) + CHECK_INCLUDE_FILES("lz4hc.h" HAVE_LZ4HC_H) +@@ -640,6 +654,8 @@ MARK_AS_ADVANCED(CLEAR LZ4_LIBRARY) + # Find Zstd + # + IF(ENABLE_ZSTD) ++ FIND_PACKAGE(ZSTD NAMES zstd CONFIG REQUIRED) ++elseif(0) + IF (ZSTD_INCLUDE_DIR) + # Already in cache, be silent + SET(ZSTD_FIND_QUIETLY TRUE) +@@ -659,6 +675,11 @@ ELSE(ENABLE_ZSTD) + ENDIF(ENABLE_ZSTD) + IF(ZSTD_FOUND) + SET(HAVE_ZSTD_H 1) ++ SET(HAVE_LIBZSTD 1) ++ SET(HAVE_ZSTD_compressStream 1) ++ LIST(APPEND ADDITIONAL_LIBS zstd::libzstd) ++ STRING(APPEND LIBSREQUIRED " libzstd") ++elseif(0) + INCLUDE_DIRECTORIES(${ZSTD_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZSTD_LIBRARY}) + CMAKE_PUSH_CHECK_STATE() +@@ -768,6 +789,7 @@ IF(ENABLE_CNG) + LA_CHECK_INCLUDE_FILE("bcrypt.h" HAVE_BCRYPT_H) + IF(HAVE_BCRYPT_H) + LIST(APPEND ADDITIONAL_LIBS "bcrypt") ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE "bcrypt") + ENDIF(HAVE_BCRYPT_H) + ELSE(ENABLE_CNG) + UNSET(HAVE_BCRYPT_H CACHE) +@@ -799,6 +821,7 @@ IF(ENABLE_MBEDTLS) + IF(MBEDTLS_FOUND) + SET(HAVE_LIBMBEDCRYPTO 1) + LIST(APPEND ADDITIONAL_LIBS ${MBEDCRYPTO_LIBRARY}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${MBEDCRYPTO_LIBRARY}) + INCLUDE_DIRECTORIES(${MBEDTLS_INCLUDE_DIRS}) + + LIST(APPEND CMAKE_REQUIRED_INCLUDES ${MBEDTLS_INCLUDE_DIRS}) +@@ -819,6 +842,7 @@ IF(ENABLE_NETTLE) + IF(NETTLE_FOUND) + SET(HAVE_LIBNETTLE 1) + LIST(APPEND ADDITIONAL_LIBS ${NETTLE_LIBRARIES}) ++ STRING(APPEND LIBSREQUIRED " nettle") + INCLUDE_DIRECTORIES(${NETTLE_INCLUDE_DIR}) + + LIST(APPEND CMAKE_REQUIRED_INCLUDES ${NETTLE_INCLUDE_DIR}) +@@ -842,8 +866,8 @@ IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_FOUND) + SET(HAVE_LIBCRYPTO 1) +- INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) +- LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_CRYPTO_LIBRARY}) ++ LIST(APPEND ADDITIONAL_LIBS OpenSSL::Crypto) ++ STRING(APPEND LIBSREQUIRED " libcrypto") + SET(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) + SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) + LA_CHECK_INCLUDE_FILE("openssl/evp.h" HAVE_OPENSSL_EVP_H) +@@ -861,6 +885,7 @@ IF(NOT OPENSSL_FOUND) + SET(CMAKE_REQUIRED_LIBRARIES "md") + FIND_LIBRARY(LIBMD_LIBRARY NAMES md) + LIST(APPEND ADDITIONAL_LIBS ${LIBMD_LIBRARY}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBMD_LIBRARY}) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + ENDIF(LIBMD_FOUND) + ENDIF(NOT OPENSSL_FOUND) +@@ -974,7 +999,8 @@ main(int argc, char **argv) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_LIBRARIES}) +- LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS) ++ #LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS) ++ STRING(APPEND LIBSREQUIRED " libssl") + ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + ENDIF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) +@@ -1148,6 +1174,7 @@ IF(ENABLE_ICONV) + CHECK_ICONV("libiconv" "") + IF (HAVE_ICONV) + LIST(APPEND ADDITIONAL_LIBS ${LIBICONV_PATH}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBICONV_PATH}) + ENDIF(HAVE_ICONV) + ENDIF(NOT HAVE_ICONV AND LIBICONV_PATH) + ENDIF(ICONV_INCLUDE_DIR) +@@ -1181,6 +1208,7 @@ IF(ENABLE_ICONV) + ENDIF(WIN32 AND NOT CYGWIN) + IF(HAVE_LOCALE_CHARSET) + LIST(APPEND ADDITIONAL_LIBS ${LIBCHARSET_PATH}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBCHARSET_PATH}) + ENDIF(HAVE_LOCALE_CHARSET) + ENDIF(LIBCHARSET_PATH) + ENDIF(LIBICONV_PATH) +@@ -1214,6 +1242,7 @@ IF(LIBXML2_FOUND) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${LIBXML2_LIBRARIES}) ++ STRING(APPEND LIBSREQUIRED " libxml-2.0") + SET(HAVE_LIBXML2 1) + # libxml2's include files use iconv.h + SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR}) +@@ -1243,6 +1272,7 @@ ELSE(LIBXML2_FOUND) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${EXPAT_LIBRARIES}) ++ STRING(APPEND LIBSREQUIRED " expat") + SET(HAVE_LIBEXPAT 1) + LA_CHECK_INCLUDE_FILE("expat.h" HAVE_EXPAT_H) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables +@@ -1273,6 +1303,7 @@ IF(POSIX_REGEX_LIB MATCHES "^(AUTO|LIBC|LIBREGEX)$") + CHECK_FUNCTION_EXISTS_GLIBC(regcomp HAVE_REGCOMP_LIBREGEX) + IF(HAVE_REGCOMP_LIBREGEX) + LIST(APPEND ADDITIONAL_LIBS ${REGEX_LIBRARY}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${REGEX_LIBRARY}) + # + # If regex.h is not found, retry looking for regex.h at + # REGEX_INCLUDE_DIR +@@ -1322,6 +1353,7 @@ IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$" + IF(PCREPOSIX_FOUND) + INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${PCREPOSIX_LIBRARIES}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${PCREPOSIX_LIBRARIES}) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${PCRE_INCLUDE_DIR}" "${PCREPOSIX_LIBRARIES}" +@@ -1333,6 +1365,7 @@ IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$" + ELSEIF(NOT WITHOUT_PCRE_STATIC AND NOT PCRE_STATIC AND PCRE_FOUND) + # Determine if pcre static libraries are to be used. + LIST(APPEND ADDITIONAL_LIBS ${PCRE_LIBRARIES}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${PCRE_LIBRARIES}) + SET(TMP_LIBRARIES ${PCREPOSIX_LIBRARIES} ${PCRE_LIBRARIES}) + MESSAGE(STATUS "trying again with -lpcre included") + TRY_MACRO_FOR_LIBRARY( +@@ -1348,6 +1381,7 @@ IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$" + # ___chkstk_ms. + MESSAGE(STATUS "Visual Studio build detected, trying again with -lgcc included") + LIST(APPEND ADDITIONAL_LIBS ${LIBGCC_LIBRARIES}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBGCC_LIBRARIES}) + SET(TMP_LIBRARIES ${PCREPOSIX_LIBRARIES} ${PCRE_LIBRARIES} ${LIBGCC_LIBRARIES}) + TRY_MACRO_FOR_LIBRARY( + "${PCRE_INCLUDE_DIR}" "${TMP_LIBRARIES}" +@@ -1919,6 +1953,7 @@ IF(ENABLE_ACL) + SET(CMAKE_REQUIRED_LIBRARIES "acl") + FIND_LIBRARY(ACL_LIBRARY NAMES acl) + LIST(APPEND ADDITIONAL_LIBS ${ACL_LIBRARY}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${ACL_LIBRARY}) + ENDIF(HAVE_LIBACL) + + CHECK_TYPE_EXISTS(acl_t "sys/types.h;sys/acl.h" HAVE_ACL_T) +@@ -2058,6 +2093,7 @@ int main(void) { return ACL_SYNCHRONIZE; }" HAVE_DECL_ACL_SYNCHRONIZE) + SET(CMAKE_REQUIRED_LIBRARIES "richacl") + FIND_LIBRARY(RICHACL_LIBRARY NAMES richacl) + LIST(APPEND ADDITIONAL_LIBS ${RICHACL_LIBRARY}) ++ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${RICHACL_LIBRARY}) + ENDIF(HAVE_LIBRICHACL) + + CHECK_STRUCT_HAS_MEMBER("struct richace" e_type "sys/richacl.h" +diff --git a/build/cmake/CreatePkgConfigFile.cmake b/build/cmake/CreatePkgConfigFile.cmake +index bc5a43f..422b83b 100644 +--- a/build/cmake/CreatePkgConfigFile.cmake ++++ b/build/cmake/CreatePkgConfigFile.cmake +@@ -8,7 +8,7 @@ SET(libdir \${exec_prefix}/lib) + SET(includedir \${prefix}/include) + # Now, this is not particularly pretty, nor is it terribly accurate... + # Loop over all our additional libs +-FOREACH(mylib ${ADDITIONAL_LIBS}) ++FOREACH(mylib ${LIBARCHIVE_LIBS_PRIVATE}) + # Extract the filename from the absolute path + GET_FILENAME_COMPONENT(mylib_name ${mylib} NAME_WE) + # Strip the lib prefix +@@ -16,10 +16,6 @@ FOREACH(mylib ${ADDITIONAL_LIBS}) + # Append it to our LIBS string + SET(LIBS "${LIBS} -l${mylib_name}") + ENDFOREACH() +-# libxml2 is easier, since it's already using pkg-config +-FOREACH(mylib ${PC_LIBXML_STATIC_LDFLAGS}) +- SET(LIBS "${LIBS} ${mylib}") +-ENDFOREACH() + # FIXME: The order of the libraries doesn't take dependencies into account, + # thus there's a good chance it'll make some binutils versions unhappy... + # This only affects Libs.private (looked up for static builds) though. diff --git a/cmake/ports/libarchive/portfile.cmake b/cmake/ports/libarchive/portfile.cmake new file mode 100644 index 0000000000..e209f01928 --- /dev/null +++ b/cmake/ports/libarchive/portfile.cmake @@ -0,0 +1,95 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO libarchive/libarchive + REF "v${VERSION}" + SHA512 95c6232d178b26daa0eeba43d64ea4235aa96fa279c85fff715ac5e6cc73b2e65f276770f91c3538cb8ca989380555169497628d73e120bfa52e12f657049ff0 + HEAD_REF master + PATCHES + disable-warnings.patch + fix-buildsystem.patch + fix-cpu-set.patch + fix-deps.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + bzip2 ENABLE_BZip2 + bzip2 CMAKE_REQUIRE_FIND_PACKAGE_BZip2 + libxml2 ENABLE_LIBXML2 + libxml2 CMAKE_REQUIRE_FIND_PACKAGE_LibXml2 + lz4 ENABLE_LZ4 + lz4 CMAKE_REQUIRE_FIND_PACKAGE_lz4 + lzma ENABLE_LZMA + lzma CMAKE_REQUIRE_FIND_PACKAGE_LibLZMA + lzo ENABLE_LZO + zstd ENABLE_ZSTD +) +# Default crypto backend is OpenSSL, but it is ignored for DARWIN +set(WRAPPER_ENABLE_OPENSSL OFF) +if(NOT "crypto" IN_LIST FEATURES) + list(APPEND FEATURE_OPTIONS + -DLIBMD_FOUND=FALSE + -DENABLE_OPENSSL=OFF + ) +elseif(VCPKG_TARGET_IS_OSX) + list(APPEND FEATURE_OPTIONS + -DENABLE_MBEDTLS=ON + -DENABLE_OPENSSL=OFF + -DCMAKE_REQUIRE_FIND_PACKAGE_MbedTLS=ON + ) +else() + set(WRAPPER_ENABLE_OPENSSL ON) + list(APPEND FEATURE_OPTIONS + -DCMAKE_REQUIRE_FIND_PACKAGE_OpenSSL=ON + ) +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + -DENABLE_ZLIB=ON + -DENABLE_PCREPOSIX=OFF + -DPOSIX_REGEX_LIB=NONE + -DENABLE_MBEDTLS=OFF + -DENABLE_NETTLE=OFF + -DENABLE_EXPAT=OFF + -DENABLE_LibGCC=OFF + -DENABLE_CNG=OFF + -DENABLE_TAR=OFF + -DENABLE_CPIO=OFF + -DENABLE_CAT=OFF + -DENABLE_XATTR=OFF + -DENABLE_ACL=OFF + -DENABLE_ICONV=OFF + -DENABLE_LIBB2=OFF + -DENABLE_TEST=OFF + -DENABLE_WERROR=OFF + MAYBE_UNUSED_VARIABLES + CMAKE_REQUIRE_FIND_PACKAGE_BZip2 + CMAKE_REQUIRE_FIND_PACKAGE_LibLZMA + CMAKE_REQUIRE_FIND_PACKAGE_LibXml2 + CMAKE_REQUIRE_FIND_PACKAGE_lz4 + ENABLE_LibGCC +) + +vcpkg_cmake_install() + +vcpkg_fixup_pkgconfig() + +vcpkg_copy_pdbs() + +configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" + "${CURRENT_PACKAGES_DIR}/share/man" +) + +foreach(header "include/archive.h" "include/archive_entry.h") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/${header}" "(!defined LIBARCHIVE_STATIC)" "0") +endforeach() + +file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/cmake/ports/libarchive/usage b/cmake/ports/libarchive/usage new file mode 100644 index 0000000000..213f642d2d --- /dev/null +++ b/cmake/ports/libarchive/usage @@ -0,0 +1,9 @@ +libarchive is compatible with the CMake Find Module: + + find_package(LibArchive REQUIRED) + target_link_libraries(main PRIVATE LibArchive::LibArchive) # since CMake 3.17 + +libarchive provides pkg-config modules: + + # library that can create and read several streaming archive formats + libarchive diff --git a/cmake/ports/libarchive/vcpkg-cmake-wrapper.cmake.in b/cmake/ports/libarchive/vcpkg-cmake-wrapper.cmake.in new file mode 100644 index 0000000000..3eb90e1bc2 --- /dev/null +++ b/cmake/ports/libarchive/vcpkg-cmake-wrapper.cmake.in @@ -0,0 +1,70 @@ +cmake_policy(PUSH) +cmake_policy(SET CMP0012 NEW) +cmake_policy(SET CMP0057 NEW) +set(z_vcpkg_libarchive_args "") +if("REQUIRED" IN_LIST ARGS) + list(APPEND z_vcpkg_libarchive_args "REQUIRED") +endif() +if("QUIET" IN_LIST ARGS) + list(APPEND z_vcpkg_libarchive_args "QUIET") +endif() + +_find_package(${ARGS}) + +if(LibArchive_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static") + set(z_vcpkg_libarchive_libs "") + find_package(ZLIB ${z_vcpkg_libarchive_args}) + list(APPEND z_vcpkg_libarchive_libs ZLIB::ZLIB) + if("@ENABLE_BZip2@") + find_package(BZip2 ${z_vcpkg_libarchive_args}) + list(APPEND z_vcpkg_libarchive_libs BZip2::BZip2) + endif() + if("@ENABLE_LIBXML2@") + find_package(LibXml2 ${z_vcpkg_libarchive_args}) + list(APPEND z_vcpkg_libarchive_libs LibXml2::LibXml2) + endif() + if("@ENABLE_LZ4@") + find_package(lz4 CONFIG ${z_vcpkg_libarchive_args}) + list(APPEND z_vcpkg_libarchive_libs lz4::lz4) + endif() + if("@ENABLE_LZMA@") + find_package(LibLZMA ${z_vcpkg_libarchive_args}) + list(APPEND z_vcpkg_libarchive_libs LibLZMA::LibLZMA) + endif() + if("@ENABLE_LZO@") + include(SelectLibraryConfigurations) + find_library(Z_VCPKG_LZO_LIBRARY_DEBUG NAMES lzo2d lzo2 NAMES_PER_DIR PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH) + find_library(Z_VCPKG_LZO_LIBRARY_RELEASE NAMES lzo2 NAMES_PER_DIR PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH) + select_library_configurations(Z_VCPKG_LZO) + if(Z_VCPKG_LZO_LIBRARY) + list(APPEND z_vcpkg_libarchive_libs ${Z_VCPKG_LZO_LIBRARY}) + else() + set(LibArchive_FOUND FALSE) + endif() + endif() + if("@ENABLE_ZSTD@") + find_package(zstd ${z_vcpkg_libarchive_args}) + list(APPEND z_vcpkg_libarchive_libs zstd::libzstd) + endif() + if("@WRAPPER_ENABLE_OPENSSL@") + find_package(OpenSSL ${z_vcpkg_libarchive_args}) + list(APPEND z_vcpkg_libarchive_libs OpenSSL::Crypto) + endif() + + if(TARGET LibArchive::LibArchive) + set(LibArchive_LIBRARIES LibArchive::LibArchive) + if(Z_VCPKG_LZO_LIBRARY AND Z_VCPKG_LZO_LIBRARY_DEBUG) + list(REMOVE_ITEM z_vcpkg_libarchive_libs ${Z_VCPKG_LZO_LIBRARY}) + list(APPEND z_vcpkg_libarchive_libs + "\$<\$>:${Z_VCPKG_LZO_LIBRARY_RELEASE}>" + "\$<\$:${Z_VCPKG_LZO_LIBRARY_DEBUG}>" + ) + endif() + set_property(TARGET LibArchive::LibArchive APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${z_vcpkg_libarchive_libs}) + else() + list(APPEND LibArchive_LIBRARIES ${z_vcpkg_libarchive_libs}) + endif() + unset(z_vcpkg_libarchive_libs) +endif() +unset(z_vcpkg_libarchive_args) +cmake_policy(POP) diff --git a/cmake/ports/libarchive/vcpkg.json b/cmake/ports/libarchive/vcpkg.json new file mode 100644 index 0000000000..4fbe1ed393 --- /dev/null +++ b/cmake/ports/libarchive/vcpkg.json @@ -0,0 +1,67 @@ +{ + "name": "libarchive", + "version": "3.7.7", + "port-version": 1, + "description": "Library for reading and writing streaming archives", + "homepage": "https://www.libarchive.org", + "license": null, + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + "zlib" + ], + "features": { + "bzip2": { + "description": "BZip2 support", + "dependencies": [ + "bzip2" + ] + }, + "crypto": { + "description": "Support for cryptographic features", + "dependencies": [ + { + "name": "mbedtls", + "platform": "osx" + }, + { + "name": "openssl", + "platform": "!osx" + } + ] + }, + "libxml2": { + "description": "Libxml2 support", + "dependencies": [ + "libxml2" + ] + }, + "lz4": { + "description": "Lz4 support", + "dependencies": [ + "lz4" + ] + }, + "lzma": { + "description": "Lzma support", + "dependencies": [ + "liblzma" + ] + }, + "lzo": { + "description": "Lzo support", + "dependencies": [ + "lzo" + ] + }, + "zstd": { + "description": "Zstd support", + "dependencies": [ + "zstd" + ] + } + } +} diff --git a/cmake/ports/rtabmap/lz4.patch b/cmake/ports/rtabmap/lz4.patch new file mode 100644 index 0000000000..346a394ad5 --- /dev/null +++ b/cmake/ports/rtabmap/lz4.patch @@ -0,0 +1,2871 @@ +diff --git a/corelib/src/CMakeLists.txt b/corelib/src/CMakeLists.txt +index b18b3b6..8d5a945 100644 +--- a/corelib/src/CMakeLists.txt ++++ b/corelib/src/CMakeLists.txt +@@ -121,9 +121,6 @@ SET(SRC_FILES + GlobalDescriptorExtractor.cpp + + GainCompensator.cpp +- +- rtflann/ext/lz4.c +- rtflann/ext/lz4hc.c + FlannIndex.cpp + + #clams stuff +@@ -167,11 +164,12 @@ SET(INCLUDE_DIRS + ${ZLIB_INCLUDE_DIRS} + ) + ++find_package(lz4 REQUIRED) + SET(PUBLIC_INCLUDE_DIRS + ${OpenCV_INCLUDE_DIRS} + ${PCL_INCLUDE_DIRS} ++ ${lz4_INCLUDE_DIRS} + ) +- + SET(LIBRARIES + ${ZLIB_LIBRARIES} + ) +@@ -182,6 +180,7 @@ SET(LIBRARIES + SET(PUBLIC_LIBRARIES + ${OpenCV_LIBS} + ${PCL_LIBRARIES} ++ ${lz4_LIBRARIES} + ) + + IF(SQLite3_FOUND) +diff --git a/corelib/src/rtflann/ext/lz4.c b/corelib/src/rtflann/ext/lz4.c +deleted file mode 100644 +index 08cf6b5..0000000 +--- a/corelib/src/rtflann/ext/lz4.c ++++ /dev/null +@@ -1,1516 +0,0 @@ +-/* +- LZ4 - Fast LZ compression algorithm +- Copyright (C) 2011-2015, Yann Collet. +- +- BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) +- +- Redistribution and use in source and binary forms, with or without +- modification, are permitted provided that the following conditions are +- met: +- +- * Redistributions of source code must retain the above copyright +- notice, this list of conditions and the following disclaimer. +- * Redistributions in binary form must reproduce the above +- copyright notice, this list of conditions and the following disclaimer +- in the documentation and/or other materials provided with the +- distribution. +- +- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- +- You can contact the author at : +- - LZ4 source repository : https://github.com/Cyan4973/lz4 +- - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c +-*/ +- +- +-/************************************** +-* Tuning parameters +-**************************************/ +-/* +- * HEAPMODE : +- * Select how default compression functions will allocate memory for their hash table, +- * in memory stack (0:default, fastest), or in memory heap (1:requires malloc()). +- */ +-#define HEAPMODE 0 +- +-/* +- * ACCELERATION_DEFAULT : +- * Select "acceleration" for LZ4_compress_fast() when parameter value <= 0 +- */ +-#define ACCELERATION_DEFAULT 1 +- +- +-/************************************** +-* CPU Feature Detection +-**************************************/ +-/* +- * LZ4_FORCE_SW_BITCOUNT +- * Define this parameter if your target system or compiler does not support hardware bit count +- */ +-#if defined(_MSC_VER) && defined(_WIN32_WCE) /* Visual Studio for Windows CE does not support Hardware bit count */ +-# define LZ4_FORCE_SW_BITCOUNT +-#endif +- +- +-/************************************** +-* Includes +-**************************************/ +-#include "lz4.h" +- +- +-/************************************** +-* Compiler Options +-**************************************/ +-#ifdef _MSC_VER /* Visual Studio */ +-# define FORCE_INLINE static __forceinline +-# include +-# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ +-# pragma warning(disable : 4293) /* disable: C4293: too large shift (32-bits) */ +-#else +-# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */ +-# if defined(__GNUC__) || defined(__clang__) +-# define FORCE_INLINE static inline __attribute__((always_inline)) +-# else +-# define FORCE_INLINE static inline +-# endif +-# else +-# define FORCE_INLINE static +-# endif /* __STDC_VERSION__ */ +-#endif /* _MSC_VER */ +- +-/* LZ4_GCC_VERSION is defined into lz4.h */ +-#if (LZ4_GCC_VERSION >= 302) || (__INTEL_COMPILER >= 800) || defined(__clang__) +-# define expect(expr,value) (__builtin_expect ((expr),(value)) ) +-#else +-# define expect(expr,value) (expr) +-#endif +- +-#define likely(expr) expect((expr) != 0, 1) +-#define unlikely(expr) expect((expr) != 0, 0) +- +- +-/************************************** +-* Memory routines +-**************************************/ +-#include /* malloc, calloc, free */ +-#define ALLOCATOR(n,s) calloc(n,s) +-#define FREEMEM free +-#include /* memset, memcpy */ +-#define MEM_INIT memset +- +- +-/************************************** +-* Basic Types +-**************************************/ +-#if defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */ +-# include +- typedef uint8_t BYTE; +- typedef uint16_t U16; +- typedef uint32_t U32; +- typedef int32_t S32; +- typedef uint64_t U64; +-#else +- typedef unsigned char BYTE; +- typedef unsigned short U16; +- typedef unsigned int U32; +- typedef signed int S32; +- typedef unsigned long long U64; +-#endif +- +- +-/************************************** +-* Reading and writing into memory +-**************************************/ +-#define STEPSIZE sizeof(size_t) +- +-static unsigned LZ4_64bits(void) { return sizeof(void*)==8; } +- +-static unsigned LZ4_isLittleEndian(void) +-{ +- const union { U32 i; BYTE c[4]; } one = { 1 }; /* don't use static : performance detrimental */ +- return one.c[0]; +-} +- +- +-static U16 LZ4_read16(const void* memPtr) +-{ +- U16 val16; +- memcpy(&val16, memPtr, 2); +- return val16; +-} +- +-static U16 LZ4_readLE16(const void* memPtr) +-{ +- if (LZ4_isLittleEndian()) +- { +- return LZ4_read16(memPtr); +- } +- else +- { +- const BYTE* p = (const BYTE*)memPtr; +- return (U16)((U16)p[0] + (p[1]<<8)); +- } +-} +- +-static void LZ4_writeLE16(void* memPtr, U16 value) +-{ +- if (LZ4_isLittleEndian()) +- { +- memcpy(memPtr, &value, 2); +- } +- else +- { +- BYTE* p = (BYTE*)memPtr; +- p[0] = (BYTE) value; +- p[1] = (BYTE)(value>>8); +- } +-} +- +-static U32 LZ4_read32(const void* memPtr) +-{ +- U32 val32; +- memcpy(&val32, memPtr, 4); +- return val32; +-} +- +-static U64 LZ4_read64(const void* memPtr) +-{ +- U64 val64; +- memcpy(&val64, memPtr, 8); +- return val64; +-} +- +-static size_t LZ4_read_ARCH(const void* p) +-{ +- if (LZ4_64bits()) +- return (size_t)LZ4_read64(p); +- else +- return (size_t)LZ4_read32(p); +-} +- +- +-static void LZ4_copy4(void* dstPtr, const void* srcPtr) { memcpy(dstPtr, srcPtr, 4); } +- +-static void LZ4_copy8(void* dstPtr, const void* srcPtr) { memcpy(dstPtr, srcPtr, 8); } +- +-/* customized version of memcpy, which may overwrite up to 7 bytes beyond dstEnd */ +-static void LZ4_wildCopy(void* dstPtr, const void* srcPtr, void* dstEnd) +-{ +- BYTE* d = (BYTE*)dstPtr; +- const BYTE* s = (const BYTE*)srcPtr; +- BYTE* e = (BYTE*)dstEnd; +- do { LZ4_copy8(d,s); d+=8; s+=8; } while (d>3); +-# elif (defined(__clang__) || (LZ4_GCC_VERSION >= 304)) && !defined(LZ4_FORCE_SW_BITCOUNT) +- return (__builtin_ctzll((U64)val) >> 3); +-# else +- static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2, 0, 3, 1, 3, 1, 4, 2, 7, 0, 2, 3, 6, 1, 5, 3, 5, 1, 3, 4, 4, 2, 5, 6, 7, 7, 0, 1, 2, 3, 3, 4, 6, 2, 6, 5, 5, 3, 4, 5, 6, 7, 1, 2, 4, 6, 4, 4, 5, 7, 2, 6, 5, 7, 6, 7, 7 }; +- return DeBruijnBytePos[((U64)((val & -(long long)val) * 0x0218A392CDABBD3FULL)) >> 58]; +-# endif +- } +- else /* 32 bits */ +- { +-# if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) +- unsigned long r; +- _BitScanForward( &r, (U32)val ); +- return (int)(r>>3); +-# elif (defined(__clang__) || (LZ4_GCC_VERSION >= 304)) && !defined(LZ4_FORCE_SW_BITCOUNT) +- return (__builtin_ctz((U32)val) >> 3); +-# else +- static const int DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 1, 3, 2, 0, 1, 3, 3, 1, 2, 2, 2, 2, 0, 3, 1, 2, 0, 1, 0, 1, 1 }; +- return DeBruijnBytePos[((U32)((val & -(S32)val) * 0x077CB531U)) >> 27]; +-# endif +- } +- } +- else /* Big Endian CPU */ +- { +- if (LZ4_64bits()) +- { +-# if defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT) +- unsigned long r = 0; +- _BitScanReverse64( &r, val ); +- return (unsigned)(r>>3); +-# elif (defined(__clang__) || (LZ4_GCC_VERSION >= 304)) && !defined(LZ4_FORCE_SW_BITCOUNT) +- return (__builtin_clzll((U64)val) >> 3); +-# else +- unsigned r; +- if (!(val>>32)) { r=4; } else { r=0; val>>=32; } +- if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; } +- r += (!val); +- return r; +-# endif +- } +- else /* 32 bits */ +- { +-# if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) +- unsigned long r = 0; +- _BitScanReverse( &r, (unsigned long)val ); +- return (unsigned)(r>>3); +-# elif (defined(__clang__) || (LZ4_GCC_VERSION >= 304)) && !defined(LZ4_FORCE_SW_BITCOUNT) +- return (__builtin_clz((U32)val) >> 3); +-# else +- unsigned r; +- if (!(val>>16)) { r=2; val>>=8; } else { r=0; val>>=24; } +- r += (!val); +- return r; +-# endif +- } +- } +-} +- +-static unsigned LZ4_count(const BYTE* pIn, const BYTE* pMatch, const BYTE* pInLimit) +-{ +- const BYTE* const pStart = pIn; +- +- while (likely(pIn compression run slower on incompressible data */ +- +- +-/************************************** +-* Local Structures and types +-**************************************/ +-typedef struct { +- U32 hashTable[HASH_SIZE_U32]; +- U32 currentOffset; +- U32 initCheck; +- const BYTE* dictionary; +- BYTE* bufferStart; /* obsolete, used for slideInputBuffer */ +- U32 dictSize; +-} LZ4_stream_t_internal; +- +-typedef enum { notLimited = 0, limitedOutput = 1 } limitedOutput_directive; +-typedef enum { byPtr, byU32, byU16 } tableType_t; +- +-typedef enum { noDict = 0, withPrefix64k, usingExtDict } dict_directive; +-typedef enum { noDictIssue = 0, dictSmall } dictIssue_directive; +- +-typedef enum { endOnOutputSize = 0, endOnInputSize = 1 } endCondition_directive; +-typedef enum { full = 0, partial = 1 } earlyEnd_directive; +- +- +-/************************************** +-* Local Utils +-**************************************/ +-int LZ4_versionNumber (void) { return LZ4_VERSION_NUMBER; } +-int LZ4_compressBound(int isize) { return LZ4_COMPRESSBOUND(isize); } +-int LZ4_sizeofState() { return LZ4_STREAMSIZE; } +- +- +- +-/******************************** +-* Compression functions +-********************************/ +- +-static U32 LZ4_hashSequence(U32 sequence, tableType_t const tableType) +-{ +- if (tableType == byU16) +- return (((sequence) * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1))); +- else +- return (((sequence) * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG)); +-} +- +-static const U64 prime5bytes = 889523592379ULL; +-static U32 LZ4_hashSequence64(size_t sequence, tableType_t const tableType) +-{ +- const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG; +- const U32 hashMask = (1<> (40 - hashLog)) & hashMask; +-} +- +-static U32 LZ4_hashSequenceT(size_t sequence, tableType_t const tableType) +-{ +- if (LZ4_64bits()) +- return LZ4_hashSequence64(sequence, tableType); +- return LZ4_hashSequence((U32)sequence, tableType); +-} +- +-static U32 LZ4_hashPosition(const void* p, tableType_t tableType) { return LZ4_hashSequenceT(LZ4_read_ARCH(p), tableType); } +- +-static void LZ4_putPositionOnHash(const BYTE* p, U32 h, void* tableBase, tableType_t const tableType, const BYTE* srcBase) +-{ +- switch (tableType) +- { +- case byPtr: { const BYTE** hashTable = (const BYTE**)tableBase; hashTable[h] = p; return; } +- case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = (U32)(p-srcBase); return; } +- case byU16: { U16* hashTable = (U16*) tableBase; hashTable[h] = (U16)(p-srcBase); return; } +- } +-} +- +-static void LZ4_putPosition(const BYTE* p, void* tableBase, tableType_t tableType, const BYTE* srcBase) +-{ +- U32 h = LZ4_hashPosition(p, tableType); +- LZ4_putPositionOnHash(p, h, tableBase, tableType, srcBase); +-} +- +-static const BYTE* LZ4_getPositionOnHash(U32 h, void* tableBase, tableType_t tableType, const BYTE* srcBase) +-{ +- if (tableType == byPtr) { const BYTE** hashTable = (const BYTE**) tableBase; return hashTable[h]; } +- if (tableType == byU32) { U32* hashTable = (U32*) tableBase; return hashTable[h] + srcBase; } +- { U16* hashTable = (U16*) tableBase; return hashTable[h] + srcBase; } /* default, to ensure a return */ +-} +- +-static const BYTE* LZ4_getPosition(const BYTE* p, void* tableBase, tableType_t tableType, const BYTE* srcBase) +-{ +- U32 h = LZ4_hashPosition(p, tableType); +- return LZ4_getPositionOnHash(h, tableBase, tableType, srcBase); +-} +- +-FORCE_INLINE int LZ4_compress_generic( +- void* const ctx, +- const char* const source, +- char* const dest, +- const int inputSize, +- const int maxOutputSize, +- const limitedOutput_directive outputLimited, +- const tableType_t tableType, +- const dict_directive dict, +- const dictIssue_directive dictIssue, +- const U32 acceleration) +-{ +- LZ4_stream_t_internal* const dictPtr = (LZ4_stream_t_internal*)ctx; +- +- const BYTE* ip = (const BYTE*) source; +- const BYTE* base; +- const BYTE* lowLimit; +- const BYTE* const lowRefLimit = ip - dictPtr->dictSize; +- const BYTE* const dictionary = dictPtr->dictionary; +- const BYTE* const dictEnd = dictionary + dictPtr->dictSize; +- const size_t dictDelta = dictEnd - (const BYTE*)source; +- const BYTE* anchor = (const BYTE*) source; +- const BYTE* const iend = ip + inputSize; +- const BYTE* const mflimit = iend - MFLIMIT; +- const BYTE* const matchlimit = iend - LASTLITERALS; +- +- BYTE* op = (BYTE*) dest; +- BYTE* const olimit = op + maxOutputSize; +- +- U32 forwardH; +- size_t refDelta=0; +- +- /* Init conditions */ +- if ((U32)inputSize > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported input size, too large (or negative) */ +- switch(dict) +- { +- case noDict: +- default: +- base = (const BYTE*)source; +- lowLimit = (const BYTE*)source; +- break; +- case withPrefix64k: +- base = (const BYTE*)source - dictPtr->currentOffset; +- lowLimit = (const BYTE*)source - dictPtr->dictSize; +- break; +- case usingExtDict: +- base = (const BYTE*)source - dictPtr->currentOffset; +- lowLimit = (const BYTE*)source; +- break; +- } +- if ((tableType == byU16) && (inputSize>=LZ4_64Klimit)) return 0; /* Size too large (not within 64K limit) */ +- if (inputSize> LZ4_skipTrigger); +- +- if (unlikely(forwardIp > mflimit)) goto _last_literals; +- +- match = LZ4_getPositionOnHash(h, ctx, tableType, base); +- if (dict==usingExtDict) +- { +- if (match<(const BYTE*)source) +- { +- refDelta = dictDelta; +- lowLimit = dictionary; +- } +- else +- { +- refDelta = 0; +- lowLimit = (const BYTE*)source; +- } +- } +- forwardH = LZ4_hashPosition(forwardIp, tableType); +- LZ4_putPositionOnHash(ip, h, ctx, tableType, base); +- +- } while ( ((dictIssue==dictSmall) ? (match < lowRefLimit) : 0) +- || ((tableType==byU16) ? 0 : (match + MAX_DISTANCE < ip)) +- || (LZ4_read32(match+refDelta) != LZ4_read32(ip)) ); +- } +- +- /* Catch up */ +- while ((ip>anchor) && (match+refDelta > lowLimit) && (unlikely(ip[-1]==match[refDelta-1]))) { ip--; match--; } +- +- { +- /* Encode Literal length */ +- unsigned litLength = (unsigned)(ip - anchor); +- token = op++; +- if ((outputLimited) && (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit))) +- return 0; /* Check output limit */ +- if (litLength>=RUN_MASK) +- { +- int len = (int)litLength-RUN_MASK; +- *token=(RUN_MASK<= 255 ; len-=255) *op++ = 255; +- *op++ = (BYTE)len; +- } +- else *token = (BYTE)(litLength< matchlimit) limit = matchlimit; +- matchLength = LZ4_count(ip+MINMATCH, match+MINMATCH, limit); +- ip += MINMATCH + matchLength; +- if (ip==limit) +- { +- unsigned more = LZ4_count(ip, (const BYTE*)source, matchlimit); +- matchLength += more; +- ip += more; +- } +- } +- else +- { +- matchLength = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit); +- ip += MINMATCH + matchLength; +- } +- +- if ((outputLimited) && (unlikely(op + (1 + LASTLITERALS) + (matchLength>>8) > olimit))) +- return 0; /* Check output limit */ +- if (matchLength>=ML_MASK) +- { +- *token += ML_MASK; +- matchLength -= ML_MASK; +- for (; matchLength >= 510 ; matchLength-=510) { *op++ = 255; *op++ = 255; } +- if (matchLength >= 255) { matchLength-=255; *op++ = 255; } +- *op++ = (BYTE)matchLength; +- } +- else *token += (BYTE)(matchLength); +- } +- +- anchor = ip; +- +- /* Test end of chunk */ +- if (ip > mflimit) break; +- +- /* Fill table */ +- LZ4_putPosition(ip-2, ctx, tableType, base); +- +- /* Test next position */ +- match = LZ4_getPosition(ip, ctx, tableType, base); +- if (dict==usingExtDict) +- { +- if (match<(const BYTE*)source) +- { +- refDelta = dictDelta; +- lowLimit = dictionary; +- } +- else +- { +- refDelta = 0; +- lowLimit = (const BYTE*)source; +- } +- } +- LZ4_putPosition(ip, ctx, tableType, base); +- if ( ((dictIssue==dictSmall) ? (match>=lowRefLimit) : 1) +- && (match+MAX_DISTANCE>=ip) +- && (LZ4_read32(match+refDelta)==LZ4_read32(ip)) ) +- { token=op++; *token=0; goto _next_match; } +- +- /* Prepare next loop */ +- forwardH = LZ4_hashPosition(++ip, tableType); +- } +- +-_last_literals: +- /* Encode Last Literals */ +- { +- const size_t lastRun = (size_t)(iend - anchor); +- if ((outputLimited) && ((op - (BYTE*)dest) + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > (U32)maxOutputSize)) +- return 0; /* Check output limit */ +- if (lastRun >= RUN_MASK) +- { +- size_t accumulator = lastRun - RUN_MASK; +- *op++ = RUN_MASK << ML_BITS; +- for(; accumulator >= 255 ; accumulator-=255) *op++ = 255; +- *op++ = (BYTE) accumulator; +- } +- else +- { +- *op++ = (BYTE)(lastRun<= LZ4_compressBound(inputSize)) +- { +- if (inputSize < LZ4_64Klimit) +- return LZ4_compress_generic(state, source, dest, inputSize, 0, notLimited, byU16, noDict, noDictIssue, acceleration); +- else +- return LZ4_compress_generic(state, source, dest, inputSize, 0, notLimited, LZ4_64bits() ? byU32 : byPtr, noDict, noDictIssue, acceleration); +- } +- else +- { +- if (inputSize < LZ4_64Klimit) +- return LZ4_compress_generic(state, source, dest, inputSize, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, acceleration); +- else +- return LZ4_compress_generic(state, source, dest, inputSize, maxOutputSize, limitedOutput, LZ4_64bits() ? byU32 : byPtr, noDict, noDictIssue, acceleration); +- } +-} +- +- +-int LZ4_compress_fast(const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration) +-{ +-#if (HEAPMODE) +- void* ctxPtr = ALLOCATOR(1, sizeof(LZ4_stream_t)); /* malloc-calloc always properly aligned */ +-#else +- LZ4_stream_t ctx; +- void* ctxPtr = &ctx; +-#endif +- +- int result = LZ4_compress_fast_extState(ctxPtr, source, dest, inputSize, maxOutputSize, acceleration); +- +-#if (HEAPMODE) +- FREEMEM(ctxPtr); +-#endif +- return result; +-} +- +- +-int LZ4_compress_default(const char* source, char* dest, int inputSize, int maxOutputSize) +-{ +- return LZ4_compress_fast(source, dest, inputSize, maxOutputSize, 1); +-} +- +- +-/* hidden debug function */ +-/* strangely enough, gcc generates faster code when this function is uncommented, even if unused */ +-int LZ4_compress_fast_force(const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration) +-{ +- LZ4_stream_t ctx; +- +- LZ4_resetStream(&ctx); +- +- if (inputSize < LZ4_64Klimit) +- return LZ4_compress_generic(&ctx, source, dest, inputSize, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, acceleration); +- else +- return LZ4_compress_generic(&ctx, source, dest, inputSize, maxOutputSize, limitedOutput, LZ4_64bits() ? byU32 : byPtr, noDict, noDictIssue, acceleration); +-} +- +- +-/******************************** +-* destSize variant +-********************************/ +- +-static int LZ4_compress_destSize_generic( +- void* const ctx, +- const char* const src, +- char* const dst, +- int* const srcSizePtr, +- const int targetDstSize, +- const tableType_t tableType) +-{ +- const BYTE* ip = (const BYTE*) src; +- const BYTE* base = (const BYTE*) src; +- const BYTE* lowLimit = (const BYTE*) src; +- const BYTE* anchor = ip; +- const BYTE* const iend = ip + *srcSizePtr; +- const BYTE* const mflimit = iend - MFLIMIT; +- const BYTE* const matchlimit = iend - LASTLITERALS; +- +- BYTE* op = (BYTE*) dst; +- BYTE* const oend = op + targetDstSize; +- BYTE* const oMaxLit = op + targetDstSize - 2 /* offset */ - 8 /* because 8+MINMATCH==MFLIMIT */ - 1 /* token */; +- BYTE* const oMaxMatch = op + targetDstSize - (LASTLITERALS + 1 /* token */); +- BYTE* const oMaxSeq = oMaxLit - 1 /* token */; +- +- U32 forwardH; +- +- +- /* Init conditions */ +- if (targetDstSize < 1) return 0; /* Impossible to store anything */ +- if ((U32)*srcSizePtr > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported input size, too large (or negative) */ +- if ((tableType == byU16) && (*srcSizePtr>=LZ4_64Klimit)) return 0; /* Size too large (not within 64K limit) */ +- if (*srcSizePtr> LZ4_skipTrigger); +- +- if (unlikely(forwardIp > mflimit)) +- goto _last_literals; +- +- match = LZ4_getPositionOnHash(h, ctx, tableType, base); +- forwardH = LZ4_hashPosition(forwardIp, tableType); +- LZ4_putPositionOnHash(ip, h, ctx, tableType, base); +- +- } while ( ((tableType==byU16) ? 0 : (match + MAX_DISTANCE < ip)) +- || (LZ4_read32(match) != LZ4_read32(ip)) ); +- } +- +- /* Catch up */ +- while ((ip>anchor) && (match > lowLimit) && (unlikely(ip[-1]==match[-1]))) { ip--; match--; } +- +- { +- /* Encode Literal length */ +- unsigned litLength = (unsigned)(ip - anchor); +- token = op++; +- if (op + ((litLength+240)/255) + litLength > oMaxLit) +- { +- /* Not enough space for a last match */ +- op--; +- goto _last_literals; +- } +- if (litLength>=RUN_MASK) +- { +- unsigned len = litLength - RUN_MASK; +- *token=(RUN_MASK<= 255 ; len-=255) *op++ = 255; +- *op++ = (BYTE)len; +- } +- else *token = (BYTE)(litLength< oMaxMatch) +- { +- /* Match description too long : reduce it */ +- matchLength = (15-1) + (oMaxMatch-op) * 255; +- } +- //printf("offset %5i, matchLength%5i \n", (int)(ip-match), matchLength + MINMATCH); +- ip += MINMATCH + matchLength; +- +- if (matchLength>=ML_MASK) +- { +- *token += ML_MASK; +- matchLength -= ML_MASK; +- while (matchLength >= 255) { matchLength-=255; *op++ = 255; } +- *op++ = (BYTE)matchLength; +- } +- else *token += (BYTE)(matchLength); +- } +- +- anchor = ip; +- +- /* Test end of block */ +- if (ip > mflimit) break; +- if (op > oMaxSeq) break; +- +- /* Fill table */ +- LZ4_putPosition(ip-2, ctx, tableType, base); +- +- /* Test next position */ +- match = LZ4_getPosition(ip, ctx, tableType, base); +- LZ4_putPosition(ip, ctx, tableType, base); +- if ( (match+MAX_DISTANCE>=ip) +- && (LZ4_read32(match)==LZ4_read32(ip)) ) +- { token=op++; *token=0; goto _next_match; } +- +- /* Prepare next loop */ +- forwardH = LZ4_hashPosition(++ip, tableType); +- } +- +-_last_literals: +- /* Encode Last Literals */ +- { +- size_t lastRunSize = (size_t)(iend - anchor); +- if (op + 1 /* token */ + ((lastRunSize+240)/255) /* litLength */ + lastRunSize /* literals */ > oend) +- { +- /* adapt lastRunSize to fill 'dst' */ +- lastRunSize = (oend-op) - 1; +- lastRunSize -= (lastRunSize+240)/255; +- } +- ip = anchor + lastRunSize; +- +- if (lastRunSize >= RUN_MASK) +- { +- size_t accumulator = lastRunSize - RUN_MASK; +- *op++ = RUN_MASK << ML_BITS; +- for(; accumulator >= 255 ; accumulator-=255) *op++ = 255; +- *op++ = (BYTE) accumulator; +- } +- else +- { +- *op++ = (BYTE)(lastRunSize<= LZ4_compressBound(*srcSizePtr)) /* compression success is guaranteed */ +- { +- return LZ4_compress_fast_extState(state, src, dst, *srcSizePtr, targetDstSize, 1); +- } +- else +- { +- if (*srcSizePtr < LZ4_64Klimit) +- return LZ4_compress_destSize_generic(state, src, dst, srcSizePtr, targetDstSize, byU16); +- else +- return LZ4_compress_destSize_generic(state, src, dst, srcSizePtr, targetDstSize, LZ4_64bits() ? byU32 : byPtr); +- } +-} +- +- +-int LZ4_compress_destSize(const char* src, char* dst, int* srcSizePtr, int targetDstSize) +-{ +-#if (HEAPMODE) +- void* ctx = ALLOCATOR(1, sizeof(LZ4_stream_t)); /* malloc-calloc always properly aligned */ +-#else +- LZ4_stream_t ctxBody; +- void* ctx = &ctxBody; +-#endif +- +- int result = LZ4_compress_destSize_extState(ctx, src, dst, srcSizePtr, targetDstSize); +- +-#if (HEAPMODE) +- FREEMEM(ctx); +-#endif +- return result; +-} +- +- +- +-/******************************** +-* Streaming functions +-********************************/ +- +-LZ4_stream_t* LZ4_createStream(void) +-{ +- LZ4_stream_t* lz4s = (LZ4_stream_t*)ALLOCATOR(8, LZ4_STREAMSIZE_U64); +- LZ4_STATIC_ASSERT(LZ4_STREAMSIZE >= sizeof(LZ4_stream_t_internal)); /* A compilation error here means LZ4_STREAMSIZE is not large enough */ +- LZ4_resetStream(lz4s); +- return lz4s; +-} +- +-void LZ4_resetStream (LZ4_stream_t* LZ4_stream) +-{ +- MEM_INIT(LZ4_stream, 0, sizeof(LZ4_stream_t)); +-} +- +-int LZ4_freeStream (LZ4_stream_t* LZ4_stream) +-{ +- FREEMEM(LZ4_stream); +- return (0); +-} +- +- +-#define HASH_UNIT sizeof(size_t) +-int LZ4_loadDict (LZ4_stream_t* LZ4_dict, const char* dictionary, int dictSize) +-{ +- LZ4_stream_t_internal* dict = (LZ4_stream_t_internal*) LZ4_dict; +- const BYTE* p = (const BYTE*)dictionary; +- const BYTE* const dictEnd = p + dictSize; +- const BYTE* base; +- +- if ((dict->initCheck) || (dict->currentOffset > 1 GB)) /* Uninitialized structure, or reuse overflow */ +- LZ4_resetStream(LZ4_dict); +- +- if (dictSize < (int)HASH_UNIT) +- { +- dict->dictionary = NULL; +- dict->dictSize = 0; +- return 0; +- } +- +- if ((dictEnd - p) > 64 KB) p = dictEnd - 64 KB; +- dict->currentOffset += 64 KB; +- base = p - dict->currentOffset; +- dict->dictionary = p; +- dict->dictSize = (U32)(dictEnd - p); +- dict->currentOffset += dict->dictSize; +- +- while (p <= dictEnd-HASH_UNIT) +- { +- LZ4_putPosition(p, dict->hashTable, byU32, base); +- p+=3; +- } +- +- return dict->dictSize; +-} +- +- +-static void LZ4_renormDictT(LZ4_stream_t_internal* LZ4_dict, const BYTE* src) +-{ +- if ((LZ4_dict->currentOffset > 0x80000000) || +- ((size_t)LZ4_dict->currentOffset > (size_t)src)) /* address space overflow */ +- { +- /* rescale hash table */ +- U32 delta = LZ4_dict->currentOffset - 64 KB; +- const BYTE* dictEnd = LZ4_dict->dictionary + LZ4_dict->dictSize; +- int i; +- for (i=0; ihashTable[i] < delta) LZ4_dict->hashTable[i]=0; +- else LZ4_dict->hashTable[i] -= delta; +- } +- LZ4_dict->currentOffset = 64 KB; +- if (LZ4_dict->dictSize > 64 KB) LZ4_dict->dictSize = 64 KB; +- LZ4_dict->dictionary = dictEnd - LZ4_dict->dictSize; +- } +-} +- +- +-int LZ4_compress_fast_continue (LZ4_stream_t* LZ4_stream, const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration) +-{ +- LZ4_stream_t_internal* streamPtr = (LZ4_stream_t_internal*)LZ4_stream; +- const BYTE* const dictEnd = streamPtr->dictionary + streamPtr->dictSize; +- +- const BYTE* smallest = (const BYTE*) source; +- if (streamPtr->initCheck) return 0; /* Uninitialized structure detected */ +- if ((streamPtr->dictSize>0) && (smallest>dictEnd)) smallest = dictEnd; +- LZ4_renormDictT(streamPtr, smallest); +- if (acceleration < 1) acceleration = ACCELERATION_DEFAULT; +- +- /* Check overlapping input/dictionary space */ +- { +- const BYTE* sourceEnd = (const BYTE*) source + inputSize; +- if ((sourceEnd > streamPtr->dictionary) && (sourceEnd < dictEnd)) +- { +- streamPtr->dictSize = (U32)(dictEnd - sourceEnd); +- if (streamPtr->dictSize > 64 KB) streamPtr->dictSize = 64 KB; +- if (streamPtr->dictSize < 4) streamPtr->dictSize = 0; +- streamPtr->dictionary = dictEnd - streamPtr->dictSize; +- } +- } +- +- /* prefix mode : source data follows dictionary */ +- if (dictEnd == (const BYTE*)source) +- { +- int result; +- if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset)) +- result = LZ4_compress_generic(LZ4_stream, source, dest, inputSize, maxOutputSize, limitedOutput, byU32, withPrefix64k, dictSmall, acceleration); +- else +- result = LZ4_compress_generic(LZ4_stream, source, dest, inputSize, maxOutputSize, limitedOutput, byU32, withPrefix64k, noDictIssue, acceleration); +- streamPtr->dictSize += (U32)inputSize; +- streamPtr->currentOffset += (U32)inputSize; +- return result; +- } +- +- /* external dictionary mode */ +- { +- int result; +- if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset)) +- result = LZ4_compress_generic(LZ4_stream, source, dest, inputSize, maxOutputSize, limitedOutput, byU32, usingExtDict, dictSmall, acceleration); +- else +- result = LZ4_compress_generic(LZ4_stream, source, dest, inputSize, maxOutputSize, limitedOutput, byU32, usingExtDict, noDictIssue, acceleration); +- streamPtr->dictionary = (const BYTE*)source; +- streamPtr->dictSize = (U32)inputSize; +- streamPtr->currentOffset += (U32)inputSize; +- return result; +- } +-} +- +- +-/* Hidden debug function, to force external dictionary mode */ +-int LZ4_compress_forceExtDict (LZ4_stream_t* LZ4_dict, const char* source, char* dest, int inputSize) +-{ +- LZ4_stream_t_internal* streamPtr = (LZ4_stream_t_internal*)LZ4_dict; +- int result; +- const BYTE* const dictEnd = streamPtr->dictionary + streamPtr->dictSize; +- +- const BYTE* smallest = dictEnd; +- if (smallest > (const BYTE*) source) smallest = (const BYTE*) source; +- LZ4_renormDictT((LZ4_stream_t_internal*)LZ4_dict, smallest); +- +- result = LZ4_compress_generic(LZ4_dict, source, dest, inputSize, 0, notLimited, byU32, usingExtDict, noDictIssue, 1); +- +- streamPtr->dictionary = (const BYTE*)source; +- streamPtr->dictSize = (U32)inputSize; +- streamPtr->currentOffset += (U32)inputSize; +- +- return result; +-} +- +- +-int LZ4_saveDict (LZ4_stream_t* LZ4_dict, char* safeBuffer, int dictSize) +-{ +- LZ4_stream_t_internal* dict = (LZ4_stream_t_internal*) LZ4_dict; +- const BYTE* previousDictEnd = dict->dictionary + dict->dictSize; +- +- if ((U32)dictSize > 64 KB) dictSize = 64 KB; /* useless to define a dictionary > 64 KB */ +- if ((U32)dictSize > dict->dictSize) dictSize = dict->dictSize; +- +- memmove(safeBuffer, previousDictEnd - dictSize, dictSize); +- +- dict->dictionary = (const BYTE*)safeBuffer; +- dict->dictSize = (U32)dictSize; +- +- return dictSize; +-} +- +- +- +-/******************************* +-* Decompression functions +-*******************************/ +-/* +- * This generic decompression function cover all use cases. +- * It shall be instantiated several times, using different sets of directives +- * Note that it is essential this generic function is really inlined, +- * in order to remove useless branches during compilation optimization. +- */ +-FORCE_INLINE int LZ4_decompress_generic( +- const char* const source, +- char* const dest, +- int inputSize, +- int outputSize, /* If endOnInput==endOnInputSize, this value is the max size of Output Buffer. */ +- +- int endOnInput, /* endOnOutputSize, endOnInputSize */ +- int partialDecoding, /* full, partial */ +- int targetOutputSize, /* only used if partialDecoding==partial */ +- int dict, /* noDict, withPrefix64k, usingExtDict */ +- const BYTE* const lowPrefix, /* == dest if dict == noDict */ +- const BYTE* const dictStart, /* only if dict==usingExtDict */ +- const size_t dictSize /* note : = 0 if noDict */ +- ) +-{ +- /* Local Variables */ +- const BYTE* ip = (const BYTE*) source; +- const BYTE* const iend = ip + inputSize; +- +- BYTE* op = (BYTE*) dest; +- BYTE* const oend = op + outputSize; +- BYTE* cpy; +- BYTE* oexit = op + targetOutputSize; +- const BYTE* const lowLimit = lowPrefix - dictSize; +- +- const BYTE* const dictEnd = (const BYTE*)dictStart + dictSize; +- const size_t dec32table[] = {4, 1, 2, 1, 4, 4, 4, 4}; +- const size_t dec64table[] = {0, 0, 0, (size_t)-1, 0, 1, 2, 3}; +- +- const int safeDecode = (endOnInput==endOnInputSize); +- const int checkOffset = ((safeDecode) && (dictSize < (int)(64 KB))); +- +- +- /* Special cases */ +- if ((partialDecoding) && (oexit> oend-MFLIMIT)) oexit = oend-MFLIMIT; /* targetOutputSize too high => decode everything */ +- if ((endOnInput) && (unlikely(outputSize==0))) return ((inputSize==1) && (*ip==0)) ? 0 : -1; /* Empty output buffer */ +- if ((!endOnInput) && (unlikely(outputSize==0))) return (*ip==0?1:-1); +- +- +- /* Main Loop */ +- while (1) +- { +- unsigned token; +- size_t length; +- const BYTE* match; +- +- /* get literal length */ +- token = *ip++; +- if ((length=(token>>ML_BITS)) == RUN_MASK) +- { +- unsigned s; +- do +- { +- s = *ip++; +- length += s; +- } +- while (likely((endOnInput)?ip(partialDecoding?oexit:oend-MFLIMIT)) || (ip+length>iend-(2+1+LASTLITERALS))) ) +- || ((!endOnInput) && (cpy>oend-COPYLENGTH))) +- { +- if (partialDecoding) +- { +- if (cpy > oend) goto _output_error; /* Error : write attempt beyond end of output buffer */ +- if ((endOnInput) && (ip+length > iend)) goto _output_error; /* Error : read attempt beyond end of input buffer */ +- } +- else +- { +- if ((!endOnInput) && (cpy != oend)) goto _output_error; /* Error : block decoding must stop exactly there */ +- if ((endOnInput) && ((ip+length != iend) || (cpy > oend))) goto _output_error; /* Error : input must be consumed */ +- } +- memcpy(op, ip, length); +- ip += length; +- op += length; +- break; /* Necessarily EOF, due to parsing restrictions */ +- } +- LZ4_wildCopy(op, ip, cpy); +- ip += length; op = cpy; +- +- /* get offset */ +- match = cpy - LZ4_readLE16(ip); ip+=2; +- if ((checkOffset) && (unlikely(match < lowLimit))) goto _output_error; /* Error : offset outside destination buffer */ +- +- /* get matchlength */ +- length = token & ML_MASK; +- if (length == ML_MASK) +- { +- unsigned s; +- do +- { +- if ((endOnInput) && (ip > iend-LASTLITERALS)) goto _output_error; +- s = *ip++; +- length += s; +- } while (s==255); +- if ((safeDecode) && unlikely((size_t)(op+length)<(size_t)op)) goto _output_error; /* overflow detection */ +- } +- length += MINMATCH; +- +- /* check external dictionary */ +- if ((dict==usingExtDict) && (match < lowPrefix)) +- { +- if (unlikely(op+length > oend-LASTLITERALS)) goto _output_error; /* doesn't respect parsing restriction */ +- +- if (length <= (size_t)(lowPrefix-match)) +- { +- /* match can be copied as a single segment from external dictionary */ +- match = dictEnd - (lowPrefix-match); +- memmove(op, match, length); op += length; +- } +- else +- { +- /* match encompass external dictionary and current segment */ +- size_t copySize = (size_t)(lowPrefix-match); +- memcpy(op, dictEnd - copySize, copySize); +- op += copySize; +- copySize = length - copySize; +- if (copySize > (size_t)(op-lowPrefix)) /* overlap within current segment */ +- { +- BYTE* const endOfMatch = op + copySize; +- const BYTE* copyFrom = lowPrefix; +- while (op < endOfMatch) *op++ = *copyFrom++; +- } +- else +- { +- memcpy(op, lowPrefix, copySize); +- op += copySize; +- } +- } +- continue; +- } +- +- /* copy repeated sequence */ +- cpy = op + length; +- if (unlikely((op-match)<8)) +- { +- const size_t dec64 = dec64table[op-match]; +- op[0] = match[0]; +- op[1] = match[1]; +- op[2] = match[2]; +- op[3] = match[3]; +- match += dec32table[op-match]; +- LZ4_copy4(op+4, match); +- op += 8; match -= dec64; +- } else { LZ4_copy8(op, match); op+=8; match+=8; } +- +- if (unlikely(cpy>oend-12)) +- { +- if (cpy > oend-LASTLITERALS) goto _output_error; /* Error : last LASTLITERALS bytes must be literals */ +- if (op < oend-8) +- { +- LZ4_wildCopy(op, match, oend-8); +- match += (oend-8) - op; +- op = oend-8; +- } +- while (opprefixSize = (size_t) dictSize; +- lz4sd->prefixEnd = (const BYTE*) dictionary + dictSize; +- lz4sd->externalDict = NULL; +- lz4sd->extDictSize = 0; +- return 1; +-} +- +-/* +-*_continue() : +- These decoding functions allow decompression of multiple blocks in "streaming" mode. +- Previously decoded blocks must still be available at the memory position where they were decoded. +- If it's not possible, save the relevant part of decoded data into a safe buffer, +- and indicate where it stands using LZ4_setStreamDecode() +-*/ +-int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxOutputSize) +-{ +- LZ4_streamDecode_t_internal* lz4sd = (LZ4_streamDecode_t_internal*) LZ4_streamDecode; +- int result; +- +- if (lz4sd->prefixEnd == (BYTE*)dest) +- { +- result = LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, +- endOnInputSize, full, 0, +- usingExtDict, lz4sd->prefixEnd - lz4sd->prefixSize, lz4sd->externalDict, lz4sd->extDictSize); +- if (result <= 0) return result; +- lz4sd->prefixSize += result; +- lz4sd->prefixEnd += result; +- } +- else +- { +- lz4sd->extDictSize = lz4sd->prefixSize; +- lz4sd->externalDict = lz4sd->prefixEnd - lz4sd->extDictSize; +- result = LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, +- endOnInputSize, full, 0, +- usingExtDict, (BYTE*)dest, lz4sd->externalDict, lz4sd->extDictSize); +- if (result <= 0) return result; +- lz4sd->prefixSize = result; +- lz4sd->prefixEnd = (BYTE*)dest + result; +- } +- +- return result; +-} +- +-int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int originalSize) +-{ +- LZ4_streamDecode_t_internal* lz4sd = (LZ4_streamDecode_t_internal*) LZ4_streamDecode; +- int result; +- +- if (lz4sd->prefixEnd == (BYTE*)dest) +- { +- result = LZ4_decompress_generic(source, dest, 0, originalSize, +- endOnOutputSize, full, 0, +- usingExtDict, lz4sd->prefixEnd - lz4sd->prefixSize, lz4sd->externalDict, lz4sd->extDictSize); +- if (result <= 0) return result; +- lz4sd->prefixSize += originalSize; +- lz4sd->prefixEnd += originalSize; +- } +- else +- { +- lz4sd->extDictSize = lz4sd->prefixSize; +- lz4sd->externalDict = (BYTE*)dest - lz4sd->extDictSize; +- result = LZ4_decompress_generic(source, dest, 0, originalSize, +- endOnOutputSize, full, 0, +- usingExtDict, (BYTE*)dest, lz4sd->externalDict, lz4sd->extDictSize); +- if (result <= 0) return result; +- lz4sd->prefixSize = originalSize; +- lz4sd->prefixEnd = (BYTE*)dest + originalSize; +- } +- +- return result; +-} +- +- +-/* +-Advanced decoding functions : +-*_usingDict() : +- These decoding functions work the same as "_continue" ones, +- the dictionary must be explicitly provided within parameters +-*/ +- +-FORCE_INLINE int LZ4_decompress_usingDict_generic(const char* source, char* dest, int compressedSize, int maxOutputSize, int safe, const char* dictStart, int dictSize) +-{ +- if (dictSize==0) +- return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, safe, full, 0, noDict, (BYTE*)dest, NULL, 0); +- if (dictStart+dictSize == dest) +- { +- if (dictSize >= (int)(64 KB - 1)) +- return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, safe, full, 0, withPrefix64k, (BYTE*)dest-64 KB, NULL, 0); +- return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, safe, full, 0, noDict, (BYTE*)dest-dictSize, NULL, 0); +- } +- return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, safe, full, 0, usingExtDict, (BYTE*)dest, (const BYTE*)dictStart, dictSize); +-} +- +-int LZ4_decompress_safe_usingDict(const char* source, char* dest, int compressedSize, int maxOutputSize, const char* dictStart, int dictSize) +-{ +- return LZ4_decompress_usingDict_generic(source, dest, compressedSize, maxOutputSize, 1, dictStart, dictSize); +-} +- +-int LZ4_decompress_fast_usingDict(const char* source, char* dest, int originalSize, const char* dictStart, int dictSize) +-{ +- return LZ4_decompress_usingDict_generic(source, dest, 0, originalSize, 0, dictStart, dictSize); +-} +- +-/* debug function */ +-int LZ4_decompress_safe_forceExtDict(const char* source, char* dest, int compressedSize, int maxOutputSize, const char* dictStart, int dictSize) +-{ +- return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, endOnInputSize, full, 0, usingExtDict, (BYTE*)dest, (const BYTE*)dictStart, dictSize); +-} +- +- +-/*************************************************** +-* Obsolete Functions +-***************************************************/ +-/* obsolete compression functions */ +-int LZ4_compress_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize) { return LZ4_compress_default(source, dest, inputSize, maxOutputSize); } +-int LZ4_compress(const char* source, char* dest, int inputSize) { return LZ4_compress_default(source, dest, inputSize, LZ4_compressBound(inputSize)); } +-int LZ4_compress_limitedOutput_withState (void* state, const char* src, char* dst, int srcSize, int dstSize) { return LZ4_compress_fast_extState(state, src, dst, srcSize, dstSize, 1); } +-int LZ4_compress_withState (void* state, const char* src, char* dst, int srcSize) { return LZ4_compress_fast_extState(state, src, dst, srcSize, LZ4_compressBound(srcSize), 1); } +-int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_stream, const char* src, char* dst, int srcSize, int maxDstSize) { return LZ4_compress_fast_continue(LZ4_stream, src, dst, srcSize, maxDstSize, 1); } +-int LZ4_compress_continue (LZ4_stream_t* LZ4_stream, const char* source, char* dest, int inputSize) { return LZ4_compress_fast_continue(LZ4_stream, source, dest, inputSize, LZ4_compressBound(inputSize), 1); } +- +-/* +-These function names are deprecated and should no longer be used. +-They are only provided here for compatibility with older user programs. +-- LZ4_uncompress is totally equivalent to LZ4_decompress_fast +-- LZ4_uncompress_unknownOutputSize is totally equivalent to LZ4_decompress_safe +-*/ +-int LZ4_uncompress (const char* source, char* dest, int outputSize) { return LZ4_decompress_fast(source, dest, outputSize); } +-int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize) { return LZ4_decompress_safe(source, dest, isize, maxOutputSize); } +- +- +-/* Obsolete Streaming functions */ +- +-int LZ4_sizeofStreamState() { return LZ4_STREAMSIZE; } +- +-static void LZ4_init(LZ4_stream_t_internal* lz4ds, BYTE* base) +-{ +- MEM_INIT(lz4ds, 0, LZ4_STREAMSIZE); +- lz4ds->bufferStart = base; +-} +- +-int LZ4_resetStreamState(void* state, char* inputBuffer) +-{ +- if ((((size_t)state) & 3) != 0) return 1; /* Error : pointer is not aligned on 4-bytes boundary */ +- LZ4_init((LZ4_stream_t_internal*)state, (BYTE*)inputBuffer); +- return 0; +-} +- +-void* LZ4_create (char* inputBuffer) +-{ +- void* lz4ds = ALLOCATOR(8, LZ4_STREAMSIZE_U64); +- LZ4_init ((LZ4_stream_t_internal*)lz4ds, (BYTE*)inputBuffer); +- return lz4ds; +-} +- +-char* LZ4_slideInputBuffer (void* LZ4_Data) +-{ +- LZ4_stream_t_internal* ctx = (LZ4_stream_t_internal*)LZ4_Data; +- int dictSize = LZ4_saveDict((LZ4_stream_t*)LZ4_Data, (char*)ctx->bufferStart, 64 KB); +- return (char*)(ctx->bufferStart + dictSize); +-} +- +-/* Obsolete streaming decompression functions */ +- +-int LZ4_decompress_safe_withPrefix64k(const char* source, char* dest, int compressedSize, int maxOutputSize) +-{ +- return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, endOnInputSize, full, 0, withPrefix64k, (BYTE*)dest - 64 KB, NULL, 64 KB); +-} +- +-int LZ4_decompress_fast_withPrefix64k(const char* source, char* dest, int originalSize) +-{ +- return LZ4_decompress_generic(source, dest, 0, originalSize, endOnOutputSize, full, 0, withPrefix64k, (BYTE*)dest - 64 KB, NULL, 64 KB); +-} +- +-#endif /* LZ4_COMMONDEFS_ONLY */ +- +diff --git a/corelib/src/rtflann/ext/lz4.h b/corelib/src/rtflann/ext/lz4.h +deleted file mode 100644 +index 3e74002..0000000 +--- a/corelib/src/rtflann/ext/lz4.h ++++ /dev/null +@@ -1,360 +0,0 @@ +-/* +- LZ4 - Fast LZ compression algorithm +- Header File +- Copyright (C) 2011-2015, Yann Collet. +- +- BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) +- +- Redistribution and use in source and binary forms, with or without +- modification, are permitted provided that the following conditions are +- met: +- +- * Redistributions of source code must retain the above copyright +- notice, this list of conditions and the following disclaimer. +- * Redistributions in binary form must reproduce the above +- copyright notice, this list of conditions and the following disclaimer +- in the documentation and/or other materials provided with the +- distribution. +- +- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- +- You can contact the author at : +- - LZ4 source repository : https://github.com/Cyan4973/lz4 +- - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c +-*/ +-#pragma once +- +-#if defined (__cplusplus) +-extern "C" { +-#endif +- +-/* +- * lz4.h provides block compression functions, and gives full buffer control to programmer. +- * If you need to generate inter-operable compressed data (respecting LZ4 frame specification), +- * and can let the library handle its own memory, please use lz4frame.h instead. +-*/ +- +-/************************************** +-* Version +-**************************************/ +-#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */ +-#define LZ4_VERSION_MINOR 7 /* for new (non-breaking) interface capabilities */ +-#define LZ4_VERSION_RELEASE 1 /* for tweaks, bug-fixes, or development */ +-#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE) +-int LZ4_versionNumber (void); +- +-/************************************** +-* Tuning parameter +-**************************************/ +-/* +- * LZ4_MEMORY_USAGE : +- * Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.) +- * Increasing memory usage improves compression ratio +- * Reduced memory usage can improve speed, due to cache effect +- * Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache +- */ +-#define LZ4_MEMORY_USAGE 14 +- +- +-/************************************** +-* Simple Functions +-**************************************/ +- +-int LZ4_compress_default(const char* source, char* dest, int sourceSize, int maxDestSize); +-int LZ4_decompress_safe (const char* source, char* dest, int compressedSize, int maxDecompressedSize); +- +-/* +-LZ4_compress_default() : +- Compresses 'sourceSize' bytes from buffer 'source' +- into already allocated 'dest' buffer of size 'maxDestSize'. +- Compression is guaranteed to succeed if 'maxDestSize' >= LZ4_compressBound(sourceSize). +- It also runs faster, so it's a recommended setting. +- If the function cannot compress 'source' into a more limited 'dest' budget, +- compression stops *immediately*, and the function result is zero. +- As a consequence, 'dest' content is not valid. +- This function never writes outside 'dest' buffer, nor read outside 'source' buffer. +- sourceSize : Max supported value is LZ4_MAX_INPUT_VALUE +- maxDestSize : full or partial size of buffer 'dest' (which must be already allocated) +- return : the number of bytes written into buffer 'dest' (necessarily <= maxOutputSize) +- or 0 if compression fails +- +-LZ4_decompress_safe() : +- compressedSize : is the precise full size of the compressed block. +- maxDecompressedSize : is the size of destination buffer, which must be already allocated. +- return : the number of bytes decompressed into destination buffer (necessarily <= maxDecompressedSize) +- If destination buffer is not large enough, decoding will stop and output an error code (<0). +- If the source stream is detected malformed, the function will stop decoding and return a negative result. +- This function is protected against buffer overflow exploits, including malicious data packets. +- It never writes outside output buffer, nor reads outside input buffer. +-*/ +- +- +-/************************************** +-* Advanced Functions +-**************************************/ +-#define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */ +-#define LZ4_COMPRESSBOUND(isize) ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16) +- +-/* +-LZ4_compressBound() : +- Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible) +- This function is primarily useful for memory allocation purposes (destination buffer size). +- Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example). +- Note that LZ4_compress_default() compress faster when dest buffer size is >= LZ4_compressBound(srcSize) +- inputSize : max supported value is LZ4_MAX_INPUT_SIZE +- return : maximum output size in a "worst case" scenario +- or 0, if input size is too large ( > LZ4_MAX_INPUT_SIZE) +-*/ +-int LZ4_compressBound(int inputSize); +- +-/* +-LZ4_compress_fast() : +- Same as LZ4_compress_default(), but allows to select an "acceleration" factor. +- The larger the acceleration value, the faster the algorithm, but also the lesser the compression. +- It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed. +- An acceleration value of "1" is the same as regular LZ4_compress_default() +- Values <= 0 will be replaced by ACCELERATION_DEFAULT (see lz4.c), which is 1. +-*/ +-int LZ4_compress_fast (const char* source, char* dest, int sourceSize, int maxDestSize, int acceleration); +- +- +-/* +-LZ4_compress_fast_extState() : +- Same compression function, just using an externally allocated memory space to store compression state. +- Use LZ4_sizeofState() to know how much memory must be allocated, +- and allocate it on 8-bytes boundaries (using malloc() typically). +- Then, provide it as 'void* state' to compression function. +-*/ +-int LZ4_sizeofState(void); +-int LZ4_compress_fast_extState (void* state, const char* source, char* dest, int inputSize, int maxDestSize, int acceleration); +- +- +-/* +-LZ4_compress_destSize() : +- Reverse the logic, by compressing as much data as possible from 'source' buffer +- into already allocated buffer 'dest' of size 'targetDestSize'. +- This function either compresses the entire 'source' content into 'dest' if it's large enough, +- or fill 'dest' buffer completely with as much data as possible from 'source'. +- *sourceSizePtr : will be modified to indicate how many bytes where read from 'source' to fill 'dest'. +- New value is necessarily <= old value. +- return : Nb bytes written into 'dest' (necessarily <= targetDestSize) +- or 0 if compression fails +-*/ +-int LZ4_compress_destSize (const char* source, char* dest, int* sourceSizePtr, int targetDestSize); +- +- +-/* +-LZ4_decompress_fast() : +- originalSize : is the original and therefore uncompressed size +- return : the number of bytes read from the source buffer (in other words, the compressed size) +- If the source stream is detected malformed, the function will stop decoding and return a negative result. +- Destination buffer must be already allocated. Its size must be a minimum of 'originalSize' bytes. +- note : This function fully respect memory boundaries for properly formed compressed data. +- It is a bit faster than LZ4_decompress_safe(). +- However, it does not provide any protection against intentionally modified data stream (malicious input). +- Use this function in trusted environment only (data to decode comes from a trusted source). +-*/ +-int LZ4_decompress_fast (const char* source, char* dest, int originalSize); +- +-/* +-LZ4_decompress_safe_partial() : +- This function decompress a compressed block of size 'compressedSize' at position 'source' +- into destination buffer 'dest' of size 'maxDecompressedSize'. +- The function tries to stop decompressing operation as soon as 'targetOutputSize' has been reached, +- reducing decompression time. +- return : the number of bytes decoded in the destination buffer (necessarily <= maxDecompressedSize) +- Note : this number can be < 'targetOutputSize' should the compressed block to decode be smaller. +- Always control how many bytes were decoded. +- If the source stream is detected malformed, the function will stop decoding and return a negative result. +- This function never writes outside of output buffer, and never reads outside of input buffer. It is therefore protected against malicious data packets +-*/ +-int LZ4_decompress_safe_partial (const char* source, char* dest, int compressedSize, int targetOutputSize, int maxDecompressedSize); +- +- +-/*********************************************** +-* Streaming Compression Functions +-***********************************************/ +-#define LZ4_STREAMSIZE_U64 ((1 << (LZ4_MEMORY_USAGE-3)) + 4) +-#define LZ4_STREAMSIZE (LZ4_STREAMSIZE_U64 * sizeof(long long)) +-/* +- * LZ4_stream_t +- * information structure to track an LZ4 stream. +- * important : init this structure content before first use ! +- * note : only allocated directly the structure if you are statically linking LZ4 +- * If you are using liblz4 as a DLL, please use below construction methods instead. +- */ +-typedef struct { long long table[LZ4_STREAMSIZE_U64]; } LZ4_stream_t; +- +-/* +- * LZ4_resetStream +- * Use this function to init an allocated LZ4_stream_t structure +- */ +-void LZ4_resetStream (LZ4_stream_t* streamPtr); +- +-/* +- * LZ4_createStream will allocate and initialize an LZ4_stream_t structure +- * LZ4_freeStream releases its memory. +- * In the context of a DLL (liblz4), please use these methods rather than the static struct. +- * They are more future proof, in case of a change of LZ4_stream_t size. +- */ +-LZ4_stream_t* LZ4_createStream(void); +-int LZ4_freeStream (LZ4_stream_t* streamPtr); +- +-/* +- * LZ4_loadDict +- * Use this function to load a static dictionary into LZ4_stream. +- * Any previous data will be forgotten, only 'dictionary' will remain in memory. +- * Loading a size of 0 is allowed. +- * Return : dictionary size, in bytes (necessarily <= 64 KB) +- */ +-int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize); +- +-/* +- * LZ4_compress_fast_continue +- * Compress buffer content 'src', using data from previously compressed blocks as dictionary to improve compression ratio. +- * Important : Previous data blocks are assumed to still be present and unmodified ! +- * 'dst' buffer must be already allocated. +- * If maxDstSize >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster. +- * If not, and if compressed data cannot fit into 'dst' buffer size, compression stops, and function returns a zero. +- */ +-int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int maxDstSize, int acceleration); +- +-/* +- * LZ4_saveDict +- * If previously compressed data block is not guaranteed to remain available at its memory location +- * save it into a safer place (char* safeBuffer) +- * Note : you don't need to call LZ4_loadDict() afterwards, +- * dictionary is immediately usable, you can therefore call LZ4_compress_fast_continue() +- * Return : saved dictionary size in bytes (necessarily <= dictSize), or 0 if error +- */ +-int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int dictSize); +- +- +-/************************************************ +-* Streaming Decompression Functions +-************************************************/ +- +-#define LZ4_STREAMDECODESIZE_U64 4 +-#define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U64 * sizeof(unsigned long long)) +-typedef struct { unsigned long long table[LZ4_STREAMDECODESIZE_U64]; } LZ4_streamDecode_t; +-/* +- * LZ4_streamDecode_t +- * information structure to track an LZ4 stream. +- * init this structure content using LZ4_setStreamDecode or memset() before first use ! +- * +- * In the context of a DLL (liblz4) please prefer usage of construction methods below. +- * They are more future proof, in case of a change of LZ4_streamDecode_t size in the future. +- * LZ4_createStreamDecode will allocate and initialize an LZ4_streamDecode_t structure +- * LZ4_freeStreamDecode releases its memory. +- */ +-LZ4_streamDecode_t* LZ4_createStreamDecode(void); +-int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream); +- +-/* +- * LZ4_setStreamDecode +- * Use this function to instruct where to find the dictionary. +- * Setting a size of 0 is allowed (same effect as reset). +- * Return : 1 if OK, 0 if error +- */ +-int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize); +- +-/* +-*_continue() : +- These decoding functions allow decompression of multiple blocks in "streaming" mode. +- Previously decoded blocks *must* remain available at the memory position where they were decoded (up to 64 KB) +- In the case of a ring buffers, decoding buffer must be either : +- - Exactly same size as encoding buffer, with same update rule (block boundaries at same positions) +- In which case, the decoding & encoding ring buffer can have any size, including very small ones ( < 64 KB). +- - Larger than encoding buffer, by a minimum of maxBlockSize more bytes. +- maxBlockSize is implementation dependent. It's the maximum size you intend to compress into a single block. +- In which case, encoding and decoding buffers do not need to be synchronized, +- and encoding ring buffer can have any size, including small ones ( < 64 KB). +- - _At least_ 64 KB + 8 bytes + maxBlockSize. +- In which case, encoding and decoding buffers do not need to be synchronized, +- and encoding ring buffer can have any size, including larger than decoding buffer. +- Whenever these conditions are not possible, save the last 64KB of decoded data into a safe buffer, +- and indicate where it is saved using LZ4_setStreamDecode() +-*/ +-int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxDecompressedSize); +-int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int originalSize); +- +- +-/* +-Advanced decoding functions : +-*_usingDict() : +- These decoding functions work the same as +- a combination of LZ4_setStreamDecode() followed by LZ4_decompress_x_continue() +- They are stand-alone. They don't need nor update an LZ4_streamDecode_t structure. +-*/ +-int LZ4_decompress_safe_usingDict (const char* source, char* dest, int compressedSize, int maxDecompressedSize, const char* dictStart, int dictSize); +-int LZ4_decompress_fast_usingDict (const char* source, char* dest, int originalSize, const char* dictStart, int dictSize); +- +- +- +-/************************************** +-* Obsolete Functions +-**************************************/ +-/* Deprecate Warnings */ +-/* Should these warnings messages be a problem, +- it is generally possible to disable them, +- with -Wno-deprecated-declarations for gcc +- or _CRT_SECURE_NO_WARNINGS in Visual for example. +- You can also define LZ4_DEPRECATE_WARNING_DEFBLOCK. */ +-#ifndef LZ4_DEPRECATE_WARNING_DEFBLOCK +-# define LZ4_DEPRECATE_WARNING_DEFBLOCK +-# define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) +-# if (LZ4_GCC_VERSION >= 405) || defined(__clang__) +-# define LZ4_DEPRECATED(message) __attribute__((deprecated(message))) +-# elif (LZ4_GCC_VERSION >= 301) +-# define LZ4_DEPRECATED(message) __attribute__((deprecated)) +-# elif defined(_MSC_VER) +-# define LZ4_DEPRECATED(message) __declspec(deprecated(message)) +-# else +-# pragma message("WARNING: You need to implement LZ4_DEPRECATED for this compiler") +-# define LZ4_DEPRECATED(message) +-# endif +-#endif /* LZ4_DEPRECATE_WARNING_DEFBLOCK */ +- +-/* Obsolete compression functions */ +-/* These functions are planned to start generate warnings by r131 approximately */ +-int LZ4_compress (const char* source, char* dest, int sourceSize); +-int LZ4_compress_limitedOutput (const char* source, char* dest, int sourceSize, int maxOutputSize); +-int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize); +-int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize); +-int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize); +-int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize, int maxOutputSize); +- +-/* Obsolete decompression functions */ +-/* These function names are completely deprecated and must no longer be used. +- They are only provided here for compatibility with older programs. +- - LZ4_uncompress is the same as LZ4_decompress_fast +- - LZ4_uncompress_unknownOutputSize is the same as LZ4_decompress_safe +- These function prototypes are now disabled; uncomment them only if you really need them. +- It is highly recommended to stop using these prototypes and migrate to maintained ones */ +-/* int LZ4_uncompress (const char* source, char* dest, int outputSize); */ +-/* int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize); */ +- +-/* Obsolete streaming functions; use new streaming interface whenever possible */ +-LZ4_DEPRECATED("use LZ4_createStream() instead") void* LZ4_create (char* inputBuffer); +-LZ4_DEPRECATED("use LZ4_createStream() instead") int LZ4_sizeofStreamState(void); +-LZ4_DEPRECATED("use LZ4_resetStream() instead") int LZ4_resetStreamState(void* state, char* inputBuffer); +-LZ4_DEPRECATED("use LZ4_saveDict() instead") char* LZ4_slideInputBuffer (void* state); +- +-/* Obsolete streaming decoding functions */ +-LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize); +-LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize); +- +- +-#if defined (__cplusplus) +-} +-#endif +diff --git a/corelib/src/rtflann/ext/lz4hc.c b/corelib/src/rtflann/ext/lz4hc.c +deleted file mode 100644 +index bbe7a9d..0000000 +--- a/corelib/src/rtflann/ext/lz4hc.c ++++ /dev/null +@@ -1,731 +0,0 @@ +-/* +- LZ4 HC - High Compression Mode of LZ4 +- Copyright (C) 2011-2015, Yann Collet. +- +- BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) +- +- Redistribution and use in source and binary forms, with or without +- modification, are permitted provided that the following conditions are +- met: +- +- * Redistributions of source code must retain the above copyright +- notice, this list of conditions and the following disclaimer. +- * Redistributions in binary form must reproduce the above +- copyright notice, this list of conditions and the following disclaimer +- in the documentation and/or other materials provided with the +- distribution. +- +- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- +- You can contact the author at : +- - LZ4 source repository : https://github.com/Cyan4973/lz4 +- - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c +-*/ +- +- +- +-/************************************** +-* Tuning Parameter +-**************************************/ +-static const int LZ4HC_compressionLevel_default = 9; +- +- +-/************************************** +-* Includes +-**************************************/ +-#include "lz4hc.h" +- +- +-/************************************** +-* Local Compiler Options +-**************************************/ +-#if defined(__GNUC__) +-# pragma GCC diagnostic ignored "-Wunused-function" +-#endif +- +-#if defined (__clang__) +-# pragma clang diagnostic ignored "-Wunused-function" +-#endif +- +- +-/************************************** +-* Common LZ4 definition +-**************************************/ +-#define LZ4_COMMONDEFS_ONLY +-#include "lz4.c" +- +- +-/************************************** +-* Local Constants +-**************************************/ +-#define DICTIONARY_LOGSIZE 16 +-#define MAXD (1<> ((MINMATCH*8)-HASH_LOG)) +-//#define DELTANEXTU16(p) chainTable[(p) & MAXD_MASK] /* flexible, MAXD dependent */ +-#define DELTANEXTU16(p) chainTable[(U16)(p)] /* faster */ +- +-static U32 LZ4HC_hashPtr(const void* ptr) { return HASH_FUNCTION(LZ4_read32(ptr)); } +- +- +- +-/************************************** +-* HC Compression +-**************************************/ +-static void LZ4HC_init (LZ4HC_Data_Structure* hc4, const BYTE* start) +-{ +- MEM_INIT((void*)hc4->hashTable, 0, sizeof(hc4->hashTable)); +- MEM_INIT(hc4->chainTable, 0xFF, sizeof(hc4->chainTable)); +- hc4->nextToUpdate = 64 KB; +- hc4->base = start - 64 KB; +- hc4->end = start; +- hc4->dictBase = start - 64 KB; +- hc4->dictLimit = 64 KB; +- hc4->lowLimit = 64 KB; +-} +- +- +-/* Update chains up to ip (excluded) */ +-FORCE_INLINE void LZ4HC_Insert (LZ4HC_Data_Structure* hc4, const BYTE* ip) +-{ +- U16* chainTable = hc4->chainTable; +- U32* HashTable = hc4->hashTable; +- const BYTE* const base = hc4->base; +- const U32 target = (U32)(ip - base); +- U32 idx = hc4->nextToUpdate; +- +- while(idx < target) +- { +- U32 h = LZ4HC_hashPtr(base+idx); +- size_t delta = idx - HashTable[h]; +- if (delta>MAX_DISTANCE) delta = MAX_DISTANCE; +- DELTANEXTU16(idx) = (U16)delta; +- HashTable[h] = idx; +- idx++; +- } +- +- hc4->nextToUpdate = target; +-} +- +- +-FORCE_INLINE int LZ4HC_InsertAndFindBestMatch (LZ4HC_Data_Structure* hc4, /* Index table will be updated */ +- const BYTE* ip, const BYTE* const iLimit, +- const BYTE** matchpos, +- const int maxNbAttempts) +-{ +- U16* const chainTable = hc4->chainTable; +- U32* const HashTable = hc4->hashTable; +- const BYTE* const base = hc4->base; +- const BYTE* const dictBase = hc4->dictBase; +- const U32 dictLimit = hc4->dictLimit; +- const U32 lowLimit = (hc4->lowLimit + 64 KB > (U32)(ip-base)) ? hc4->lowLimit : (U32)(ip - base) - (64 KB - 1); +- U32 matchIndex; +- const BYTE* match; +- int nbAttempts=maxNbAttempts; +- size_t ml=0; +- +- /* HC4 match finder */ +- LZ4HC_Insert(hc4, ip); +- matchIndex = HashTable[LZ4HC_hashPtr(ip)]; +- +- while ((matchIndex>=lowLimit) && (nbAttempts)) +- { +- nbAttempts--; +- if (matchIndex >= dictLimit) +- { +- match = base + matchIndex; +- if (*(match+ml) == *(ip+ml) +- && (LZ4_read32(match) == LZ4_read32(ip))) +- { +- size_t mlt = LZ4_count(ip+MINMATCH, match+MINMATCH, iLimit) + MINMATCH; +- if (mlt > ml) { ml = mlt; *matchpos = match; } +- } +- } +- else +- { +- match = dictBase + matchIndex; +- if (LZ4_read32(match) == LZ4_read32(ip)) +- { +- size_t mlt; +- const BYTE* vLimit = ip + (dictLimit - matchIndex); +- if (vLimit > iLimit) vLimit = iLimit; +- mlt = LZ4_count(ip+MINMATCH, match+MINMATCH, vLimit) + MINMATCH; +- if ((ip+mlt == vLimit) && (vLimit < iLimit)) +- mlt += LZ4_count(ip+mlt, base+dictLimit, iLimit); +- if (mlt > ml) { ml = mlt; *matchpos = base + matchIndex; } /* virtual matchpos */ +- } +- } +- matchIndex -= DELTANEXTU16(matchIndex); +- } +- +- return (int)ml; +-} +- +- +-FORCE_INLINE int LZ4HC_InsertAndGetWiderMatch ( +- LZ4HC_Data_Structure* hc4, +- const BYTE* const ip, +- const BYTE* const iLowLimit, +- const BYTE* const iHighLimit, +- int longest, +- const BYTE** matchpos, +- const BYTE** startpos, +- const int maxNbAttempts) +-{ +- U16* const chainTable = hc4->chainTable; +- U32* const HashTable = hc4->hashTable; +- const BYTE* const base = hc4->base; +- const U32 dictLimit = hc4->dictLimit; +- const BYTE* const lowPrefixPtr = base + dictLimit; +- const U32 lowLimit = (hc4->lowLimit + 64 KB > (U32)(ip-base)) ? hc4->lowLimit : (U32)(ip - base) - (64 KB - 1); +- const BYTE* const dictBase = hc4->dictBase; +- U32 matchIndex; +- int nbAttempts = maxNbAttempts; +- int delta = (int)(ip-iLowLimit); +- +- +- /* First Match */ +- LZ4HC_Insert(hc4, ip); +- matchIndex = HashTable[LZ4HC_hashPtr(ip)]; +- +- while ((matchIndex>=lowLimit) && (nbAttempts)) +- { +- nbAttempts--; +- if (matchIndex >= dictLimit) +- { +- const BYTE* matchPtr = base + matchIndex; +- if (*(iLowLimit + longest) == *(matchPtr - delta + longest)) +- if (LZ4_read32(matchPtr) == LZ4_read32(ip)) +- { +- int mlt = MINMATCH + LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit); +- int back = 0; +- +- while ((ip+back>iLowLimit) +- && (matchPtr+back > lowPrefixPtr) +- && (ip[back-1] == matchPtr[back-1])) +- back--; +- +- mlt -= back; +- +- if (mlt > longest) +- { +- longest = (int)mlt; +- *matchpos = matchPtr+back; +- *startpos = ip+back; +- } +- } +- } +- else +- { +- const BYTE* matchPtr = dictBase + matchIndex; +- if (LZ4_read32(matchPtr) == LZ4_read32(ip)) +- { +- size_t mlt; +- int back=0; +- const BYTE* vLimit = ip + (dictLimit - matchIndex); +- if (vLimit > iHighLimit) vLimit = iHighLimit; +- mlt = LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH; +- if ((ip+mlt == vLimit) && (vLimit < iHighLimit)) +- mlt += LZ4_count(ip+mlt, base+dictLimit, iHighLimit); +- while ((ip+back > iLowLimit) && (matchIndex+back > lowLimit) && (ip[back-1] == matchPtr[back-1])) back--; +- mlt -= back; +- if ((int)mlt > longest) { longest = (int)mlt; *matchpos = base + matchIndex + back; *startpos = ip+back; } +- } +- } +- matchIndex -= DELTANEXTU16(matchIndex); +- } +- +- return longest; +-} +- +- +-typedef enum { noLimit = 0, limitedOutput = 1 } limitedOutput_directive; +- +-#define LZ4HC_DEBUG 0 +-#if LZ4HC_DEBUG +-static unsigned debug = 0; +-#endif +- +-FORCE_INLINE int LZ4HC_encodeSequence ( +- const BYTE** ip, +- BYTE** op, +- const BYTE** anchor, +- int matchLength, +- const BYTE* const match, +- limitedOutput_directive limitedOutputBuffer, +- BYTE* oend) +-{ +- int length; +- BYTE* token; +- +-#if LZ4HC_DEBUG +- if (debug) printf("literal : %u -- match : %u -- offset : %u\n", (U32)(*ip - *anchor), (U32)matchLength, (U32)(*ip-match)); +-#endif +- +- /* Encode Literal length */ +- length = (int)(*ip - *anchor); +- token = (*op)++; +- if ((limitedOutputBuffer) && ((*op + (length>>8) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ +- if (length>=(int)RUN_MASK) { int len; *token=(RUN_MASK< 254 ; len-=255) *(*op)++ = 255; *(*op)++ = (BYTE)len; } +- else *token = (BYTE)(length<>8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ +- if (length>=(int)ML_MASK) { *token+=ML_MASK; length-=ML_MASK; for(; length > 509 ; length-=510) { *(*op)++ = 255; *(*op)++ = 255; } if (length > 254) { length-=255; *(*op)++ = 255; } *(*op)++ = (BYTE)length; } +- else *token += (BYTE)(length); +- +- /* Prepare next loop */ +- *ip += matchLength; +- *anchor = *ip; +- +- return 0; +-} +- +- +-static int LZ4HC_compress_generic ( +- void* ctxvoid, +- const char* source, +- char* dest, +- int inputSize, +- int maxOutputSize, +- int compressionLevel, +- limitedOutput_directive limit +- ) +-{ +- LZ4HC_Data_Structure* ctx = (LZ4HC_Data_Structure*) ctxvoid; +- const BYTE* ip = (const BYTE*) source; +- const BYTE* anchor = ip; +- const BYTE* const iend = ip + inputSize; +- const BYTE* const mflimit = iend - MFLIMIT; +- const BYTE* const matchlimit = (iend - LASTLITERALS); +- +- BYTE* op = (BYTE*) dest; +- BYTE* const oend = op + maxOutputSize; +- +- unsigned maxNbAttempts; +- int ml, ml2, ml3, ml0; +- const BYTE* ref=NULL; +- const BYTE* start2=NULL; +- const BYTE* ref2=NULL; +- const BYTE* start3=NULL; +- const BYTE* ref3=NULL; +- const BYTE* start0; +- const BYTE* ref0; +- +- +- /* init */ +- if (compressionLevel > g_maxCompressionLevel) compressionLevel = g_maxCompressionLevel; +- if (compressionLevel < 1) compressionLevel = LZ4HC_compressionLevel_default; +- maxNbAttempts = 1 << (compressionLevel-1); +- ctx->end += inputSize; +- +- ip++; +- +- /* Main Loop */ +- while (ip < mflimit) +- { +- ml = LZ4HC_InsertAndFindBestMatch (ctx, ip, matchlimit, (&ref), maxNbAttempts); +- if (!ml) { ip++; continue; } +- +- /* saved, in case we would skip too much */ +- start0 = ip; +- ref0 = ref; +- ml0 = ml; +- +-_Search2: +- if (ip+ml < mflimit) +- ml2 = LZ4HC_InsertAndGetWiderMatch(ctx, ip + ml - 2, ip + 1, matchlimit, ml, &ref2, &start2, maxNbAttempts); +- else ml2 = ml; +- +- if (ml2 == ml) /* No better match */ +- { +- if (LZ4HC_encodeSequence(&ip, &op, &anchor, ml, ref, limit, oend)) return 0; +- continue; +- } +- +- if (start0 < ip) +- { +- if (start2 < ip + ml0) /* empirical */ +- { +- ip = start0; +- ref = ref0; +- ml = ml0; +- } +- } +- +- /* Here, start0==ip */ +- if ((start2 - ip) < 3) /* First Match too small : removed */ +- { +- ml = ml2; +- ip = start2; +- ref =ref2; +- goto _Search2; +- } +- +-_Search3: +- /* +- * Currently we have : +- * ml2 > ml1, and +- * ip1+3 <= ip2 (usually < ip1+ml1) +- */ +- if ((start2 - ip) < OPTIMAL_ML) +- { +- int correction; +- int new_ml = ml; +- if (new_ml > OPTIMAL_ML) new_ml = OPTIMAL_ML; +- if (ip+new_ml > start2 + ml2 - MINMATCH) new_ml = (int)(start2 - ip) + ml2 - MINMATCH; +- correction = new_ml - (int)(start2 - ip); +- if (correction > 0) +- { +- start2 += correction; +- ref2 += correction; +- ml2 -= correction; +- } +- } +- /* Now, we have start2 = ip+new_ml, with new_ml = min(ml, OPTIMAL_ML=18) */ +- +- if (start2 + ml2 < mflimit) +- ml3 = LZ4HC_InsertAndGetWiderMatch(ctx, start2 + ml2 - 3, start2, matchlimit, ml2, &ref3, &start3, maxNbAttempts); +- else ml3 = ml2; +- +- if (ml3 == ml2) /* No better match : 2 sequences to encode */ +- { +- /* ip & ref are known; Now for ml */ +- if (start2 < ip+ml) ml = (int)(start2 - ip); +- /* Now, encode 2 sequences */ +- if (LZ4HC_encodeSequence(&ip, &op, &anchor, ml, ref, limit, oend)) return 0; +- ip = start2; +- if (LZ4HC_encodeSequence(&ip, &op, &anchor, ml2, ref2, limit, oend)) return 0; +- continue; +- } +- +- if (start3 < ip+ml+3) /* Not enough space for match 2 : remove it */ +- { +- if (start3 >= (ip+ml)) /* can write Seq1 immediately ==> Seq2 is removed, so Seq3 becomes Seq1 */ +- { +- if (start2 < ip+ml) +- { +- int correction = (int)(ip+ml - start2); +- start2 += correction; +- ref2 += correction; +- ml2 -= correction; +- if (ml2 < MINMATCH) +- { +- start2 = start3; +- ref2 = ref3; +- ml2 = ml3; +- } +- } +- +- if (LZ4HC_encodeSequence(&ip, &op, &anchor, ml, ref, limit, oend)) return 0; +- ip = start3; +- ref = ref3; +- ml = ml3; +- +- start0 = start2; +- ref0 = ref2; +- ml0 = ml2; +- goto _Search2; +- } +- +- start2 = start3; +- ref2 = ref3; +- ml2 = ml3; +- goto _Search3; +- } +- +- /* +- * OK, now we have 3 ascending matches; let's write at least the first one +- * ip & ref are known; Now for ml +- */ +- if (start2 < ip+ml) +- { +- if ((start2 - ip) < (int)ML_MASK) +- { +- int correction; +- if (ml > OPTIMAL_ML) ml = OPTIMAL_ML; +- if (ip + ml > start2 + ml2 - MINMATCH) ml = (int)(start2 - ip) + ml2 - MINMATCH; +- correction = ml - (int)(start2 - ip); +- if (correction > 0) +- { +- start2 += correction; +- ref2 += correction; +- ml2 -= correction; +- } +- } +- else +- { +- ml = (int)(start2 - ip); +- } +- } +- if (LZ4HC_encodeSequence(&ip, &op, &anchor, ml, ref, limit, oend)) return 0; +- +- ip = start2; +- ref = ref2; +- ml = ml2; +- +- start2 = start3; +- ref2 = ref3; +- ml2 = ml3; +- +- goto _Search3; +- } +- +- /* Encode Last Literals */ +- { +- int lastRun = (int)(iend - anchor); +- if ((limit) && (((char*)op - dest) + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > (U32)maxOutputSize)) return 0; /* Check output limit */ +- if (lastRun>=(int)RUN_MASK) { *op++=(RUN_MASK< 254 ; lastRun-=255) *op++ = 255; *op++ = (BYTE) lastRun; } +- else *op++ = (BYTE)(lastRun<base = NULL; +- ((LZ4HC_Data_Structure*)LZ4_streamHCPtr)->compressionLevel = (unsigned)compressionLevel; +-} +- +-int LZ4_loadDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, const char* dictionary, int dictSize) +-{ +- LZ4HC_Data_Structure* ctxPtr = (LZ4HC_Data_Structure*) LZ4_streamHCPtr; +- if (dictSize > 64 KB) +- { +- dictionary += dictSize - 64 KB; +- dictSize = 64 KB; +- } +- LZ4HC_init (ctxPtr, (const BYTE*)dictionary); +- if (dictSize >= 4) LZ4HC_Insert (ctxPtr, (const BYTE*)dictionary +(dictSize-3)); +- ctxPtr->end = (const BYTE*)dictionary + dictSize; +- return dictSize; +-} +- +- +-/* compression */ +- +-static void LZ4HC_setExternalDict(LZ4HC_Data_Structure* ctxPtr, const BYTE* newBlock) +-{ +- if (ctxPtr->end >= ctxPtr->base + 4) +- LZ4HC_Insert (ctxPtr, ctxPtr->end-3); /* Referencing remaining dictionary content */ +- /* Only one memory segment for extDict, so any previous extDict is lost at this stage */ +- ctxPtr->lowLimit = ctxPtr->dictLimit; +- ctxPtr->dictLimit = (U32)(ctxPtr->end - ctxPtr->base); +- ctxPtr->dictBase = ctxPtr->base; +- ctxPtr->base = newBlock - ctxPtr->dictLimit; +- ctxPtr->end = newBlock; +- ctxPtr->nextToUpdate = ctxPtr->dictLimit; /* match referencing will resume from there */ +-} +- +-static int LZ4_compressHC_continue_generic (LZ4HC_Data_Structure* ctxPtr, +- const char* source, char* dest, +- int inputSize, int maxOutputSize, limitedOutput_directive limit) +-{ +- /* auto-init if forgotten */ +- if (ctxPtr->base == NULL) +- LZ4HC_init (ctxPtr, (const BYTE*) source); +- +- /* Check overflow */ +- if ((size_t)(ctxPtr->end - ctxPtr->base) > 2 GB) +- { +- size_t dictSize = (size_t)(ctxPtr->end - ctxPtr->base) - ctxPtr->dictLimit; +- if (dictSize > 64 KB) dictSize = 64 KB; +- +- LZ4_loadDictHC((LZ4_streamHC_t*)ctxPtr, (const char*)(ctxPtr->end) - dictSize, (int)dictSize); +- } +- +- /* Check if blocks follow each other */ +- if ((const BYTE*)source != ctxPtr->end) +- LZ4HC_setExternalDict(ctxPtr, (const BYTE*)source); +- +- /* Check overlapping input/dictionary space */ +- { +- const BYTE* sourceEnd = (const BYTE*) source + inputSize; +- const BYTE* dictBegin = ctxPtr->dictBase + ctxPtr->lowLimit; +- const BYTE* dictEnd = ctxPtr->dictBase + ctxPtr->dictLimit; +- if ((sourceEnd > dictBegin) && ((const BYTE*)source < dictEnd)) +- { +- if (sourceEnd > dictEnd) sourceEnd = dictEnd; +- ctxPtr->lowLimit = (U32)(sourceEnd - ctxPtr->dictBase); +- if (ctxPtr->dictLimit - ctxPtr->lowLimit < 4) ctxPtr->lowLimit = ctxPtr->dictLimit; +- } +- } +- +- return LZ4HC_compress_generic (ctxPtr, source, dest, inputSize, maxOutputSize, ctxPtr->compressionLevel, limit); +-} +- +-int LZ4_compress_HC_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize, int maxOutputSize) +-{ +- if (maxOutputSize < LZ4_compressBound(inputSize)) +- return LZ4_compressHC_continue_generic ((LZ4HC_Data_Structure*)LZ4_streamHCPtr, source, dest, inputSize, maxOutputSize, limitedOutput); +- else +- return LZ4_compressHC_continue_generic ((LZ4HC_Data_Structure*)LZ4_streamHCPtr, source, dest, inputSize, maxOutputSize, noLimit); +-} +- +- +-/* dictionary saving */ +- +-int LZ4_saveDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, char* safeBuffer, int dictSize) +-{ +- LZ4HC_Data_Structure* streamPtr = (LZ4HC_Data_Structure*)LZ4_streamHCPtr; +- int prefixSize = (int)(streamPtr->end - (streamPtr->base + streamPtr->dictLimit)); +- if (dictSize > 64 KB) dictSize = 64 KB; +- if (dictSize < 4) dictSize = 0; +- if (dictSize > prefixSize) dictSize = prefixSize; +- memmove(safeBuffer, streamPtr->end - dictSize, dictSize); +- { +- U32 endIndex = (U32)(streamPtr->end - streamPtr->base); +- streamPtr->end = (const BYTE*)safeBuffer + dictSize; +- streamPtr->base = streamPtr->end - endIndex; +- streamPtr->dictLimit = endIndex - dictSize; +- streamPtr->lowLimit = endIndex - dictSize; +- if (streamPtr->nextToUpdate < streamPtr->dictLimit) streamPtr->nextToUpdate = streamPtr->dictLimit; +- } +- return dictSize; +-} +- +- +-/*********************************** +-* Deprecated Functions +-***********************************/ +-/* Deprecated compression functions */ +-/* These functions are planned to start generate warnings by r131 approximately */ +-int LZ4_compressHC(const char* src, char* dst, int srcSize) { return LZ4_compress_HC (src, dst, srcSize, LZ4_compressBound(srcSize), 0); } +-int LZ4_compressHC_limitedOutput(const char* src, char* dst, int srcSize, int maxDstSize) { return LZ4_compress_HC(src, dst, srcSize, maxDstSize, 0); } +-int LZ4_compressHC2(const char* src, char* dst, int srcSize, int cLevel) { return LZ4_compress_HC (src, dst, srcSize, LZ4_compressBound(srcSize), cLevel); } +-int LZ4_compressHC2_limitedOutput(const char* src, char* dst, int srcSize, int maxDstSize, int cLevel) { return LZ4_compress_HC(src, dst, srcSize, maxDstSize, cLevel); } +-int LZ4_compressHC_withStateHC (void* state, const char* src, char* dst, int srcSize) { return LZ4_compress_HC_extStateHC (state, src, dst, srcSize, LZ4_compressBound(srcSize), 0); } +-int LZ4_compressHC_limitedOutput_withStateHC (void* state, const char* src, char* dst, int srcSize, int maxDstSize) { return LZ4_compress_HC_extStateHC (state, src, dst, srcSize, maxDstSize, 0); } +-int LZ4_compressHC2_withStateHC (void* state, const char* src, char* dst, int srcSize, int cLevel) { return LZ4_compress_HC_extStateHC(state, src, dst, srcSize, LZ4_compressBound(srcSize), cLevel); } +-int LZ4_compressHC2_limitedOutput_withStateHC (void* state, const char* src, char* dst, int srcSize, int maxDstSize, int cLevel) { return LZ4_compress_HC_extStateHC(state, src, dst, srcSize, maxDstSize, cLevel); } +-int LZ4_compressHC_continue (LZ4_streamHC_t* ctx, const char* src, char* dst, int srcSize) { return LZ4_compress_HC_continue (ctx, src, dst, srcSize, LZ4_compressBound(srcSize)); } +-int LZ4_compressHC_limitedOutput_continue (LZ4_streamHC_t* ctx, const char* src, char* dst, int srcSize, int maxDstSize) { return LZ4_compress_HC_continue (ctx, src, dst, srcSize, maxDstSize); } +- +- +-/* Deprecated streaming functions */ +-/* These functions currently generate deprecation warnings */ +-int LZ4_sizeofStreamStateHC(void) { return LZ4_STREAMHCSIZE; } +- +-int LZ4_resetStreamStateHC(void* state, char* inputBuffer) +-{ +- if ((((size_t)state) & (sizeof(void*)-1)) != 0) return 1; /* Error : pointer is not aligned for pointer (32 or 64 bits) */ +- LZ4HC_init((LZ4HC_Data_Structure*)state, (const BYTE*)inputBuffer); +- ((LZ4HC_Data_Structure*)state)->inputBuffer = (BYTE*)inputBuffer; +- return 0; +-} +- +-void* LZ4_createHC (char* inputBuffer) +-{ +- void* hc4 = ALLOCATOR(1, sizeof(LZ4HC_Data_Structure)); +- if (hc4 == NULL) return NULL; /* not enough memory */ +- LZ4HC_init ((LZ4HC_Data_Structure*)hc4, (const BYTE*)inputBuffer); +- ((LZ4HC_Data_Structure*)hc4)->inputBuffer = (BYTE*)inputBuffer; +- return hc4; +-} +- +-int LZ4_freeHC (void* LZ4HC_Data) +-{ +- FREEMEM(LZ4HC_Data); +- return (0); +-} +- +-int LZ4_compressHC2_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int compressionLevel) +-{ +- return LZ4HC_compress_generic (LZ4HC_Data, source, dest, inputSize, 0, compressionLevel, noLimit); +-} +- +-int LZ4_compressHC2_limitedOutput_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel) +-{ +- return LZ4HC_compress_generic (LZ4HC_Data, source, dest, inputSize, maxOutputSize, compressionLevel, limitedOutput); +-} +- +-char* LZ4_slideInputBufferHC(void* LZ4HC_Data) +-{ +- LZ4HC_Data_Structure* hc4 = (LZ4HC_Data_Structure*)LZ4HC_Data; +- int dictSize = LZ4_saveDictHC((LZ4_streamHC_t*)LZ4HC_Data, (char*)(hc4->inputBuffer), 64 KB); +- return (char*)(hc4->inputBuffer + dictSize); +-} +diff --git a/corelib/src/rtflann/ext/lz4hc.h b/corelib/src/rtflann/ext/lz4hc.h +deleted file mode 100644 +index 431f7c8..0000000 +--- a/corelib/src/rtflann/ext/lz4hc.h ++++ /dev/null +@@ -1,189 +0,0 @@ +-/* +- LZ4 HC - High Compression Mode of LZ4 +- Header File +- Copyright (C) 2011-2015, Yann Collet. +- BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) +- +- Redistribution and use in source and binary forms, with or without +- modification, are permitted provided that the following conditions are +- met: +- +- * Redistributions of source code must retain the above copyright +- notice, this list of conditions and the following disclaimer. +- * Redistributions in binary form must reproduce the above +- copyright notice, this list of conditions and the following disclaimer +- in the documentation and/or other materials provided with the +- distribution. +- +- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- +- You can contact the author at : +- - LZ4 source repository : https://github.com/Cyan4973/lz4 +- - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c +-*/ +-#pragma once +- +- +-#if defined (__cplusplus) +-extern "C" { +-#endif +- +-/***************************** +-* Includes +-*****************************/ +-#include /* size_t */ +- +- +-/************************************** +-* Block Compression +-**************************************/ +-int LZ4_compress_HC (const char* src, char* dst, int srcSize, int maxDstSize, int compressionLevel); +-/* +-LZ4_compress_HC : +- Destination buffer 'dst' must be already allocated. +- Compression completion is guaranteed if 'dst' buffer is sized to handle worst circumstances (data not compressible) +- Worst size evaluation is provided by function LZ4_compressBound() (see "lz4.h") +- srcSize : Max supported value is LZ4_MAX_INPUT_SIZE (see "lz4.h") +- compressionLevel : Recommended values are between 4 and 9, although any value between 0 and 16 will work. +- 0 means "use default value" (see lz4hc.c). +- Values >16 behave the same as 16. +- return : the number of bytes written into buffer 'dst' +- or 0 if compression fails. +-*/ +- +- +-/* Note : +- Decompression functions are provided within LZ4 source code (see "lz4.h") (BSD license) +-*/ +- +- +-int LZ4_sizeofStateHC(void); +-int LZ4_compress_HC_extStateHC(void* state, const char* src, char* dst, int srcSize, int maxDstSize, int compressionLevel); +-/* +-LZ4_compress_HC_extStateHC() : +- Use this function if you prefer to manually allocate memory for compression tables. +- To know how much memory must be allocated for the compression tables, use : +- int LZ4_sizeofStateHC(); +- +- Allocated memory must be aligned on 8-bytes boundaries (which a normal malloc() will do properly). +- +- The allocated memory can then be provided to the compression functions using 'void* state' parameter. +- LZ4_compress_HC_extStateHC() is equivalent to previously described function. +- It just uses externally allocated memory for stateHC. +-*/ +- +- +-/************************************** +-* Streaming Compression +-**************************************/ +-#define LZ4_STREAMHCSIZE 262192 +-#define LZ4_STREAMHCSIZE_SIZET (LZ4_STREAMHCSIZE / sizeof(size_t)) +-typedef struct { size_t table[LZ4_STREAMHCSIZE_SIZET]; } LZ4_streamHC_t; +-/* +- LZ4_streamHC_t +- This structure allows static allocation of LZ4 HC streaming state. +- State must then be initialized using LZ4_resetStreamHC() before first use. +- +- Static allocation should only be used in combination with static linking. +- If you want to use LZ4 as a DLL, please use construction functions below, which are future-proof. +-*/ +- +- +-LZ4_streamHC_t* LZ4_createStreamHC(void); +-int LZ4_freeStreamHC (LZ4_streamHC_t* streamHCPtr); +-/* +- These functions create and release memory for LZ4 HC streaming state. +- Newly created states are already initialized. +- Existing state space can be re-used anytime using LZ4_resetStreamHC(). +- If you use LZ4 as a DLL, use these functions instead of static structure allocation, +- to avoid size mismatch between different versions. +-*/ +- +-void LZ4_resetStreamHC (LZ4_streamHC_t* streamHCPtr, int compressionLevel); +-int LZ4_loadDictHC (LZ4_streamHC_t* streamHCPtr, const char* dictionary, int dictSize); +- +-int LZ4_compress_HC_continue (LZ4_streamHC_t* streamHCPtr, const char* src, char* dst, int srcSize, int maxDstSize); +- +-int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, int maxDictSize); +- +-/* +- These functions compress data in successive blocks of any size, using previous blocks as dictionary. +- One key assumption is that previous blocks (up to 64 KB) remain read-accessible while compressing next blocks. +- There is an exception for ring buffers, which can be smaller 64 KB. +- Such case is automatically detected and correctly handled by LZ4_compress_HC_continue(). +- +- Before starting compression, state must be properly initialized, using LZ4_resetStreamHC(). +- A first "fictional block" can then be designated as initial dictionary, using LZ4_loadDictHC() (Optional). +- +- Then, use LZ4_compress_HC_continue() to compress each successive block. +- It works like LZ4_compress_HC(), but use previous memory blocks as dictionary to improve compression. +- Previous memory blocks (including initial dictionary when present) must remain accessible and unmodified during compression. +- As a reminder, size 'dst' buffer to handle worst cases, using LZ4_compressBound(), to ensure success of compression operation. +- +- If, for any reason, previous data blocks can't be preserved unmodified in memory during next compression block, +- you must save it to a safer memory space, using LZ4_saveDictHC(). +- Return value of LZ4_saveDictHC() is the size of dictionary effectively saved into 'safeBuffer'. +-*/ +- +- +- +-/************************************** +-* Deprecated Functions +-**************************************/ +-/* Deprecate Warnings */ +-/* Should these warnings messages be a problem, +- it is generally possible to disable them, +- with -Wno-deprecated-declarations for gcc +- or _CRT_SECURE_NO_WARNINGS in Visual for example. +- You can also define LZ4_DEPRECATE_WARNING_DEFBLOCK. */ +-#ifndef LZ4_DEPRECATE_WARNING_DEFBLOCK +-# define LZ4_DEPRECATE_WARNING_DEFBLOCK +-# define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) +-# if (LZ4_GCC_VERSION >= 405) || defined(__clang__) +-# define LZ4_DEPRECATED(message) __attribute__((deprecated(message))) +-# elif (LZ4_GCC_VERSION >= 301) +-# define LZ4_DEPRECATED(message) __attribute__((deprecated)) +-# elif defined(_MSC_VER) +-# define LZ4_DEPRECATED(message) __declspec(deprecated(message)) +-# else +-# pragma message("WARNING: You need to implement LZ4_DEPRECATED for this compiler") +-# define LZ4_DEPRECATED(message) +-# endif +-#endif // LZ4_DEPRECATE_WARNING_DEFBLOCK +- +-/* compression functions */ +-/* these functions are planned to trigger warning messages by r131 approximately */ +-int LZ4_compressHC (const char* source, char* dest, int inputSize); +-int LZ4_compressHC_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize); +-int LZ4_compressHC2 (const char* source, char* dest, int inputSize, int compressionLevel); +-int LZ4_compressHC2_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); +-int LZ4_compressHC_withStateHC (void* state, const char* source, char* dest, int inputSize); +-int LZ4_compressHC_limitedOutput_withStateHC (void* state, const char* source, char* dest, int inputSize, int maxOutputSize); +-int LZ4_compressHC2_withStateHC (void* state, const char* source, char* dest, int inputSize, int compressionLevel); +-int LZ4_compressHC2_limitedOutput_withStateHC(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); +-int LZ4_compressHC_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize); +-int LZ4_compressHC_limitedOutput_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize, int maxOutputSize); +- +-/* Streaming functions following the older model; should no longer be used */ +-LZ4_DEPRECATED("use LZ4_createStreamHC() instead") void* LZ4_createHC (char* inputBuffer); +-LZ4_DEPRECATED("use LZ4_saveDictHC() instead") char* LZ4_slideInputBufferHC (void* LZ4HC_Data); +-LZ4_DEPRECATED("use LZ4_freeStreamHC() instead") int LZ4_freeHC (void* LZ4HC_Data); +-LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") int LZ4_compressHC2_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int compressionLevel); +-LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") int LZ4_compressHC2_limitedOutput_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); +-LZ4_DEPRECATED("use LZ4_createStreamHC() instead") int LZ4_sizeofStreamStateHC(void); +-LZ4_DEPRECATED("use LZ4_resetStreamHC() instead") int LZ4_resetStreamStateHC(void* state, char* inputBuffer); +- +- +-#if defined (__cplusplus) +-} +-#endif +diff --git a/corelib/src/rtflann/util/serialization.h b/corelib/src/rtflann/util/serialization.h +index 8c25166..dabe3e8 100644 +--- a/corelib/src/rtflann/util/serialization.h ++++ b/corelib/src/rtflann/util/serialization.h +@@ -6,8 +6,8 @@ + #include + #include + #include +-#include "rtflann/ext/lz4.h" +-#include "rtflann/ext/lz4hc.h" ++#include "lz4.h" ++#include "lz4hc.h" + + + namespace rtflann diff --git a/cmake/ports/rtabmap/portfile.cmake b/cmake/ports/rtabmap/portfile.cmake index b31a0e4582..cee1f8f3b5 100644 --- a/cmake/ports/rtabmap/portfile.cmake +++ b/cmake/ports/rtabmap/portfile.cmake @@ -11,6 +11,7 @@ vcpkg_from_github( multi-definition.patch rtabmap-res-tool.patch gklib.patch + lz4.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS diff --git a/cmake/ports/xlink/portfile.cmake b/cmake/ports/xlink/portfile.cmake index e01d5b1b46..7081695887 100644 --- a/cmake/ports/xlink/portfile.cmake +++ b/cmake/ports/xlink/portfile.cmake @@ -1,9 +1,9 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO luxonis/XLink - REF 2b517e1cb1ca77bea17679f9fdeb739812431174 - SHA512 f4c48411115a7708e60e73bda35350eaf2dfc23d84c7d5516dde8253ab06f2f226ff8529e567f26a135f9d909861f660336e4d6676326224c63d3be8828940cc - HEAD_REF master + REF 6615e0721021c136dc50a3af5a5bf16919ffef87 + SHA512 35fb1c1ee8dea69a6bf577fb374fe6dd3cf815e7baef70671732fa8062d81fc34c17439fbe95f3bfe1a4266e0bc4e47b0d033c8abf586bbd7e0713891ffe6c28 + HEAD_REF develop_server ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index a27db75cf2..3b4eb71782 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -1,7 +1,7 @@ { "default-registry": { "kind": "git", - "baseline": "509f71e53f45e46c13fa7935d2f6a45803580c07", + "baseline": "10b7a178346f3f0abef60cecd5130e295afd8da4", "repository": "https://github.com/microsoft/vcpkg" }, "registries": [ diff --git a/vcpkg.json b/vcpkg.json index 08e3a8fc40..40e7f1d10a 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -14,7 +14,7 @@ "spdlog", "bzip2", "lz4", - "libarchive-luxonis", + "libarchive", "liblzma", "fp16", "mp4v2", From 42b7de684051f94ca5ab9550a45a247b3737f006 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 12 Nov 2024 14:07:46 +0100 Subject: [PATCH 051/131] xlink hunter bump --- .github/workflows/python-main.yml | 2 -- cmake/ports/xlink/hunter.patch | 15 +++++++++++++++ cmake/ports/xlink/portfile.cmake | 4 +++- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 cmake/ports/xlink/hunter.patch diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 6ef717c78c..17d53fe569 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -313,8 +313,6 @@ jobs: run: | python -m pip install --upgrade pip brew install libusb - brew install opencv - brew install pcl python -m pip install delocate - name: Building wheels run: cd bindings/python && python -m pip wheel . -w ./wheelhouse/ --verbose diff --git a/cmake/ports/xlink/hunter.patch b/cmake/ports/xlink/hunter.patch new file mode 100644 index 0000000000..ee66e78cbd --- /dev/null +++ b/cmake/ports/xlink/hunter.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3161667..873cd8c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,8 +6,8 @@ cmake_minimum_required(VERSION 3.2) + + include("cmake/HunterGate.cmake") + HunterGate( +- URL "https://github.com/cpp-pm/hunter/archive/v0.23.320.tar.gz" +- SHA1 "9b4e732afd22f40482c11ad6342f7d336634226f" ++ URL "https://github.com/cpp-pm/hunter/archive/v0.25.7.tar.gz" ++ SHA1 "99f05ff154c682f7349546d66294d2f69f7193bc" + LOCAL # Local config for dependencies + ) + diff --git a/cmake/ports/xlink/portfile.cmake b/cmake/ports/xlink/portfile.cmake index 7081695887..c9c25f88fd 100644 --- a/cmake/ports/xlink/portfile.cmake +++ b/cmake/ports/xlink/portfile.cmake @@ -4,10 +4,12 @@ vcpkg_from_github( REF 6615e0721021c136dc50a3af5a5bf16919ffef87 SHA512 35fb1c1ee8dea69a6bf577fb374fe6dd3cf815e7baef70671732fa8062d81fc34c17439fbe95f3bfe1a4266e0bc4e47b0d033c8abf586bbd7e0713891ffe6c28 HEAD_REF develop_server + PATCHES + hunter.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES - libusb DXLINK_ENABLE_LIBUSB + libusb XLINK_ENABLE_LIBUSB ) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" From 968090e760b8249c3f60333ba2f61f27d1a6d6e8 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 12 Nov 2024 14:19:33 +0100 Subject: [PATCH 052/131] pybind11 update --- cmake/ports/pybind11/portfile.cmake | 10 ++++++++++ cmake/ports/pybind11/usage | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 cmake/ports/pybind11/usage diff --git a/cmake/ports/pybind11/portfile.cmake b/cmake/ports/pybind11/portfile.cmake index 277635976d..e28582eab7 100644 --- a/cmake/ports/pybind11/portfile.cmake +++ b/cmake/ports/pybind11/portfile.cmake @@ -7,7 +7,17 @@ vcpkg_from_github( ) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DPYBIND11_TEST=OFF + # Disable all Python searching, Python required only for tests + -DPYBIND11_NOPYTHON=ON ) vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/pybind11") +vcpkg_fixup_pkgconfig() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/") + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/cmake/ports/pybind11/usage b/cmake/ports/pybind11/usage new file mode 100644 index 0000000000..1a149fe04d --- /dev/null +++ b/cmake/ports/pybind11/usage @@ -0,0 +1,23 @@ +pybind11 provides CMake targets. There are two modes provided; classic, which is built on the old Python +discovery packages in CMake, or the new FindPython mode, which uses FindPython +from 3.12+ forward (3.15+ _highly_ recommended). + +New FindPython mode: + + find_package(Python COMPONENTS Interpreter Development) + find_package(pybind11 CONFIG) + + # pybind11 method: + pybind11_add_module(MyModule1 src1.cpp) + + # Python method: + Python_add_library(MyModule2 src2.cpp) + target_link_libraries(MyModule2 pybind11::headers) + set_target_properties(MyModule2 PROPERTIES + INTERPROCEDURAL_OPTIMIZATION ON + CXX_VISIBILITY_PRESET ON + VISIBILITY_INLINES_HIDDEN ON + ) + +For more information see here: + https://pybind11.readthedocs.io/en/latest/compiling.html#building-with-cmake From 2675f34a5b9780f1c888d0e139a355e2d015b12f Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 12 Nov 2024 14:47:58 +0100 Subject: [PATCH 053/131] update pybind11, split manylinux jobs to fix space issues --- .github/workflows/python-main.yml | 4 ++-- cmake/ports/pybind11/portfile.cmake | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 17d53fe569..add0455a4b 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -404,7 +404,7 @@ jobs: PLAT: manylinux_2_28_x86_64 strategy: matrix: - python-set: ["7..9", "10..12"] + python-set: ["7", "8", "9", "10", "11", "12"] env: # workaround required for cache@v3, https://github.com/actions/cache/issues/1428 # to be removed when upgrading the manylinux image @@ -491,7 +491,7 @@ jobs: - /.hunter:/github/home/.hunter strategy: matrix: - python-set: ["7..9", "10..12"] + python-set: ["7", "8", "9", "10", "11", "12"] env: # workaround required for cache@v3, https://github.com/actions/cache/issues/1428 # to be removed when upgrading the manylinux image diff --git a/cmake/ports/pybind11/portfile.cmake b/cmake/ports/pybind11/portfile.cmake index e28582eab7..11203bf843 100644 --- a/cmake/ports/pybind11/portfile.cmake +++ b/cmake/ports/pybind11/portfile.cmake @@ -1,9 +1,9 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH - REPO luxonis/pybind11 - REF f760e2b984b66be2cfa202c93da9d341a557fb5d - SHA512 8baad5c326553075926901b9e2d5fcb574d298b382f17ba8ae0abf022fe3c92f4704b4a3fdce9b63d12ef31a436afc04d11a2050639f254be886a88d201a8b85 - HEAD_REF luxonis-smart-holder + REPO pybind/pybind11 + REF 2e6d06d3f4d78a9c7c22a38955079a5b347fa6de + SHA512 6068594efd1446a4835f3b6ea8d49ff648d339ef88ca8cac41c7f03e7fd83d2378baf3bbe75d3f1a83bb4d5a163a75332f50df8d64de0d6f8965e89c718334a9 + HEAD_REF smart_holder ) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" From 402925d496a7d7bd38be1ebff335b8f54bf6c2c7 Mon Sep 17 00:00:00 2001 From: Adam Serafin Date: Tue, 12 Nov 2024 15:10:50 +0100 Subject: [PATCH 054/131] Update python-main.yml --- .github/workflows/python-main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index add0455a4b..ae5da57811 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -461,7 +461,7 @@ jobs: /opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar mv dist/* wheelhouse/audited/ - name: Build wheels - run: cd bindings/python && for PYBIN in /opt/python/cp3{${{ matrix.python-set }}}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done + run: cd bindings/python && for PYBIN in /opt/python/cp3{${ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Audit wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done - name: Archive wheel artifacts @@ -540,7 +540,7 @@ jobs: run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV - name: Building wheels run: | - cd bindings/python && for PYBIN in /opt/python/cp3{${{ matrix.python-set }}}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done + cd bindings/python && for PYBIN in /opt/python/cp3{${ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Auditing wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done - name: Archive wheel artifacts From cb1dfe3eaa92c3d2784eac2e2dc93ba6d234ac41 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 12 Nov 2024 15:36:04 +0100 Subject: [PATCH 055/131] move find pybind --- bindings/python/CMakeLists.txt | 4 ---- cmake/depthaiDependencies.cmake | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index c96af3997f..ed87b8d787 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -48,10 +48,6 @@ option(DEPTHAI_PYTHON_EMBEDDED_MODULE "Create an embeddable module" OFF) if(MINGW) set(PYBIND11_LTO_CXX_FLAGS "" CACHE STRING "" FORCE) endif() -find_package(pybind11 CONFIG REQUIRED) - -# Print out the pybind11 version that was found -message(STATUS "Found pybind11 v${pybind11_VERSION}") # Add external dependencies add_subdirectory(external) diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake index ac8134b33a..1cc50b07f4 100644 --- a/cmake/depthaiDependencies.cmake +++ b/cmake/depthaiDependencies.cmake @@ -13,6 +13,11 @@ endif() # If library was build as static, find all dependencies if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS)) + if(DEPTHAI_BUILD_PYTHON) + find_package(pybind11 CONFIG REQUIRED) + # Print out the pybind11 version that was found + message(STATUS "Found pybind11 v${pybind11_VERSION}") + endif() # BZip2 (for bspatch) find_package(BZip2 ${_QUIET} REQUIRED) From 9663a672b634a2842ba23747643b811ff0919e92 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 12 Nov 2024 15:39:29 +0100 Subject: [PATCH 056/131] try fixing python matrix --- .github/workflows/python-main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index ae5da57811..aa0ae315ea 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -461,7 +461,7 @@ jobs: /opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar mv dist/* wheelhouse/audited/ - name: Build wheels - run: cd bindings/python && for PYBIN in /opt/python/cp3{${ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done + run: cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Audit wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done - name: Archive wheel artifacts @@ -540,7 +540,7 @@ jobs: run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV - name: Building wheels run: | - cd bindings/python && for PYBIN in /opt/python/cp3{${ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done + cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Auditing wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done - name: Archive wheel artifacts From 106cfd50bfefda890f8b38dfe2f1c4485634d6de Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 12 Nov 2024 15:57:16 +0100 Subject: [PATCH 057/131] revert pybind, remove depthai-core install from manylinux --- .github/workflows/python-main.yml | 12 ------------ cmake/ports/pybind11/portfile.cmake | 8 ++++---- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index aa0ae315ea..521105c2d1 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -445,12 +445,6 @@ jobs: - name: Specify docstring to use while building the wheel run: echo "DEPTHAI_PYTHON_DOCSTRINGS_INPUT=$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" >> $GITHUB_ENV - - name: Build and install depthai-core - run: | - cmake -S . -B build_core -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$PWD/cmake/toolchain/pic.cmake - cmake --build build_core --target install --parallel 4 - echo "DEPTHAI_INSTALLATION_DIR=$PWD/build_core/install/" >> $GITHUB_ENV - - name: Append build hash if not a tagged commit if: startsWith(github.ref, 'refs/tags/v') != true run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV @@ -529,12 +523,6 @@ jobs: - name: Specify docstring to use while building the wheel run: echo "DEPTHAI_PYTHON_DOCSTRINGS_INPUT=$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" >> $GITHUB_ENV - - name: Build and install depthai-core - run: | - cmake -S . -B build_core -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$PWD/cmake/toolchain/pic.cmake - cmake --build build_core --target install --parallel 4 - echo "DEPTHAI_INSTALLATION_DIR=$PWD/build_core/install/" >> $GITHUB_ENV - - name: Append build hash if not a tagged commit if: startsWith(github.ref, 'refs/tags/v') != true run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV diff --git a/cmake/ports/pybind11/portfile.cmake b/cmake/ports/pybind11/portfile.cmake index 11203bf843..e28582eab7 100644 --- a/cmake/ports/pybind11/portfile.cmake +++ b/cmake/ports/pybind11/portfile.cmake @@ -1,9 +1,9 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH - REPO pybind/pybind11 - REF 2e6d06d3f4d78a9c7c22a38955079a5b347fa6de - SHA512 6068594efd1446a4835f3b6ea8d49ff648d339ef88ca8cac41c7f03e7fd83d2378baf3bbe75d3f1a83bb4d5a163a75332f50df8d64de0d6f8965e89c718334a9 - HEAD_REF smart_holder + REPO luxonis/pybind11 + REF f760e2b984b66be2cfa202c93da9d341a557fb5d + SHA512 8baad5c326553075926901b9e2d5fcb574d298b382f17ba8ae0abf022fe3c92f4704b4a3fdce9b63d12ef31a436afc04d11a2050639f254be886a88d201a8b85 + HEAD_REF luxonis-smart-holder ) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" From 6c17ad45e28f0952b2e6080f737766c25d7163d5 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 12 Nov 2024 16:12:57 +0100 Subject: [PATCH 058/131] move ssl options --- CMakeLists.txt | 50 +++++++++++++++++++++----------------------------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bf687baa5..bc07bf683f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,28 @@ else() endif() endif() +option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT}) +if(DEPTHAI_ENABLE_CURL) + list(APPEND VCPKG_MANIFEST_FEATURES "curl-support") +endif() + + +option(DEPTHAI_ENABLE_PROTOBUF "Enable Protobuf support" ON) +if(DEPTHAI_ENABLE_PROTOBUF) + list(APPEND VCPKG_MANIFEST_FEATURES "protobuf-support") +endif() + + +# Set to use native tls for windows before including Hunter (used for Curl) +if(WIN32) + set(DEPTHAI_CURL_USE_SCHANNEL ON) + set(DEPTHAI_CURL_USE_OPENSSL OFF) + add_compile_definitions(NOMINMAX) +else() + set(DEPTHAI_CURL_USE_SCHANNEL OFF) + set(DEPTHAI_CURL_USE_OPENSSL ON) +endif() # Check if on 32 bit linux - default without CURL support if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND UNIX) set(DEPTHAI_DEFAULT_CURL_SUPPORT OFF) @@ -72,34 +93,7 @@ if(NOT WIN32) endif() -# Set to use native tls for windows before including Hunter (used for Curl) -if(WIN32) - set(DEPTHAI_CURL_USE_SCHANNEL ON) - set(DEPTHAI_CURL_USE_OPENSSL OFF) - add_compile_definitions(NOMINMAX) -else() - set(DEPTHAI_CURL_USE_SCHANNEL OFF) - set(DEPTHAI_CURL_USE_OPENSSL ON) -endif() - -# Check if on 32 bit linux - default without CURL support -if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND UNIX) - set(DEPTHAI_DEFAULT_CURL_SUPPORT OFF) -else() - set(DEPTHAI_DEFAULT_CURL_SUPPORT ON) -endif() - -option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT}) - -if(DEPTHAI_ENABLE_CURL) - list(APPEND VCPKG_MANIFEST_FEATURES "curl-support") -endif() - -option(DEPTHAI_ENABLE_PROTOBUF "Enable Protobuf support" ON) -if(DEPTHAI_ENABLE_PROTOBUF) - list(APPEND VCPKG_MANIFEST_FEATURES "protobuf-support") -endif() if(DEPTHAI_ENABLE_PROTOBUF) option(DEPTHAI_ENABLE_REMOTE_CONNECTION "Enable Remote Connection support" ON) @@ -136,8 +130,6 @@ else() message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}") endif() - - # Move binary dir if windows, to shorten the path if(WIN32) set(HUNTER_BINARY_DIR "${HUNTER_GATE_ROOT}/_bin" CACHE STRING "Hunter binary directory") From 91ac59199a51af9210ab313bf3e24cef1567609f Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 12 Nov 2024 16:17:34 +0100 Subject: [PATCH 059/131] remove double include --- CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc07bf683f..837c0dea90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,6 @@ if(DEPTHAI_ENABLE_LIBUSB) else() list(APPEND VCPKG_MANIFEST_FEATURES "xlink") endif() -include(cmake/vcpkg.cmake) # CMP0074 dictates that find_package searches environment variable "[packageName]_ROOT" along with regular variable [packageName]_ROOT if(POLICY CMP0074) @@ -93,8 +92,6 @@ if(NOT WIN32) endif() - - if(DEPTHAI_ENABLE_PROTOBUF) option(DEPTHAI_ENABLE_REMOTE_CONNECTION "Enable Remote Connection support" ON) else() From 355ce2863f23300000a2d1cf29f85e27b03b69d7 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 13 Nov 2024 08:13:06 +0100 Subject: [PATCH 060/131] fp16 from mainstream --- cmake/ports/fp16/portfile.cmake | 18 ------------------ cmake/ports/fp16/vcpkg.json | 17 ----------------- vcpkg-configuration.json | 2 +- 3 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 cmake/ports/fp16/portfile.cmake delete mode 100644 cmake/ports/fp16/vcpkg.json diff --git a/cmake/ports/fp16/portfile.cmake b/cmake/ports/fp16/portfile.cmake deleted file mode 100644 index 36509359b9..0000000000 --- a/cmake/ports/fp16/portfile.cmake +++ /dev/null @@ -1,18 +0,0 @@ - - -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO luxonis/FP16 - REF c911175d2717e562976e606c6e5f799bf40cf94e - SHA512 4b892070e43dbaac3a457996981e4a9b6a0faaf7703d99f5f515604d8dcb2ff90c037c2660e36f68bdbb3481cb0fad5d2d7adf564ab19cefa420ee3f84bda4b6 - HEAD_REF master -) -vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -DFP16_BUILD_BENCHMARKS=OFF - -DFP16_BUILD_TESTS=OFF -) - -vcpkg_cmake_install() - diff --git a/cmake/ports/fp16/vcpkg.json b/cmake/ports/fp16/vcpkg.json deleted file mode 100644 index 3d82078248..0000000000 --- a/cmake/ports/fp16/vcpkg.json +++ /dev/null @@ -1,17 +0,0 @@ - - -{ - "name": "fp16", - "version-string": "luxonis-0.0.0", - "description": "Conversion to/from half-precision floating point formats", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - } -] -} diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index 3b4eb71782..a27db75cf2 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -1,7 +1,7 @@ { "default-registry": { "kind": "git", - "baseline": "10b7a178346f3f0abef60cecd5130e295afd8da4", + "baseline": "509f71e53f45e46c13fa7935d2f6a45803580c07", "repository": "https://github.com/microsoft/vcpkg" }, "registries": [ From 8d5a65cec3fecae1275aea499597c346a6c3bb89 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 13 Nov 2024 09:13:10 +0100 Subject: [PATCH 061/131] Revert "fp16 from mainstream" This reverts commit 355ce2863f23300000a2d1cf29f85e27b03b69d7. --- cmake/ports/fp16/portfile.cmake | 18 ++++++++++++++++++ cmake/ports/fp16/vcpkg.json | 17 +++++++++++++++++ vcpkg-configuration.json | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 cmake/ports/fp16/portfile.cmake create mode 100644 cmake/ports/fp16/vcpkg.json diff --git a/cmake/ports/fp16/portfile.cmake b/cmake/ports/fp16/portfile.cmake new file mode 100644 index 0000000000..36509359b9 --- /dev/null +++ b/cmake/ports/fp16/portfile.cmake @@ -0,0 +1,18 @@ + + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO luxonis/FP16 + REF c911175d2717e562976e606c6e5f799bf40cf94e + SHA512 4b892070e43dbaac3a457996981e4a9b6a0faaf7703d99f5f515604d8dcb2ff90c037c2660e36f68bdbb3481cb0fad5d2d7adf564ab19cefa420ee3f84bda4b6 + HEAD_REF master +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DFP16_BUILD_BENCHMARKS=OFF + -DFP16_BUILD_TESTS=OFF +) + +vcpkg_cmake_install() + diff --git a/cmake/ports/fp16/vcpkg.json b/cmake/ports/fp16/vcpkg.json new file mode 100644 index 0000000000..3d82078248 --- /dev/null +++ b/cmake/ports/fp16/vcpkg.json @@ -0,0 +1,17 @@ + + +{ + "name": "fp16", + "version-string": "luxonis-0.0.0", + "description": "Conversion to/from half-precision floating point formats", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } +] +} diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index a27db75cf2..3b4eb71782 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -1,7 +1,7 @@ { "default-registry": { "kind": "git", - "baseline": "509f71e53f45e46c13fa7935d2f6a45803580c07", + "baseline": "10b7a178346f3f0abef60cecd5130e295afd8da4", "repository": "https://github.com/microsoft/vcpkg" }, "registries": [ From 27d1b7f536d145a5c1e05d5cf7eb9b330b025c0a Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 13 Nov 2024 09:18:46 +0100 Subject: [PATCH 062/131] libarchive update --- cmake/ports/libarchive/vcpkg.json | 8 ++++++++ vcpkg-configuration.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/ports/libarchive/vcpkg.json b/cmake/ports/libarchive/vcpkg.json index 4fbe1ed393..0e4e13dd0d 100644 --- a/cmake/ports/libarchive/vcpkg.json +++ b/cmake/ports/libarchive/vcpkg.json @@ -13,6 +13,14 @@ }, "zlib" ], + "default-features": [ + "bzip2", + "crypto", + "libxml2", + "lz4", + "lzma", + "zstd" + ], "features": { "bzip2": { "description": "BZip2 support", diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index 3b4eb71782..a27db75cf2 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -1,7 +1,7 @@ { "default-registry": { "kind": "git", - "baseline": "10b7a178346f3f0abef60cecd5130e295afd8da4", + "baseline": "509f71e53f45e46c13fa7935d2f6a45803580c07", "repository": "https://github.com/microsoft/vcpkg" }, "registries": [ From a7a1fe42e78af59a692536923bc3e8d25e422a53 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 13 Nov 2024 11:32:38 +0100 Subject: [PATCH 063/131] update foxglove module --- 3rdparty/foxglove/ws-protocol | 2 +- CMakeLists.txt | 11 ++++++----- vcpkg.json | 13 ++++++++----- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/3rdparty/foxglove/ws-protocol b/3rdparty/foxglove/ws-protocol index b3f9f9b052..db02aacb1b 160000 --- a/3rdparty/foxglove/ws-protocol +++ b/3rdparty/foxglove/ws-protocol @@ -1 +1 @@ -Subproject commit b3f9f9b052d68f7934817d8efb690eec737f48a4 +Subproject commit db02aacb1b1ca1cd34a0f09f2276008050170ae4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 837c0dea90..5483614f10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,11 +31,6 @@ else() endif() endif() -option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT}) - -if(DEPTHAI_ENABLE_CURL) - list(APPEND VCPKG_MANIFEST_FEATURES "curl-support") -endif() option(DEPTHAI_ENABLE_PROTOBUF "Enable Protobuf support" ON) @@ -59,6 +54,11 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND UNIX) else() set(DEPTHAI_DEFAULT_CURL_SUPPORT ON) endif() +option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT}) + +if(DEPTHAI_ENABLE_CURL) + list(APPEND VCPKG_MANIFEST_FEATURES "curl-support") +endif() # Early options option(DEPTHAI_ENABLE_LIBUSB "Enable usage of libusb and interaction with USB devices" ON) @@ -720,6 +720,7 @@ if(DEPTHAI_CLANG_FORMAT) target_clangformat_setup(${TARGET_CORE_NAME} "${header_dirs}") endif() +find_package(OpenSSL REQUIRED) # link libraries target_link_libraries(${TARGET_CORE_NAME} PUBLIC diff --git a/vcpkg.json b/vcpkg.json index 40e7f1d10a..17df9e5e73 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,9 +1,6 @@ { "name": "depthai", "dependencies": [ - "websocketpp", - "protobuf", - "openssl", "cpp-httplib", "libpng", "tiff", @@ -11,10 +8,8 @@ "nlohmann-json", "spdlog", "zlib", - "spdlog", "bzip2", "lz4", - "libarchive", "liblzma", "fp16", "mp4v2", @@ -22,6 +17,14 @@ "neargye-semver", "pybind11", "catch2", + { + "name": "libarchive", + "default-features": false + }, + { + "name": "opencv", + "default-features": false + }, { "name": "opencv4", "default-features": false From 20c504f376701852156be1a11039a258623bd3a3 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 14 Nov 2024 09:50:25 +0100 Subject: [PATCH 064/131] fmt 11, highgui opencv component --- CMakeLists.txt | 2 +- cmake/ports/spdlog/portfile.cmake | 20 -------------------- cmake/ports/spdlog/vcpkg.json | 17 ----------------- src/device/DeviceBase.cpp | 1 + src/utility/spdlog-fmt.hpp | 22 +++++++++++++++++++++- 5 files changed, 23 insertions(+), 39 deletions(-) delete mode 100644 cmake/ports/spdlog/portfile.cmake delete mode 100644 cmake/ports/spdlog/vcpkg.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 5483614f10..d2fdd42295 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -275,7 +275,7 @@ set(TARGET_OPENCV_NAME ${PROJECT_NAME}-opencv) set(TARGET_OPENCV_ALIAS opencv) if(DEPTHAI_OPENCV_SUPPORT) # Check if required libraries are available - set(REQUIRED_OPENCV_LIBRARIES "opencv_core" "opencv_imgproc" "opencv_videoio") + set(REQUIRED_OPENCV_LIBRARIES "opencv_core" "opencv_imgproc" "opencv_videoio" "opencv_highgui") set(OPENCV_SUPPORT_AVAILABLE ${OpenCV_FOUND}) foreach(lib ${REQUIRED_OPENCV_LIBRARIES}) if(NOT (lib IN_LIST OpenCV_LIBS)) diff --git a/cmake/ports/spdlog/portfile.cmake b/cmake/ports/spdlog/portfile.cmake deleted file mode 100644 index 18616e9b22..0000000000 --- a/cmake/ports/spdlog/portfile.cmake +++ /dev/null @@ -1,20 +0,0 @@ - - -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO gabime/spdlog - REF de0dbfa3596a18cd70a4619b6a9766847a941276 - SHA512 3157cb8769df2e01f89d4f376f71f3a50b28956467978d80d5ec32f9004a3edcbec2ea1969a420a900b326972e534484001297bd7db7e27488108c57d88e1627 - HEAD_REF master -) -vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -DSPDLOG_BUILD_EXAMPLE=OFF - -DSPDLOG_FMT_EXTERNAL=OFF - -DCMAKE_CXX_VISIBILITY_PRESET=hidden - -DCMAKE_C_VISIBILITY_PRESET=hidden -) - -vcpkg_cmake_install() - diff --git a/cmake/ports/spdlog/vcpkg.json b/cmake/ports/spdlog/vcpkg.json deleted file mode 100644 index 6a4d2e407c..0000000000 --- a/cmake/ports/spdlog/vcpkg.json +++ /dev/null @@ -1,17 +0,0 @@ - - -{ - "name": "spdlog", - "version-string": "0.11.2", - "description": "Fast C++ logging library.", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - } -] -} diff --git a/src/device/DeviceBase.cpp b/src/device/DeviceBase.cpp index ee82e24ec6..7594541226 100644 --- a/src/device/DeviceBase.cpp +++ b/src/device/DeviceBase.cpp @@ -45,6 +45,7 @@ #include "spdlog/spdlog.h" #include "utility/LogCollection.hpp" #include "utility/Logging.hpp" +#include "utility/spdlog-fmt.hpp" namespace dai { diff --git a/src/utility/spdlog-fmt.hpp b/src/utility/spdlog-fmt.hpp index f1d5cf2c6e..3a56f1f50a 100755 --- a/src/utility/spdlog-fmt.hpp +++ b/src/utility/spdlog-fmt.hpp @@ -4,6 +4,13 @@ #include "depthai/utility/Path.hpp" +#if FMT_VERSION >= 100000 +#include + +#include "depthai/common/CameraBoardSocket.hpp" +#include "pipeline/datatype/DatatypeEnum.hpp" +#endif + namespace dai { namespace utility { static constexpr char path_convert_err[] = ""; @@ -15,7 +22,7 @@ struct fmt::formatter : formatter { // https://fmt.dev/latest/api.html#formatting-user-defined-types // https://fmt.dev/latest/syntax.html#format-specification-mini-language template - auto format(const dai::Path& p, FormatContext& ctx) { + auto format(const dai::Path& p, FormatContext& ctx) const { std::string output; try { output = p.string(); @@ -25,3 +32,16 @@ struct fmt::formatter : formatter { return formatter::format(output, ctx); } }; + + +#if FMT_VERSION >= 100000 +template <> +struct fmt::formatter : ostream_formatter {}; + +template <> +struct fmt::formatter : fmt::formatter { + auto format(dai::DatatypeEnum my, format_context& ctx) const -> decltype(ctx.out()) { + return fmt::format_to(ctx.out(), "{}", static_cast(my)); + } +}; +#endif From fa6b3f0ad84d821959b23da1008f6304d8b594ac Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 14 Nov 2024 10:40:06 +0100 Subject: [PATCH 065/131] xlink windows patch, revert spdlog --- CMakePresets.json | 5 +-- cmake/ports/spdlog/portfile.cmake | 18 +++++++++ cmake/ports/spdlog/vcpkg.json | 15 +++++++ cmake/ports/xlink/portfile.cmake | 1 + cmake/ports/xlink/windows.patch | 67 +++++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 cmake/ports/spdlog/portfile.cmake create mode 100644 cmake/ports/spdlog/vcpkg.json create mode 100644 cmake/ports/xlink/windows.patch diff --git a/CMakePresets.json b/CMakePresets.json index 04adf83eb4..a72756f85b 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,12 +1,11 @@ { - "version": 2, + "version": 3, "configurePresets": [ { "name": "default", "binaryDir": "${sourceDir}/build", "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", - "VCPKG_INSTALL_OPTIONS": "--clean-buildtrees-after-build;--clean-packages-after-build" + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" } } ] diff --git a/cmake/ports/spdlog/portfile.cmake b/cmake/ports/spdlog/portfile.cmake new file mode 100644 index 0000000000..e0e7ff4d52 --- /dev/null +++ b/cmake/ports/spdlog/portfile.cmake @@ -0,0 +1,18 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO gabime/spdlog + REF de0dbfa3596a18cd70a4619b6a9766847a941276 + SHA512 3157cb8769df2e01f89d4f376f71f3a50b28956467978d80d5ec32f9004a3edcbec2ea1969a420a900b326972e534484001297bd7db7e27488108c57d88e1627 + HEAD_REF master +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DSPDLOG_BUILD_EXAMPLE=OFF + -DSPDLOG_FMT_EXTERNAL=OFF + -DCMAKE_CXX_VISIBILITY_PRESET=hidden + -DCMAKE_C_VISIBILITY_PRESET=hidden +) + +vcpkg_cmake_install() + diff --git a/cmake/ports/spdlog/vcpkg.json b/cmake/ports/spdlog/vcpkg.json new file mode 100644 index 0000000000..f8905491d6 --- /dev/null +++ b/cmake/ports/spdlog/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "spdlog", + "version-string": "0.11.2", + "description": "Fast C++ logging library.", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } +] +} diff --git a/cmake/ports/xlink/portfile.cmake b/cmake/ports/xlink/portfile.cmake index c9c25f88fd..455b754634 100644 --- a/cmake/ports/xlink/portfile.cmake +++ b/cmake/ports/xlink/portfile.cmake @@ -6,6 +6,7 @@ vcpkg_from_github( HEAD_REF develop_server PATCHES hunter.patch + windows.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES diff --git a/cmake/ports/xlink/windows.patch b/cmake/ports/xlink/windows.patch new file mode 100644 index 0000000000..0c2567fd2c --- /dev/null +++ b/cmake/ports/xlink/windows.patch @@ -0,0 +1,67 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 873cd8c..3806520 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -66,13 +66,18 @@ if(is_multi_config) + set_target_properties(${TARGET_NAME} PROPERTIES DEBUG_POSTFIX "d") + endif() + ++# Define export header to support shared library on Windows ++include(GenerateExportHeader) ++generate_export_header(${TARGET_NAME} ++ EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}Export.h) ++ + # Add dependencies + include(cmake/XLinkDependencies.cmake) + + if(XLINK_ENABLE_LIBUSB) + if(XLINK_LIBUSB_SYSTEM) + # Find system libusb +- find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h PATH_SUFFIXES "include" "libusb" "libusb-1.0") ++ find_path(LIBUSB_INCLUDE_DIR NAMES "libusb-1.0/libusb.h") + find_library(LIBUSB_LIBRARY NAMES usb-1.0 PATH_SUFFIXES "lib") + if(NOT LIBUSB_INCLUDE_DIR OR NOT LIBUSB_LIBRARY) + message(FATAL_ERROR "libusb is required") +@@ -129,6 +134,7 @@ add_library(${TARGET_PUBLIC_NAME} INTERFACE) + target_include_directories(${TARGET_PUBLIC_NAME} INTERFACE + "$" + "$" ++ "$" + ) + + # Link to headers (public, as itself also needs the headers) +@@ -233,6 +239,11 @@ install( + ) + #Install include folder + install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ++# Install generated export header ++install( ++ FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}Export.h ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/XLink ++) + # Install Hunter dependencies + if(XLINK_ENABLE_LIBUSB) + if(NOT XLINK_LIBUSB_LOCAL AND NOT XLINK_LIBUSB_SYSTEM) +diff --git a/include/XLink/XLinkLog.h b/include/XLink/XLinkLog.h +index e487c71..7e1ccb3 100644 +--- a/include/XLink/XLinkLog.h ++++ b/include/XLink/XLinkLog.h +@@ -29,6 +29,7 @@ extern "C" { + #include + #include + #include ++#include "XLinkExport.h" + + #ifndef _GNU_SOURCE + #define _GNU_SOURCE +@@ -72,8 +73,8 @@ FUNCATTR_WEAK mvLog_t __attribute__ ((weak)) MVLOGLEVEL(MVLOG_UNIT_NAME) = MVLOG + #define UNIT_NAME_STR MVLOG_STR(MVLOG_UNIT_NAME) + + +-extern mvLog_t MVLOGLEVEL(global); +-extern mvLog_t MVLOGLEVEL(default); ++extern XLINK_EXPORT mvLog_t MVLOGLEVEL(global); ++extern XLINK_EXPORT mvLog_t MVLOGLEVEL(default); + + int __attribute__ ((unused)) logprintf(mvLog_t curLogLvl, mvLog_t lvl, const char * func, const int line, const char * format, ...); + From ac585c6a3bfd92706408304b6cc1cde88ba93f9b Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 14 Nov 2024 10:54:32 +0100 Subject: [PATCH 066/131] fix lower fmt version --- src/utility/spdlog-fmt.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utility/spdlog-fmt.hpp b/src/utility/spdlog-fmt.hpp index 3a56f1f50a..2a8cdf44fd 100755 --- a/src/utility/spdlog-fmt.hpp +++ b/src/utility/spdlog-fmt.hpp @@ -22,7 +22,11 @@ struct fmt::formatter : formatter { // https://fmt.dev/latest/api.html#formatting-user-defined-types // https://fmt.dev/latest/syntax.html#format-specification-mini-language template +#if FMT_VERSION >= 100000 auto format(const dai::Path& p, FormatContext& ctx) const { +#else + auto format(const dai::Path& p, FormatContext& ctx) -> decltype(ctx.out()) { +#endif std::string output; try { output = p.string(); From 174db6860330d1b0e76bd73759b04690c01bf6b8 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 14 Nov 2024 11:07:05 +0100 Subject: [PATCH 067/131] windows link patch for xlink --- cmake/ports/xlink/portfile.cmake | 1 + cmake/ports/xlink/windows-link.patch | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 cmake/ports/xlink/windows-link.patch diff --git a/cmake/ports/xlink/portfile.cmake b/cmake/ports/xlink/portfile.cmake index 455b754634..d1effdfb42 100644 --- a/cmake/ports/xlink/portfile.cmake +++ b/cmake/ports/xlink/portfile.cmake @@ -7,6 +7,7 @@ vcpkg_from_github( PATCHES hunter.patch windows.patch + windows-link.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES diff --git a/cmake/ports/xlink/windows-link.patch b/cmake/ports/xlink/windows-link.patch new file mode 100644 index 0000000000..1de3e1318a --- /dev/null +++ b/cmake/ports/xlink/windows-link.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3806520..43dcfde 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -92,11 +92,14 @@ if(XLINK_ENABLE_LIBUSB) + # Link to CMake libusb + target_link_libraries(${TARGET_NAME} PRIVATE usb-1.0) + if(WIN32 AND NOT MINGW) +- target_link_libraries(${TARGET_NAME} PRIVATE delayimp.lib Pathcch.lib) ++ target_link_libraries(${TARGET_NAME} PRIVATE delayimp.lib) + # workaround https://gitlab.kitware.com/cmake/cmake/-/issues/20022 + target_link_options(${TARGET_NAME} PUBLIC "$:d>.dll>") + endif() + endif() ++ if(WIN32 AND NOT MINGW) ++ target_link_libraries(${TARGET_NAME} PRIVATE Pathcch.lib) ++ endif() + + # Add compile define stating a local libusb usage + if(XLINK_LIBUSB_LOCAL) From 042107f1707880c1da62b6e11c8532ce4b9f6a02 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 14 Nov 2024 14:38:12 +0100 Subject: [PATCH 068/131] some debug prints --- bindings/python/generate_stubs.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bindings/python/generate_stubs.py b/bindings/python/generate_stubs.py index 5bd0d2cc31..b7235e8b3d 100644 --- a/bindings/python/generate_stubs.py +++ b/bindings/python/generate_stubs.py @@ -111,7 +111,7 @@ file.write(final_stubs) # Flush previous stdout - sys.stdout.flush() + # sys.stdout.flush() # Check syntax (Mypy and later Pylance/Pyright) # Windows limitation - another process cannot normally read temporary file that is opened by this process @@ -124,16 +124,19 @@ # Mypy check subprocess.check_call([sys.executable, '-m' 'mypy', f'{DIRECTORY}/{MODULE_NAME}', f'--config-file={config.name}'], env=env) finally: + print(f'Deleting file: {config.name}') os.unlink(config.name) - + print(f'Mypy config file deleted: {config.name}') # # TODO(thamarpe) - Pylance / Pyright check # subprocess.check_call([sys.executable, '-m' 'pyright', f'{DIRECTORY}/{MODULE_NAME}'], env=env) def process_init_pyi(file_path, is_depthai_root=False): # Read old __init__.pyi + print(f'Processing {file_path}') with open(file_path, 'r+') as file: contents = file.read() + print(f'Processing {file_path}') # Prepare imports dir_path = os.path.dirname(file_path) @@ -161,7 +164,9 @@ def process_init_pyi(file_path, is_depthai_root=False): is_depthai_root = (root == f'{DIRECTORY}/{MODULE_NAME}') process_init_pyi(os.path.join(root, '__init__.pyi'), is_depthai_root) + print("Fin") except subprocess.CalledProcessError as err: exit(err.returncode) +print("Done") exit(0) From 63f541fd58ec705a9770f0fea1fcaa234dd14487 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 14 Nov 2024 15:53:56 +0100 Subject: [PATCH 069/131] try with timeouts --- bindings/python/generate_stubs.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bindings/python/generate_stubs.py b/bindings/python/generate_stubs.py index b7235e8b3d..ebebe71de7 100644 --- a/bindings/python/generate_stubs.py +++ b/bindings/python/generate_stubs.py @@ -15,6 +15,7 @@ print(f'Generating stubs for module: "{MODULE_NAME}" in directory: "{DIRECTORY}"') +sys.stdout.flush() try: # Create stubs, add PYTHONPATH to find the build module @@ -31,16 +32,16 @@ print(f'PYTHONPATH set to {env["PYTHONPATH"]}') # Check if stubgen has the `--include-docstrings` flag includeDocstrings = False - output = subprocess.check_output(['stubgen', '--help'], env=env) + output = subprocess.check_output(['stubgen', '--help'], env=env, timeout=5) if b'--include-docstrings' in output: includeDocstrings = True print("Will include docstrings in stubs") else: print("Will not include docstrings in stubs") - parameters = ['stubgen', '-p', MODULE_NAME, '-o', f'{DIRECTORY}'] + parameters = ['stubgen', '-v', '-p', MODULE_NAME, '-o', f'{DIRECTORY}'] if includeDocstrings: parameters.insert(1, '--include-docstrings') - subprocess.check_call(parameters, cwd=DIRECTORY, env=env) + subprocess.check_call(parameters, cwd=DIRECTORY, env=env, timeout=5) # Add py.typed open(f'{DIRECTORY}/depthai/py.typed', 'a').close() @@ -122,7 +123,7 @@ config.close() print(f'Mypy config file: {config.name}') # Mypy check - subprocess.check_call([sys.executable, '-m' 'mypy', f'{DIRECTORY}/{MODULE_NAME}', f'--config-file={config.name}'], env=env) + subprocess.check_call([sys.executable, '-m' 'mypy', f'{DIRECTORY}/{MODULE_NAME}', f'--config-file={config.name}'], env=env, timeout=5) finally: print(f'Deleting file: {config.name}') os.unlink(config.name) @@ -168,5 +169,6 @@ def process_init_pyi(file_path, is_depthai_root=False): except subprocess.CalledProcessError as err: exit(err.returncode) -print("Done") -exit(0) +finally: + print("Done") + exit(0) From a8c267f57405e834600723800a97b6d2a8fe2054 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 14 Nov 2024 16:35:20 +0100 Subject: [PATCH 070/131] comment out resource bindings for now --- bindings/python/src/utility/ResourcesBindings.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bindings/python/src/utility/ResourcesBindings.cpp b/bindings/python/src/utility/ResourcesBindings.cpp index 0c87866ce0..49740ffef9 100644 --- a/bindings/python/src/utility/ResourcesBindings.cpp +++ b/bindings/python/src/utility/ResourcesBindings.cpp @@ -8,10 +8,10 @@ void ResourcesBindings::bind(pybind11::module& m, void* pCallstack){ using namespace dai; // Bind Resources (if needed) - py::class_>(m, "Resources") - .def(py::init([](){ - return std::unique_ptr>(&Resources::getInstance()); - }); + // py::class_>(m, "Resources") + // .def(py::init([](){ + // return std::unique_ptr>(&Resources::getInstance()); + // }); } From 4153d0a32daa16657898d0c831e16d507eafdf03 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 14 Nov 2024 17:15:08 +0100 Subject: [PATCH 071/131] try adding conditions in resources --- src/utility/Resources.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utility/Resources.cpp b/src/utility/Resources.cpp index 303de2797a..574b77ee8a 100644 --- a/src/utility/Resources.cpp +++ b/src/utility/Resources.cpp @@ -463,8 +463,12 @@ Resources::Resources() { Resources::~Resources() { // join the lazy threads +#ifdef DEPTHAI_ENABLE_DEVICE_FW if(lazyThreadDevice.joinable()) lazyThreadDevice.join(); +#endif +#ifdef DEPTHAI_ENABLE_DEVICE_BOOTLOADER_FW if(lazyThreadBootloader.joinable()) lazyThreadBootloader.join(); +#endif } // Get device firmware From 110fe3b7d68b437d97333d18164c91f91b8d4b1a Mon Sep 17 00:00:00 2001 From: Serafadam Date: Fri, 15 Nov 2024 10:53:10 +0100 Subject: [PATCH 072/131] comment out resource preload in depthai initialization --- src/utility/Initialization.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utility/Initialization.cpp b/src/utility/Initialization.cpp index 76c5581c1d..73a3048431 100644 --- a/src/utility/Initialization.cpp +++ b/src/utility/Initialization.cpp @@ -103,7 +103,7 @@ bool initialize(const char* additionalInfo, bool installSignalHandler, void* jav // Executed at library load time // Preload Resources (getting instance causes some internal lazy loading to start) - Resources::getInstance(); + // Resources::getInstance(); // Static global handler static XLinkGlobalHandler_t xlinkGlobalHandler = {}; From 02947c5c701e98c6d71e725e355a4d99dd53ba76 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Fri, 15 Nov 2024 11:46:22 +0100 Subject: [PATCH 073/131] typo in manylinux arm --- .github/workflows/python-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 521105c2d1..dc5a16193d 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -479,7 +479,7 @@ jobs: container: image: quay.io/pypa/manylinux_2_28_aarch64 env: - PLAT: manylinux_2_28_aarch66 + PLAT: manylinux_2_28_aarch64 # Mount local hunter cache directory, instead of transfering to Github and back volumes: - /.hunter:/github/home/.hunter From 1e0cd9876e265ff279f5bc0e542f3a2867ff218e Mon Sep 17 00:00:00 2001 From: Serafadam Date: Fri, 15 Nov 2024 13:25:48 +0100 Subject: [PATCH 074/131] try ci with pcl and rtabmap --- .github/workflows/python-main.yml | 13 +++++++------ bindings/python/src/utility/ResourcesBindings.cpp | 8 ++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index dc5a16193d..ec8f419619 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -205,6 +205,8 @@ jobs: fail-fast: false env: DEPTHAI_BUILD_BASALT: OFF + DEPTHAI_BUILD_PCL: ON + DEPTHAI_BUILD_RTABMAP: ON VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" steps: - name: Cache .hunter folder @@ -261,19 +263,18 @@ jobs: # This job builds wheels for macOS arch build-macos: needs: build-docstrings - env: - VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" strategy: matrix: python-version: [3.8, 3.9, '3.10', '3.11', '3.12'] os: [macos-13, macos-14] # macos-13 is x64, macos-14 is arm64 fail-fast: false runs-on: ${{ matrix.os }} - # env: + env: + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" # TODO(Morato) - re-enable basalt, pcl, rtabmap after everything is ported - # DEPTHAI_BUILD_BASALT: ON - # DEPTHAI_BUILD_PCL: ON - # DEPTHAI_BUILD_RTABMAP: ON + DEPTHAI_BUILD_BASALT: ON + DEPTHAI_BUILD_PCL: ON + DEPTHAI_BUILD_RTABMAP: ON steps: - name: Cache .hunter folder uses: actions/cache@v3 diff --git a/bindings/python/src/utility/ResourcesBindings.cpp b/bindings/python/src/utility/ResourcesBindings.cpp index 49740ffef9..0c87866ce0 100644 --- a/bindings/python/src/utility/ResourcesBindings.cpp +++ b/bindings/python/src/utility/ResourcesBindings.cpp @@ -8,10 +8,10 @@ void ResourcesBindings::bind(pybind11::module& m, void* pCallstack){ using namespace dai; // Bind Resources (if needed) - // py::class_>(m, "Resources") - // .def(py::init([](){ - // return std::unique_ptr>(&Resources::getInstance()); - // }); + py::class_>(m, "Resources") + .def(py::init([](){ + return std::unique_ptr>(&Resources::getInstance()); + }); } From 804845654c9f33f345c2d320648682cf2ced9d91 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Fri, 15 Nov 2024 14:07:06 +0100 Subject: [PATCH 075/131] basalt on windows --- .github/workflows/python-main.yml | 2 +- cmake/ports/basalt/portfile.cmake | 2 ++ cmake/ports/basalt/win.patch | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 cmake/ports/basalt/win.patch diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index ec8f419619..fa147b32a8 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -204,7 +204,7 @@ jobs: python-architecture: [x64] # TODO(Morato) - re-enable x86 - it complains that OpenCV even though it's 32 bit is not compatible fail-fast: false env: - DEPTHAI_BUILD_BASALT: OFF + DEPTHAI_BUILD_BASALT: ON DEPTHAI_BUILD_PCL: ON DEPTHAI_BUILD_RTABMAP: ON VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" diff --git a/cmake/ports/basalt/portfile.cmake b/cmake/ports/basalt/portfile.cmake index f1f9838edd..aa6e555c9b 100644 --- a/cmake/ports/basalt/portfile.cmake +++ b/cmake/ports/basalt/portfile.cmake @@ -5,6 +5,8 @@ vcpkg_from_github( REF ac3cd0fbef91e889db27a1a779a5105ba715fef7 SHA512 1e7694168f92af5f48f462a793fff528c46a4bd01d3417daf2031b651acba70ee9d61d38a33a1be217cc6e97baa67425e1a8fcc4e57a46033954757112326206 HEAD_REF deps_test + PATCHES + win.patch ) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" diff --git a/cmake/ports/basalt/win.patch b/cmake/ports/basalt/win.patch new file mode 100644 index 0000000000..dad1b28a79 --- /dev/null +++ b/cmake/ports/basalt/win.patch @@ -0,0 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4094b79..128e56b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -76,7 +76,6 @@ set(CMAKE_CXX_EXTENSIONS OFF) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +- + # Flags used for CHECK_CXX_SOURCE_COMPILES + set(CMAKE_REQUIRED_FLAGS "-Wno-error") + +@@ -104,6 +103,10 @@ endif() + # base set of compile flags + set (BASALT_CXX_FLAGS) + ++if(WIN32) ++set (BASALT_CXX_FLAGS "/bigobj") ++endif() ++ + # For avoiding libfmt >9 issues, see https://github.com/strasdat/Sophus/issues/366 #issuecomment-1229178088 + add_definitions(-DFMT_DEPRECATED_OSTREAM=1) + + From 2dc9bad49df0d3ff0d6fc62374ac4ccf738f22e5 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 18 Nov 2024 13:43:54 +0100 Subject: [PATCH 076/131] remove suitsparse from g2o --- cmake/depthaiDependencies.cmake | 15 +-------------- cmake/ports/g2o/portfile.cmake | 7 ++++--- cmake/ports/g2o/vcpkg.json | 1 - 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake index 1cc50b07f4..d52d53b713 100644 --- a/cmake/depthaiDependencies.cmake +++ b/cmake/depthaiDependencies.cmake @@ -99,6 +99,7 @@ else() endif() # OpenCV 4 - (optional) +message("DEPTHAI_OPENCV_SUPPORT: ${DEPTHAI_OPENCV_SUPPORT}") if(DEPTHAI_OPENCV_SUPPORT) find_package(OpenCV 4 ${_QUIET} CONFIG REQUIRED) endif() @@ -107,20 +108,10 @@ if(DEPTHAI_PCL_SUPPORT AND NOT TARGET JsonCpp::JsonCpp) find_package(jsoncpp) endif() -set(MODULE_TEMP ${CMAKE_MODULE_PATH}) -set(PREFIX_TEMP ${CMAKE_PREFIX_PATH}) -set(CMAKE_MODULE_PATH ${_DEPTHAI_MODULE_PATH_ORIGINAL}) -set(CMAKE_PREFIX_PATH ${_DEPTHAI_PREFIX_PATH_ORIGINAL}) -set(EIGEN_ROOT_TEMP ${EIGEN_ROOT}) -set(EIGEN_ROOT "") -set(CMAKE_FIND_ROOT_PATH_TMP ${CMAKE_FIND_ROOT_PATH}) -set(CMAKE_FIND_ROOT_PATH "") -message("DEPTHAI_OPENCV_SUPPORT: ${DEPTHAI_OPENCV_SUPPORT}") if(DEPTHAI_PCL_SUPPORT) find_package(PCL CONFIG COMPONENTS common) endif() -set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH_TMP}) if(DEPTHAI_RTABMAP_SUPPORT) find_package(RTABMap ${_QUIET} CONFIG REQUIRED COMPONENTS core utilite) find_package(g2o ${_QUIET} CONFIG REQUIRED) @@ -128,10 +119,6 @@ find_package(g2o ${_QUIET} CONFIG REQUIRED) find_package(OpenMP ${_QUIET} REQUIRED) endif() -set(CMAKE_MODULE_PATH ${MODULE_TEMP}) -set(CMAKE_PREFIX_PATH ${PREFIX_TEMP}) -set(EIGEN_ROOT ${EIGEN_ROOT_TEMP}) - if(DEPTHAI_BASALT_SUPPORT) find_package(basalt-headers ${_QUIET} CONFIG REQUIRED) find_package(basalt_sdk ${_QUIET} CONFIG REQUIRED) diff --git a/cmake/ports/g2o/portfile.cmake b/cmake/ports/g2o/portfile.cmake index 4d8da8119a..4e5acf3c74 100644 --- a/cmake/ports/g2o/portfile.cmake +++ b/cmake/ports/g2o/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO RainerKuemmerle/g2o - REF 11440dc477508329775dc79e4cdb572f51336d82 - SHA512 da88b0900e11e60df33dceb00737d2425579601c025e7deec93f5cf3616f36f043799226356d786731d75106da0026786f0cf91feca21b36e31c20107bfb126b + REF fcba4eaca6f20d9a5792404cc8ef303aeb8ba5d2 + SHA512 41e5a6d40db10d66182653d56f937f29264bf4f9412dfa651be949caeb055741c9d9ba75a122180892aafe7d45b334d50470284121148c0561e1d49f6ba5e20a HEAD_REF master ) @@ -12,10 +12,11 @@ file(REMOVE "${SOURCE_PATH}/cmake_modules/FindBLAS.cmake") vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - -DBUILD_LGPL_SHARED_LIBS=${BUILD_LGPL_SHARED_LIBS} + -DBUILD_LGPL_SHARED_LIBS=OFF -DG2O_BUILD_EXAMPLES=OFF -DG2O_BUILD_APPS=OFF -DG2O_USE_OPENGL=OFF + -DG2O_USE_CSPARSE=OFF ) vcpkg_cmake_install() diff --git a/cmake/ports/g2o/vcpkg.json b/cmake/ports/g2o/vcpkg.json index efabcdf092..5483be881b 100644 --- a/cmake/ports/g2o/vcpkg.json +++ b/cmake/ports/g2o/vcpkg.json @@ -8,7 +8,6 @@ "ceres", "eigen3", "lapack", - "suitesparse", { "name": "vcpkg-cmake", "host": true From 19a58310e8f3a1b14b038836dc29687339a8371c Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 18 Nov 2024 14:31:31 +0100 Subject: [PATCH 077/131] g2o opengl patch --- cmake/ports/g2o/opengl.patch | 21 +++++++++++++++++++++ cmake/ports/g2o/portfile.cmake | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 cmake/ports/g2o/opengl.patch diff --git a/cmake/ports/g2o/opengl.patch b/cmake/ports/g2o/opengl.patch new file mode 100644 index 0000000000..010964f857 --- /dev/null +++ b/cmake/ports/g2o/opengl.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a3f66dd..1870723 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -158,6 +158,7 @@ find_package(OpenGL) + + # If OpenGL was found, use the import target if available. If not, use old-style includes + set(G2O_USE_OPENGL ON CACHE BOOL "Build g2o with OpenGL support for visualization") ++set(G2O_HAVE_OPENGL 0) + if (OPENGL_FOUND AND G2O_USE_OPENGL) + if (TARGET OpenGL::GL) + set(G2O_OPENGL_TARGET "OpenGL::GL;OpenGL::GLU") +@@ -165,7 +166,7 @@ if (OPENGL_FOUND AND G2O_USE_OPENGL) + set(G2O_OPENGL_TARGET "${OPENGL_LIBRARIES}") + include_directories(${OPENGL_INCLUDE_DIR}) + endif() +- set (G2O_HAVE_OPENGL 1) ++ set(G2O_HAVE_OPENGL 1) + message(STATUS "Compiling with OpenGL support") + #message(WARNING G2O_OPENGL_TARGET=${G2O_OPENGL_TARGET}) + endif() diff --git a/cmake/ports/g2o/portfile.cmake b/cmake/ports/g2o/portfile.cmake index 4e5acf3c74..c4d4ec76a7 100644 --- a/cmake/ports/g2o/portfile.cmake +++ b/cmake/ports/g2o/portfile.cmake @@ -4,6 +4,8 @@ vcpkg_from_github( REF fcba4eaca6f20d9a5792404cc8ef303aeb8ba5d2 SHA512 41e5a6d40db10d66182653d56f937f29264bf4f9412dfa651be949caeb055741c9d9ba75a122180892aafe7d45b334d50470284121148c0561e1d49f6ba5e20a HEAD_REF master + PATCHES + opengl.patch ) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_LGPL_SHARED_LIBS) From ed6448b7097ec5ff64e1365605781cb0bf05a6d5 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 18 Nov 2024 17:06:08 +0100 Subject: [PATCH 078/131] update g2o gl patch --- cmake/ports/g2o/opengl.patch | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cmake/ports/g2o/opengl.patch b/cmake/ports/g2o/opengl.patch index 010964f857..fcac189d8c 100644 --- a/cmake/ports/g2o/opengl.patch +++ b/cmake/ports/g2o/opengl.patch @@ -19,3 +19,18 @@ index a3f66dd..1870723 100644 message(STATUS "Compiling with OpenGL support") #message(WARNING G2O_OPENGL_TARGET=${G2O_OPENGL_TARGET}) endif() +diff --git a/cmake_modules/Config.cmake.in b/cmake_modules/Config.cmake.in +index d2913a1..ba57e32 100644 +--- a/cmake_modules/Config.cmake.in ++++ b/cmake_modules/Config.cmake.in +@@ -1,7 +1,9 @@ + include(CMakeFindDependencyMacro) + + find_dependency(Eigen3) +-find_dependency(OpenGL) ++if (@G2O_HAVE_OPENGL@) ++ find_dependency(OpenGL) ++endif() + + include("${CMAKE_CURRENT_LIST_DIR}/@G2O_TARGETS_EXPORT_NAME@.cmake") + From ff050fe7f1e6719875a5fcfcad62cc2a275e7840 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 18 Nov 2024 17:22:29 +0100 Subject: [PATCH 079/131] update components on arm ci --- .github/workflows/python-main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index fa147b32a8..8fee68b42b 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -494,9 +494,9 @@ jobs: DEPTHAI_VCPKG_CFLAGS: "-std=c99" # Needed so vpckg can bootstrap itself with the old GCC on the manylinux image VCPKG_FORCE_SYSTEM_BINARIES: "1" # Needed so vpckg can bootstrap itself VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" - # DEPTHAI_BUILD_BASALT: ON - # DEPTHAI_BUILD_PCL: ON - # DEPTHAI_BUILD_RTABMAP: ON + DEPTHAI_BUILD_BASALT: ON + DEPTHAI_BUILD_PCL: ON + DEPTHAI_BUILD_RTABMAP: ON steps: - name: Export GitHub Actions cache environment variables uses: actions/github-script@v7 From 90eb95dea5d3f135ae296c7359094f1d7525e64f Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 18 Nov 2024 18:50:29 +0100 Subject: [PATCH 080/131] remove openmp dep --- cmake/depthaiDependencies.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake index d52d53b713..b23e5809fb 100644 --- a/cmake/depthaiDependencies.cmake +++ b/cmake/depthaiDependencies.cmake @@ -116,7 +116,6 @@ if(DEPTHAI_RTABMAP_SUPPORT) find_package(RTABMap ${_QUIET} CONFIG REQUIRED COMPONENTS core utilite) find_package(g2o ${_QUIET} CONFIG REQUIRED) find_package(Ceres ${_QUIET} CONFIG REQUIRED) -find_package(OpenMP ${_QUIET} REQUIRED) endif() if(DEPTHAI_BASALT_SUPPORT) From dc029aa85b02d290d3fd93ad711dde6774cf8990 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 19 Nov 2024 11:18:08 +0100 Subject: [PATCH 081/131] disable rtabmap on windows and linux arm --- .github/workflows/python-main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 8fee68b42b..9e2d1daff5 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -206,7 +206,7 @@ jobs: env: DEPTHAI_BUILD_BASALT: ON DEPTHAI_BUILD_PCL: ON - DEPTHAI_BUILD_RTABMAP: ON + # DEPTHAI_BUILD_RTABMAP: ON VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" steps: - name: Cache .hunter folder @@ -496,7 +496,7 @@ jobs: VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" DEPTHAI_BUILD_BASALT: ON DEPTHAI_BUILD_PCL: ON - DEPTHAI_BUILD_RTABMAP: ON + # DEPTHAI_BUILD_RTABMAP: ON steps: - name: Export GitHub Actions cache environment variables uses: actions/github-script@v7 From 21e060b295de84872a7946a0229e4ad924219753 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 19 Nov 2024 12:23:31 +0100 Subject: [PATCH 082/131] bindings gen fix --- CMakeLists.txt | 1 + bindings/python/generate_stubs.py | 13 +++------ cmake/ports/libarchive/portfile.cmake | 41 +++++++++++++++------------ cmake/ports/libarchive/vcpkg.json | 3 +- src/utility/Initialization.cpp | 2 +- 5 files changed, 31 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d2fdd42295..4a3211da76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -736,6 +736,7 @@ target_link_libraries(${TARGET_CORE_NAME} BZip2::BZip2 FP16::fp16 LibArchive::LibArchive + liblzma::liblzma ZLIB::ZLIB lz4::lz4 httplib::httplib diff --git a/bindings/python/generate_stubs.py b/bindings/python/generate_stubs.py index ebebe71de7..ba435d722b 100644 --- a/bindings/python/generate_stubs.py +++ b/bindings/python/generate_stubs.py @@ -15,7 +15,6 @@ print(f'Generating stubs for module: "{MODULE_NAME}" in directory: "{DIRECTORY}"') -sys.stdout.flush() try: # Create stubs, add PYTHONPATH to find the build module @@ -32,16 +31,16 @@ print(f'PYTHONPATH set to {env["PYTHONPATH"]}') # Check if stubgen has the `--include-docstrings` flag includeDocstrings = False - output = subprocess.check_output(['stubgen', '--help'], env=env, timeout=5) + output = subprocess.check_output(['stubgen', '--help'], env=env) if b'--include-docstrings' in output: includeDocstrings = True print("Will include docstrings in stubs") else: print("Will not include docstrings in stubs") - parameters = ['stubgen', '-v', '-p', MODULE_NAME, '-o', f'{DIRECTORY}'] + parameters = ['stubgen', '-p', MODULE_NAME, '-o', f'{DIRECTORY}'] if includeDocstrings: parameters.insert(1, '--include-docstrings') - subprocess.check_call(parameters, cwd=DIRECTORY, env=env, timeout=5) + subprocess.check_call(parameters, cwd=DIRECTORY, env=env) # Add py.typed open(f'{DIRECTORY}/depthai/py.typed', 'a').close() @@ -123,11 +122,9 @@ config.close() print(f'Mypy config file: {config.name}') # Mypy check - subprocess.check_call([sys.executable, '-m' 'mypy', f'{DIRECTORY}/{MODULE_NAME}', f'--config-file={config.name}'], env=env, timeout=5) + subprocess.check_call([sys.executable, '-m' 'mypy', f'{DIRECTORY}/{MODULE_NAME}', f'--config-file={config.name}'], env=env) finally: - print(f'Deleting file: {config.name}') os.unlink(config.name) - print(f'Mypy config file deleted: {config.name}') # # TODO(thamarpe) - Pylance / Pyright check # subprocess.check_call([sys.executable, '-m' 'pyright', f'{DIRECTORY}/{MODULE_NAME}'], env=env) @@ -165,10 +162,8 @@ def process_init_pyi(file_path, is_depthai_root=False): is_depthai_root = (root == f'{DIRECTORY}/{MODULE_NAME}') process_init_pyi(os.path.join(root, '__init__.pyi'), is_depthai_root) - print("Fin") except subprocess.CalledProcessError as err: exit(err.returncode) finally: - print("Done") exit(0) diff --git a/cmake/ports/libarchive/portfile.cmake b/cmake/ports/libarchive/portfile.cmake index e209f01928..cd679ae23e 100644 --- a/cmake/ports/libarchive/portfile.cmake +++ b/cmake/ports/libarchive/portfile.cmake @@ -47,30 +47,35 @@ endif() vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - ${FEATURE_OPTIONS} - -DENABLE_ZLIB=ON - -DENABLE_PCREPOSIX=OFF - -DPOSIX_REGEX_LIB=NONE - -DENABLE_MBEDTLS=OFF - -DENABLE_NETTLE=OFF - -DENABLE_EXPAT=OFF - -DENABLE_LibGCC=OFF + -DENABLE_ACL=OFF + -DENABLE_BZip2=OFF + -DENABLE_CAT=OFF + -DENABLE_CAT_SHARED=OFF -DENABLE_CNG=OFF - -DENABLE_TAR=OFF + -DENABLE_COVERAGE=OFF -DENABLE_CPIO=OFF - -DENABLE_CAT=OFF - -DENABLE_XATTR=OFF - -DENABLE_ACL=OFF + -DENABLE_CPIO_SHARED=OFF + -DENABLE_EXPAT=OFF -DENABLE_ICONV=OFF + -DENABLE_INSTALL=ON -DENABLE_LIBB2=OFF + -DENABLE_LIBXML2=OFF + -DENABLE_LZ4=OFF + -DENABLE_LZMA=ON + -DENABLE_LZO=OFF + -DENABLE_LibGCC=OFF + -DENABLE_MBEDTLS=OFF + -DENABLE_NETTLE=OFF + -DENABLE_OPENSSL=OFF + -DENABLE_PCREPOSIX=OFF + -DENABLE_SAFESEH=AUTO + -DENABLE_TAR=OFF + -DENABLE_TAR_SHARED=OFF -DENABLE_TEST=OFF -DENABLE_WERROR=OFF - MAYBE_UNUSED_VARIABLES - CMAKE_REQUIRE_FIND_PACKAGE_BZip2 - CMAKE_REQUIRE_FIND_PACKAGE_LibLZMA - CMAKE_REQUIRE_FIND_PACKAGE_LibXml2 - CMAKE_REQUIRE_FIND_PACKAGE_lz4 - ENABLE_LibGCC + -DENABLE_XATTR=OFF + -DENABLE_ZLIB=OFF + -DENABLE_ZSTD=OFF ) vcpkg_cmake_install() diff --git a/cmake/ports/libarchive/vcpkg.json b/cmake/ports/libarchive/vcpkg.json index 0e4e13dd0d..4ca10824c6 100644 --- a/cmake/ports/libarchive/vcpkg.json +++ b/cmake/ports/libarchive/vcpkg.json @@ -11,7 +11,8 @@ "name": "vcpkg-cmake", "host": true }, - "zlib" + "zlib", + "liblzma" ], "default-features": [ "bzip2", diff --git a/src/utility/Initialization.cpp b/src/utility/Initialization.cpp index 73a3048431..76c5581c1d 100644 --- a/src/utility/Initialization.cpp +++ b/src/utility/Initialization.cpp @@ -103,7 +103,7 @@ bool initialize(const char* additionalInfo, bool installSignalHandler, void* jav // Executed at library load time // Preload Resources (getting instance causes some internal lazy loading to start) - // Resources::getInstance(); + Resources::getInstance(); // Static global handler static XLinkGlobalHandler_t xlinkGlobalHandler = {}; From ca172593baa1ae9b94b2e35c7abd953885d2d0a7 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 19 Nov 2024 12:25:32 +0100 Subject: [PATCH 083/131] remove prints in stubs gen --- bindings/python/generate_stubs.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bindings/python/generate_stubs.py b/bindings/python/generate_stubs.py index ba435d722b..2ab1c9ee17 100644 --- a/bindings/python/generate_stubs.py +++ b/bindings/python/generate_stubs.py @@ -111,7 +111,7 @@ file.write(final_stubs) # Flush previous stdout - # sys.stdout.flush() + sys.stdout.flush() # Check syntax (Mypy and later Pylance/Pyright) # Windows limitation - another process cannot normally read temporary file that is opened by this process @@ -130,11 +130,9 @@ def process_init_pyi(file_path, is_depthai_root=False): # Read old __init__.pyi - print(f'Processing {file_path}') with open(file_path, 'r+') as file: contents = file.read() - print(f'Processing {file_path}') # Prepare imports dir_path = os.path.dirname(file_path) From aa2ea6e51267999c1849a0a559c4d18aec30e412 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 19 Nov 2024 13:08:10 +0100 Subject: [PATCH 084/131] set jobs num to 2 for vcpkg --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a3211da76..dad859bff8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,6 +79,7 @@ endif() option(DEPTHAI_BOOTSTRAP_VCPKG "Automatically bootstrap VCPKG" ON) if(DEPTHAI_BOOTSTRAP_VCPKG) + set(ENV{VCPKG_MAX_CONCURRENCY} "2") message(STATUS "Including vcpkg.cmake") include(cmake/vcpkg.cmake) else() @@ -737,7 +738,7 @@ target_link_libraries(${TARGET_CORE_NAME} FP16::fp16 LibArchive::LibArchive liblzma::liblzma - ZLIB::ZLIB + ZLIB::ZLIB lz4::lz4 httplib::httplib mp4v2::mp4v2 From 01831c07c13b48bdabcdfce1a6a084d5cbe64b75 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 19 Nov 2024 16:21:18 +0100 Subject: [PATCH 085/131] disable basalt on windows ci --- .github/workflows/python-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 9e2d1daff5..6ca0c8411f 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -204,7 +204,7 @@ jobs: python-architecture: [x64] # TODO(Morato) - re-enable x86 - it complains that OpenCV even though it's 32 bit is not compatible fail-fast: false env: - DEPTHAI_BUILD_BASALT: ON + # DEPTHAI_BUILD_BASALT: ON DEPTHAI_BUILD_PCL: ON # DEPTHAI_BUILD_RTABMAP: ON VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" From bc08483f0ef0a75f0d4a51bd2d47a5ad1be428ca Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 19 Nov 2024 16:33:46 +0100 Subject: [PATCH 086/131] update rtabmap on windows --- .github/workflows/python-main.yml | 2 +- include/depthai/rtabmap/RTABMapSLAM.hpp | 26 +++++++------- include/depthai/rtabmap/RTABMapVIO.hpp | 45 +++++++++++++------------ 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 6ca0c8411f..cf62ebecb2 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -206,7 +206,7 @@ jobs: env: # DEPTHAI_BUILD_BASALT: ON DEPTHAI_BUILD_PCL: ON - # DEPTHAI_BUILD_RTABMAP: ON + DEPTHAI_BUILD_RTABMAP: ON VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" steps: - name: Cache .hunter folder diff --git a/include/depthai/rtabmap/RTABMapSLAM.hpp b/include/depthai/rtabmap/RTABMapSLAM.hpp index 18bf333c54..50319ca025 100644 --- a/include/depthai/rtabmap/RTABMapSLAM.hpp +++ b/include/depthai/rtabmap/RTABMapSLAM.hpp @@ -49,49 +49,49 @@ class RTABMapSLAM : public dai::NodeCRTP data); void odomPoseCB(std::shared_ptr data); void imuCB(std::shared_ptr msg); @@ -215,4 +215,4 @@ class RTABMapSLAM : public dai::NodeCRTP { /** * Input tracked features on which VIO is performed (optional). */ - Input features{*this, {.name = featuresInputName, .types = {{DatatypeEnum::TrackedFeatures, true}}}}; + Input features{*this, {featuresInputName, DEFAULT_GROUP, DEFAULT_BLOCKING, 15, {{{DatatypeEnum::TrackedFeatures, true}}}}}; /** * Input IMU data. */ - Input imu{*this, {.name = "imu", .types = {{DatatypeEnum::IMUData, true}}}}; + Input imu{*this, {"imu", DEFAULT_GROUP, DEFAULT_BLOCKING, 15, {{{DatatypeEnum::IMUData, true}}}}}; /** * Output transform. */ - Output transform{*this, {.name = "transform", .types = {{DatatypeEnum::TransformData, true}}}}; + Output transform{*this, {"transform", DEFAULT_GROUP, {{{DatatypeEnum::TransformData, true}}}}}; /** * Passthrough rectified frame. */ - Output passthroughRect{*this, {.name = "passthroughRect", .types = {{DatatypeEnum::ImgFrame, true}}}}; + Output passthroughRect{*this, {"passthroughRect", DEFAULT_GROUP, {{{DatatypeEnum::ImgFrame, true}}}}}; /** * Passthrough depth frame. */ - Output passthroughDepth{*this, {.name = "passthroughDepth", .types = {{DatatypeEnum::ImgFrame, true}}}}; + Output passthroughDepth{*this, {"passthroughDepth", DEFAULT_GROUP, {{{DatatypeEnum::ImgFrame, true}}}}}; /** * Passthrough features. */ - Output passthroughFeatures{*this, {.name = "passthroughFeatures", .types = {{DatatypeEnum::TrackedFeatures, true}}}}; + Output passthroughFeatures{*this, {"passthroughFeatures", DEFAULT_GROUP, {{{DatatypeEnum::TrackedFeatures, true}}}}}; /** * Set RTABMap parameters. @@ -91,20 +91,21 @@ class RTABMapVIO : public NodeCRTP { private: void run() override; void syncCB(std::shared_ptr data); - Input inSync{*this, {.name = "inSync", .types = {{DatatypeEnum::MessageGroup, true}}}}; - void imuCB(std::shared_ptr msg); - void initialize(Pipeline& pipeline, int instanceNum, int width, int height); - rtabmap::StereoCameraModel model; - std::unique_ptr odom; - rtabmap::Transform localTransform; - rtabmap::Transform imuLocalTransform; - std::map rtabParams; - std::map accBuffer; - std::map gyroBuffer; - std::mutex imuMtx; - float alphaScaling = -1.0; - bool initialized = false; - bool useFeatures = true; -}; + Input inSync { + *this, {"inSync", DEFAULT_GROUP, DEFAULT_BLOCKING, 15, {{{DatatypeEnum::MessageGroup, true}}}}}; + void imuCB(std::shared_ptr msg); + void initialize(Pipeline & pipeline, int instanceNum, int width, int height); + rtabmap::StereoCameraModel model; + std::unique_ptr odom; + rtabmap::Transform localTransform; + rtabmap::Transform imuLocalTransform; + std::map rtabParams; + std::map accBuffer; + std::map gyroBuffer; + std::mutex imuMtx; + float alphaScaling = -1.0; + bool initialized = false; + bool useFeatures = true; + }; } // namespace node -} // namespace dai \ No newline at end of file +} // namespace dai From aa53ffd2b921f230e7ae1521fc2b6c465c1663f3 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 19 Nov 2024 17:32:04 +0100 Subject: [PATCH 087/131] remove hunter references --- CMakeLists.txt | 63 +---- cmake/Hunter/config.cmake | 41 --- cmake/HunterGate.cmake | 539 -------------------------------------- 3 files changed, 9 insertions(+), 634 deletions(-) delete mode 100644 cmake/Hunter/config.cmake delete mode 100644 cmake/HunterGate.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index dad859bff8..51c2c5f25a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,14 @@ -cmake_minimum_required(VERSION 3.4) # For Hunter - +cmake_minimum_required(VERSION 3.16) +# Early options +option(DEPTHAI_ENABLE_LIBUSB "Enable usage of libusb and interaction with USB devices" ON) # Build AprilTag node code (note, that even if set to OFF, an AprilTagNode can be used with setRunOnHost(false)) option(DEPTHAI_ENABLE_APRIL_TAG "Enable AprilTag node" ON) +option(DEPTHAI_RTABMAP_SUPPORT "Enable optional RTABMap support" OFF) +option(DEPTHAI_BASALT_SUPPORT "Enable optional Basalt support" OFF) +option(DEPTHAI_ENABLE_PROTOBUF "Enable Protobuf support" ON) +option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT}) +option(DEPTHAI_BOOTSTRAP_VCPKG "Automatically bootstrap VCPKG" ON) + set(DEPTHAI_HAS_APRIL_TAG ${DEPTHAI_ENABLE_APRIL_TAG}) if(WIN32) message(STATUS "AprilTag node is not supported on Windows") @@ -10,11 +17,9 @@ endif() if(DEPTHAI_HAS_APRIL_TAG) list(APPEND VCPKG_MANIFEST_FEATURES "apriltag") endif() -option(DEPTHAI_RTABMAP_SUPPORT "Enable optional RTABMap support" OFF) if(DEPTHAI_RTABMAP_SUPPORT) list(APPEND VCPKG_MANIFEST_FEATURES "rtabmap") endif() -option(DEPTHAI_BASALT_SUPPORT "Enable optional Basalt support" OFF) if(DEPTHAI_BASALT_SUPPORT) list(APPEND VCPKG_MANIFEST_FEATURES "basalt") endif() @@ -31,37 +36,22 @@ else() endif() endif() - - -option(DEPTHAI_ENABLE_PROTOBUF "Enable Protobuf support" ON) if(DEPTHAI_ENABLE_PROTOBUF) list(APPEND VCPKG_MANIFEST_FEATURES "protobuf-support") endif() -# Set to use native tls for windows before including Hunter (used for Curl) -if(WIN32) - set(DEPTHAI_CURL_USE_SCHANNEL ON) - set(DEPTHAI_CURL_USE_OPENSSL OFF) - add_compile_definitions(NOMINMAX) -else() - set(DEPTHAI_CURL_USE_SCHANNEL OFF) - set(DEPTHAI_CURL_USE_OPENSSL ON) -endif() # Check if on 32 bit linux - default without CURL support if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND UNIX) set(DEPTHAI_DEFAULT_CURL_SUPPORT OFF) else() set(DEPTHAI_DEFAULT_CURL_SUPPORT ON) endif() -option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT}) if(DEPTHAI_ENABLE_CURL) list(APPEND VCPKG_MANIFEST_FEATURES "curl-support") endif() -# Early options -option(DEPTHAI_ENABLE_LIBUSB "Enable usage of libusb and interaction with USB devices" ON) if(DEPTHAI_ENABLE_LIBUSB) list(APPEND VCPKG_MANIFEST_FEATURES "xlink-usb") else() @@ -77,7 +67,6 @@ if(POLICY CMP0028) cmake_policy(SET CMP0028 NEW) endif() -option(DEPTHAI_BOOTSTRAP_VCPKG "Automatically bootstrap VCPKG" ON) if(DEPTHAI_BOOTSTRAP_VCPKG) set(ENV{VCPKG_MAX_CONCURRENCY} "2") message(STATUS "Including vcpkg.cmake") @@ -86,12 +75,6 @@ else() message(STATUS "DEPTHAI_BOOTSTRAP_VCPKG is OFF") endif() -# MSVC variable isn't available before 'project' call -# Generalize to Win32 platform for now -if(NOT WIN32) - set(HUNTER_CONFIGURATION_TYPES "Release" CACHE STRING "Hunter dependencies list of build configurations") -endif() - if(DEPTHAI_ENABLE_PROTOBUF) option(DEPTHAI_ENABLE_REMOTE_CONNECTION "Enable Remote Connection support" ON) @@ -831,31 +814,6 @@ if(DEPTHAI_USB2_PATCH_ONLY_MODE) target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_PATCH_ONLY_MODE) endif() -# Helper function -macro(add_runtime_dependencies depending_target dependency) - if(WIN32) - if(TARGET ${dependency}) - get_property(imported_configs TARGET ${dependency} PROPERTY IMPORTED_CONFIGURATIONS) - set(dlls "") - foreach(cfg ${imported_configs}) - get_property(dll TARGET ${dependency} PROPERTY IMPORTED_LOCATION_${cfg}) - set(dlls ${depthai_dll_libraries} $<$:${dll}>) - endforeach() - endif() - file(GLOB depthai_dll_libraries "${HUNTER_INSTALL_PREFIX}/bin/*.dll") - # Create a list of required dll files - set(required_dll_files ${dlls} ${depthai_dll_libraries}) - # Copy the required dlls - add_custom_command(TARGET ${depending_target} POST_BUILD COMMAND - "$<$:${CMAKE_COMMAND};-E;copy_if_different;${required_dll_files};$>" - COMMAND_EXPAND_LISTS - VERBATIM - ) - message(STATUS "Required dlls for core are: ${required_dll_files}") - endif() -endmacro() -# Add libusb dll in build time -add_runtime_dependencies(${TARGET_CORE_NAME} usb-1.0) ######################## # OpenCV Support 2 @@ -1197,7 +1155,6 @@ configure_file("cmake/${PROJECT_NAME}Dependencies.cmake" ${PROJECT_NAME}Dependen write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY AnyNewerVersion) # Configure config file (one for exporting build directory, one for installation) -# file(RELATIVE_PATH DEPTHAI_DEPENDENCIES_INSTALLATION_PATH_REL "${CMAKE_CURRENT_BINARY_DIR}" "${HUNTER_INSTALL_PREFIX}") configure_file(cmake/${PROJECT_NAME}Config.cmake.in ${PROJECT_NAME}Config.cmake @ONLY) # Config for installation @@ -1232,8 +1189,6 @@ if(DEPTHAI_INSTALL) install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") # Install depthai-bootloader-shared public headers install(DIRECTORY "${DEPTHAI_BOOTLOADER_SHARED_PUBLIC_INCLUDE}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") - # Install Hunter dependencies - # install(DIRECTORY "${HUNTER_INSTALL_PREFIX}/" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/dependencies") # Install depthai-core dependencies install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/3rdparty" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake") # Install resources if not RC'd diff --git a/cmake/Hunter/config.cmake b/cmake/Hunter/config.cmake deleted file mode 100644 index c65f12a1f1..0000000000 --- a/cmake/Hunter/config.cmake +++ /dev/null @@ -1,41 +0,0 @@ - -# Specific Catch2 version -hunter_config( - Catch2 - VERSION "3.4.0" - URL "https://github.com/catchorg/Catch2/archive/refs/tags/v3.4.0.tar.gz" - SHA1 "4c308576c856a43dc88949a8f64ef90ebf94ae1b" -) - - - -# TMP, could be read from XLink -# libusb without udev -hunter_config( - libusb-luxonis - VERSION "1.0.24-cmake" - URL "https://github.com/luxonis/libusb/archive/b7e4548958325b18feb73977163ad44398099534.tar.gz" - SHA1 "2d79573d57628fe56d2868d2f6ce756d40906cf4" - CMAKE_ARGS - WITH_UDEV=OFF - # Build shared libs by default to not cause licensing issues - BUILD_SHARED_LIBS=ON -) - - -# Pybind11 2.9.2-smart_holder -hunter_config( - pybind11 - VERSION "luxonis_smart_holder" - URL "https://github.com/luxonis/pybind11/archive/f760e2b984b66be2cfa202c93da9d341a557fb5d.tar.gz" - SHA1 "d53247e4d1af52be040b647de0c25eb336bc85c7" -) - - -hunter_config( - semver - VERSION "v0.3.1" - URL "https://github.com/Neargye/semver/archive/v0.3.1.tar.gz" - SHA1 "c9ac79025cc259d8cca454be0865e88f154402be" -) - diff --git a/cmake/HunterGate.cmake b/cmake/HunterGate.cmake deleted file mode 100644 index 6d9cc24019..0000000000 --- a/cmake/HunterGate.cmake +++ /dev/null @@ -1,539 +0,0 @@ -# Copyright (c) 2013-2019, Ruslan Baratov -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# This is a gate file to Hunter package manager. -# Include this file using `include` command and add package you need, example: -# -# cmake_minimum_required(VERSION 3.2) -# -# include("cmake/HunterGate.cmake") -# HunterGate( -# URL "https://github.com/path/to/hunter/archive.tar.gz" -# SHA1 "798501e983f14b28b10cda16afa4de69eee1da1d" -# ) -# -# project(MyProject) -# -# hunter_add_package(Foo) -# hunter_add_package(Boo COMPONENTS Bar Baz) -# -# Projects: -# * https://github.com/hunter-packages/gate/ -# * https://github.com/ruslo/hunter - -option(HUNTER_ENABLED "Enable Hunter package manager support" ON) - -if(HUNTER_ENABLED) - if(CMAKE_VERSION VERSION_LESS "3.2") - message( - FATAL_ERROR - "At least CMake version 3.2 required for Hunter dependency management." - " Update CMake or set HUNTER_ENABLED to OFF." - ) - endif() -endif() - -include(CMakeParseArguments) # cmake_parse_arguments - -option(HUNTER_STATUS_PRINT "Print working status" ON) -option(HUNTER_STATUS_DEBUG "Print a lot info" OFF) -option(HUNTER_TLS_VERIFY "Enable/disable TLS certificate checking on downloads" ON) - -set(HUNTER_ERROR_PAGE "https://docs.hunter.sh/en/latest/reference/errors") - -function(hunter_gate_status_print) - if(HUNTER_STATUS_PRINT OR HUNTER_STATUS_DEBUG) - foreach(print_message ${ARGV}) - message(STATUS "[hunter] ${print_message}") - endforeach() - endif() -endfunction() - -function(hunter_gate_status_debug) - if(HUNTER_STATUS_DEBUG) - foreach(print_message ${ARGV}) - string(TIMESTAMP timestamp) - message(STATUS "[hunter *** DEBUG *** ${timestamp}] ${print_message}") - endforeach() - endif() -endfunction() - -function(hunter_gate_error_page error_page) - message("------------------------------ ERROR ------------------------------") - message(" ${HUNTER_ERROR_PAGE}/${error_page}.html") - message("-------------------------------------------------------------------") - message("") - message(FATAL_ERROR "") -endfunction() - -function(hunter_gate_internal_error) - message("") - foreach(print_message ${ARGV}) - message("[hunter ** INTERNAL **] ${print_message}") - endforeach() - message("[hunter ** INTERNAL **] [Directory:${CMAKE_CURRENT_LIST_DIR}]") - message("") - hunter_gate_error_page("error.internal") -endfunction() - -function(hunter_gate_fatal_error) - cmake_parse_arguments(hunter "" "ERROR_PAGE" "" "${ARGV}") - if("${hunter_ERROR_PAGE}" STREQUAL "") - hunter_gate_internal_error("Expected ERROR_PAGE") - endif() - message("") - foreach(x ${hunter_UNPARSED_ARGUMENTS}) - message("[hunter ** FATAL ERROR **] ${x}") - endforeach() - message("[hunter ** FATAL ERROR **] [Directory:${CMAKE_CURRENT_LIST_DIR}]") - message("") - hunter_gate_error_page("${hunter_ERROR_PAGE}") -endfunction() - -function(hunter_gate_user_error) - hunter_gate_fatal_error(${ARGV} ERROR_PAGE "error.incorrect.input.data") -endfunction() - -function(hunter_gate_self root version sha1 result) - string(COMPARE EQUAL "${root}" "" is_bad) - if(is_bad) - hunter_gate_internal_error("root is empty") - endif() - - string(COMPARE EQUAL "${version}" "" is_bad) - if(is_bad) - hunter_gate_internal_error("version is empty") - endif() - - string(COMPARE EQUAL "${sha1}" "" is_bad) - if(is_bad) - hunter_gate_internal_error("sha1 is empty") - endif() - - string(SUBSTRING "${sha1}" 0 7 archive_id) - - if(EXISTS "${root}/cmake/Hunter") - set(hunter_self "${root}") - else() - set( - hunter_self - "${root}/_Base/Download/Hunter/${version}/${archive_id}/Unpacked" - ) - endif() - - set("${result}" "${hunter_self}" PARENT_SCOPE) -endfunction() - -# Set HUNTER_GATE_ROOT cmake variable to suitable value. -function(hunter_gate_detect_root) - # Check CMake variable - string(COMPARE NOTEQUAL "${HUNTER_ROOT}" "" not_empty) - if(not_empty) - set(HUNTER_GATE_ROOT "${HUNTER_ROOT}" PARENT_SCOPE) - hunter_gate_status_debug("HUNTER_ROOT detected by cmake variable") - return() - endif() - - # Check environment variable - string(COMPARE NOTEQUAL "$ENV{HUNTER_ROOT}" "" not_empty) - if(not_empty) - set(HUNTER_GATE_ROOT "$ENV{HUNTER_ROOT}" PARENT_SCOPE) - hunter_gate_status_debug("HUNTER_ROOT detected by environment variable") - return() - endif() - - # Check HOME environment variable - string(COMPARE NOTEQUAL "$ENV{HOME}" "" result) - if(result) - set(HUNTER_GATE_ROOT "$ENV{HOME}/.hunter" PARENT_SCOPE) - hunter_gate_status_debug("HUNTER_ROOT set using HOME environment variable") - return() - endif() - - # Check SYSTEMDRIVE and USERPROFILE environment variable (windows only) - if(WIN32) - string(COMPARE NOTEQUAL "$ENV{SYSTEMDRIVE}" "" result) - if(result) - set(HUNTER_GATE_ROOT "$ENV{SYSTEMDRIVE}/.hunter" PARENT_SCOPE) - hunter_gate_status_debug( - "HUNTER_ROOT set using SYSTEMDRIVE environment variable" - ) - return() - endif() - - string(COMPARE NOTEQUAL "$ENV{USERPROFILE}" "" result) - if(result) - set(HUNTER_GATE_ROOT "$ENV{USERPROFILE}/.hunter" PARENT_SCOPE) - hunter_gate_status_debug( - "HUNTER_ROOT set using USERPROFILE environment variable" - ) - return() - endif() - endif() - - hunter_gate_fatal_error( - "Can't detect HUNTER_ROOT" - ERROR_PAGE "error.detect.hunter.root" - ) -endfunction() - -function(hunter_gate_download dir) - string( - COMPARE - NOTEQUAL - "$ENV{HUNTER_DISABLE_AUTOINSTALL}" - "" - disable_autoinstall - ) - if(disable_autoinstall AND NOT HUNTER_RUN_INSTALL) - hunter_gate_fatal_error( - "Hunter not found in '${dir}'" - "Set HUNTER_RUN_INSTALL=ON to auto-install it from '${HUNTER_GATE_URL}'" - "Settings:" - " HUNTER_ROOT: ${HUNTER_GATE_ROOT}" - " HUNTER_SHA1: ${HUNTER_GATE_SHA1}" - ERROR_PAGE "error.run.install" - ) - endif() - string(COMPARE EQUAL "${dir}" "" is_bad) - if(is_bad) - hunter_gate_internal_error("Empty 'dir' argument") - endif() - - string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" is_bad) - if(is_bad) - hunter_gate_internal_error("HUNTER_GATE_SHA1 empty") - endif() - - string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" is_bad) - if(is_bad) - hunter_gate_internal_error("HUNTER_GATE_URL empty") - endif() - - set(done_location "${dir}/DONE") - set(sha1_location "${dir}/SHA1") - - set(build_dir "${dir}/Build") - set(cmakelists "${dir}/CMakeLists.txt") - - hunter_gate_status_debug("Locking directory: ${dir}") - file(LOCK "${dir}" DIRECTORY GUARD FUNCTION) - hunter_gate_status_debug("Lock done") - - if(EXISTS "${done_location}") - # while waiting for lock other instance can do all the job - hunter_gate_status_debug("File '${done_location}' found, skip install") - return() - endif() - - file(REMOVE_RECURSE "${build_dir}") - file(REMOVE_RECURSE "${cmakelists}") - - file(MAKE_DIRECTORY "${build_dir}") # check directory permissions - - # Disabling languages speeds up a little bit, reduces noise in the output - # and avoids path too long windows error - file( - WRITE - "${cmakelists}" - "cmake_minimum_required(VERSION 3.2)\n" - "project(HunterDownload LANGUAGES NONE)\n" - "include(ExternalProject)\n" - "ExternalProject_Add(\n" - " Hunter\n" - " URL\n" - " \"${HUNTER_GATE_URL}\"\n" - " URL_HASH\n" - " SHA1=${HUNTER_GATE_SHA1}\n" - " DOWNLOAD_DIR\n" - " \"${dir}\"\n" - " TLS_VERIFY\n" - " ${HUNTER_TLS_VERIFY}\n" - " SOURCE_DIR\n" - " \"${dir}/Unpacked\"\n" - " CONFIGURE_COMMAND\n" - " \"\"\n" - " BUILD_COMMAND\n" - " \"\"\n" - " INSTALL_COMMAND\n" - " \"\"\n" - ")\n" - ) - - if(HUNTER_STATUS_DEBUG) - set(logging_params "") - else() - set(logging_params OUTPUT_QUIET) - endif() - - hunter_gate_status_debug("Run generate") - - # Need to add toolchain file too. - # Otherwise on Visual Studio + MDD this will fail with error: - # "Could not find an appropriate version of the Windows 10 SDK installed on this machine" - if(EXISTS "${CMAKE_TOOLCHAIN_FILE}") - get_filename_component(absolute_CMAKE_TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}" ABSOLUTE) - set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=${absolute_CMAKE_TOOLCHAIN_FILE}") - else() - # 'toolchain_arg' can't be empty - set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=") - endif() - - string(COMPARE EQUAL "${CMAKE_MAKE_PROGRAM}" "" no_make) - if(no_make) - set(make_arg "") - else() - # Test case: remove Ninja from PATH but set it via CMAKE_MAKE_PROGRAM - set(make_arg "-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}") - endif() - - execute_process( - COMMAND - "${CMAKE_COMMAND}" - "-H${dir}" - "-B${build_dir}" - "-G${CMAKE_GENERATOR}" - "${toolchain_arg}" - ${make_arg} - WORKING_DIRECTORY "${dir}" - RESULT_VARIABLE download_result - ${logging_params} - ) - - if(NOT download_result EQUAL 0) - hunter_gate_internal_error( - "Configure project failed." - "To reproduce the error run: ${CMAKE_COMMAND} -H${dir} -B${build_dir} -G${CMAKE_GENERATOR} ${toolchain_arg} ${make_arg}" - "In directory ${dir}" - ) - endif() - - hunter_gate_status_print( - "Initializing Hunter workspace (${HUNTER_GATE_SHA1})" - " ${HUNTER_GATE_URL}" - " -> ${dir}" - ) - execute_process( - COMMAND "${CMAKE_COMMAND}" --build "${build_dir}" - WORKING_DIRECTORY "${dir}" - RESULT_VARIABLE download_result - ${logging_params} - ) - - if(NOT download_result EQUAL 0) - hunter_gate_internal_error("Build project failed") - endif() - - file(REMOVE_RECURSE "${build_dir}") - file(REMOVE_RECURSE "${cmakelists}") - - file(WRITE "${sha1_location}" "${HUNTER_GATE_SHA1}") - file(WRITE "${done_location}" "DONE") - - hunter_gate_status_debug("Finished") -endfunction() - -# Must be a macro so master file 'cmake/Hunter' can -# apply all variables easily just by 'include' command -# (otherwise PARENT_SCOPE magic needed) -macro(HunterGate) - if(HUNTER_GATE_DONE) - # variable HUNTER_GATE_DONE set explicitly for external project - # (see `hunter_download`) - set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES) - endif() - - # First HunterGate command will init Hunter, others will be ignored - get_property(_hunter_gate_done GLOBAL PROPERTY HUNTER_GATE_DONE SET) - - if(NOT HUNTER_ENABLED) - # Empty function to avoid error "unknown function" - function(hunter_add_package) - endfunction() - - set( - _hunter_gate_disabled_mode_dir - "${CMAKE_CURRENT_LIST_DIR}/cmake/Hunter/disabled-mode" - ) - if(EXISTS "${_hunter_gate_disabled_mode_dir}") - hunter_gate_status_debug( - "Adding \"disabled-mode\" modules: ${_hunter_gate_disabled_mode_dir}" - ) - list(APPEND CMAKE_PREFIX_PATH "${_hunter_gate_disabled_mode_dir}") - endif() - elseif(_hunter_gate_done) - hunter_gate_status_debug("Secondary HunterGate (use old settings)") - hunter_gate_self( - "${HUNTER_CACHED_ROOT}" - "${HUNTER_VERSION}" - "${HUNTER_SHA1}" - _hunter_self - ) - include("${_hunter_self}/cmake/Hunter") - else() - set(HUNTER_GATE_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}") - - string(COMPARE NOTEQUAL "${PROJECT_NAME}" "" _have_project_name) - if(_have_project_name) - hunter_gate_fatal_error( - "Please set HunterGate *before* 'project' command. " - "Detected project: ${PROJECT_NAME}" - ERROR_PAGE "error.huntergate.before.project" - ) - endif() - - cmake_parse_arguments( - HUNTER_GATE "LOCAL" "URL;SHA1;GLOBAL;FILEPATH" "" ${ARGV} - ) - - string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" _empty_sha1) - string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" _empty_url) - string( - COMPARE - NOTEQUAL - "${HUNTER_GATE_UNPARSED_ARGUMENTS}" - "" - _have_unparsed - ) - string(COMPARE NOTEQUAL "${HUNTER_GATE_GLOBAL}" "" _have_global) - string(COMPARE NOTEQUAL "${HUNTER_GATE_FILEPATH}" "" _have_filepath) - - if(_have_unparsed) - hunter_gate_user_error( - "HunterGate unparsed arguments: ${HUNTER_GATE_UNPARSED_ARGUMENTS}" - ) - endif() - if(_empty_sha1) - hunter_gate_user_error("SHA1 suboption of HunterGate is mandatory") - endif() - if(_empty_url) - hunter_gate_user_error("URL suboption of HunterGate is mandatory") - endif() - if(_have_global) - if(HUNTER_GATE_LOCAL) - hunter_gate_user_error("Unexpected LOCAL (already has GLOBAL)") - endif() - if(_have_filepath) - hunter_gate_user_error("Unexpected FILEPATH (already has GLOBAL)") - endif() - endif() - if(HUNTER_GATE_LOCAL) - if(_have_global) - hunter_gate_user_error("Unexpected GLOBAL (already has LOCAL)") - endif() - if(_have_filepath) - hunter_gate_user_error("Unexpected FILEPATH (already has LOCAL)") - endif() - endif() - if(_have_filepath) - if(_have_global) - hunter_gate_user_error("Unexpected GLOBAL (already has FILEPATH)") - endif() - if(HUNTER_GATE_LOCAL) - hunter_gate_user_error("Unexpected LOCAL (already has FILEPATH)") - endif() - endif() - - hunter_gate_detect_root() # set HUNTER_GATE_ROOT - - # Beautify path, fix probable problems with windows path slashes - get_filename_component( - HUNTER_GATE_ROOT "${HUNTER_GATE_ROOT}" ABSOLUTE - ) - hunter_gate_status_debug("HUNTER_ROOT: ${HUNTER_GATE_ROOT}") - if(NOT HUNTER_ALLOW_SPACES_IN_PATH) - string(FIND "${HUNTER_GATE_ROOT}" " " _contain_spaces) - if(NOT _contain_spaces EQUAL -1) - hunter_gate_fatal_error( - "HUNTER_ROOT (${HUNTER_GATE_ROOT}) contains spaces." - "Set HUNTER_ALLOW_SPACES_IN_PATH=ON to skip this error" - "(Use at your own risk!)" - ERROR_PAGE "error.spaces.in.hunter.root" - ) - endif() - endif() - - string( - REGEX - MATCH - "[0-9]+\\.[0-9]+\\.[0-9]+[-_a-z0-9]*" - HUNTER_GATE_VERSION - "${HUNTER_GATE_URL}" - ) - string(COMPARE EQUAL "${HUNTER_GATE_VERSION}" "" _is_empty) - if(_is_empty) - set(HUNTER_GATE_VERSION "unknown") - endif() - - hunter_gate_self( - "${HUNTER_GATE_ROOT}" - "${HUNTER_GATE_VERSION}" - "${HUNTER_GATE_SHA1}" - _hunter_self - ) - - set(_master_location "${_hunter_self}/cmake/Hunter") - if(EXISTS "${HUNTER_GATE_ROOT}/cmake/Hunter") - # Hunter downloaded manually (e.g. by 'git clone') - set(_unused "xxxxxxxxxx") - set(HUNTER_GATE_SHA1 "${_unused}") - set(HUNTER_GATE_VERSION "${_unused}") - else() - get_filename_component(_archive_id_location "${_hunter_self}/.." ABSOLUTE) - set(_done_location "${_archive_id_location}/DONE") - set(_sha1_location "${_archive_id_location}/SHA1") - - # Check Hunter already downloaded by HunterGate - if(NOT EXISTS "${_done_location}") - hunter_gate_download("${_archive_id_location}") - endif() - - if(NOT EXISTS "${_done_location}") - hunter_gate_internal_error("hunter_gate_download failed") - endif() - - if(NOT EXISTS "${_sha1_location}") - hunter_gate_internal_error("${_sha1_location} not found") - endif() - file(READ "${_sha1_location}" _sha1_value) - string(COMPARE EQUAL "${_sha1_value}" "${HUNTER_GATE_SHA1}" _is_equal) - if(NOT _is_equal) - hunter_gate_internal_error( - "Short SHA1 collision:" - " ${_sha1_value} (from ${_sha1_location})" - " ${HUNTER_GATE_SHA1} (HunterGate)" - ) - endif() - if(NOT EXISTS "${_master_location}") - hunter_gate_user_error( - "Master file not found:" - " ${_master_location}" - "try to update Hunter/HunterGate" - ) - endif() - endif() - include("${_master_location}") - set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES) - endif() -endmacro() From 89d3d1c59b393bd866f40158ef949ea8339c0658 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 20 Nov 2024 10:42:16 +0100 Subject: [PATCH 088/131] cache in tests --- .github/workflows/test.workflow.yml | 8 ++++++++ CMakeLists.txt | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.workflow.yml b/.github/workflows/test.workflow.yml index 56ff17009c..89ada01681 100644 --- a/.github/workflows/test.workflow.yml +++ b/.github/workflows/test.workflow.yml @@ -20,6 +20,8 @@ jobs: # Testing test: + env: + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" strategy: matrix: # os: ['windows', 'macos', 'linux'] @@ -42,6 +44,12 @@ jobs: - uses: actions/checkout@v3 with: submodules: 'recursive' + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - name: Create virtual environment run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 51c2c5f25a..3f37311ca7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,6 @@ option(DEPTHAI_ENABLE_APRIL_TAG "Enable AprilTag node" ON) option(DEPTHAI_RTABMAP_SUPPORT "Enable optional RTABMap support" OFF) option(DEPTHAI_BASALT_SUPPORT "Enable optional Basalt support" OFF) option(DEPTHAI_ENABLE_PROTOBUF "Enable Protobuf support" ON) -option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT}) option(DEPTHAI_BOOTSTRAP_VCPKG "Automatically bootstrap VCPKG" ON) set(DEPTHAI_HAS_APRIL_TAG ${DEPTHAI_ENABLE_APRIL_TAG}) @@ -48,6 +47,7 @@ else() set(DEPTHAI_DEFAULT_CURL_SUPPORT ON) endif() +option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT}) if(DEPTHAI_ENABLE_CURL) list(APPEND VCPKG_MANIFEST_FEATURES "curl-support") endif() From 4dafa0387ec7a8b9102c424d21614287ee38c90a Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 20 Nov 2024 12:09:05 +0100 Subject: [PATCH 089/131] basalt conf fixup --- cmake/ports/basalt/portfile.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/ports/basalt/portfile.cmake b/cmake/ports/basalt/portfile.cmake index aa6e555c9b..585587fddc 100644 --- a/cmake/ports/basalt/portfile.cmake +++ b/cmake/ports/basalt/portfile.cmake @@ -11,9 +11,9 @@ vcpkg_from_github( vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - -DBUILD_SHARED_LIBS=OFF -DBASALT_SDK_ONLY=ON ) vcpkg_cmake_install() +vcpkg_cmake_config_fixup(PACKAGE_NAME basalt_sdk CONFIG_PATH "lib/cmake/basalt_sdk") From 88b8e0b971fcfc9e3cc4f5311faec9b5fd114b34 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 20 Nov 2024 14:23:26 +0100 Subject: [PATCH 090/131] opencv with png support for failing test --- .github/workflows/python-main.yml | 6 +----- CMakeLists.txt | 1 - vcpkg.json | 9 ++++++++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index cf62ebecb2..ecce4f9e32 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -407,9 +407,6 @@ jobs: matrix: python-set: ["7", "8", "9", "10", "11", "12"] env: - # workaround required for cache@v3, https://github.com/actions/cache/issues/1428 - # to be removed when upgrading the manylinux image - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true DEPTHAI_BUILD_BASALT: ON DEPTHAI_BUILD_PCL: ON DEPTHAI_BUILD_RTABMAP: ON @@ -489,13 +486,12 @@ jobs: python-set: ["7", "8", "9", "10", "11", "12"] env: # workaround required for cache@v3, https://github.com/actions/cache/issues/1428 - # to be removed when upgrading the manylinux image - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true DEPTHAI_VCPKG_CFLAGS: "-std=c99" # Needed so vpckg can bootstrap itself with the old GCC on the manylinux image VCPKG_FORCE_SYSTEM_BINARIES: "1" # Needed so vpckg can bootstrap itself VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" DEPTHAI_BUILD_BASALT: ON DEPTHAI_BUILD_PCL: ON + VCPKG_MAX_CONCURRENCY: "2" # DEPTHAI_BUILD_RTABMAP: ON steps: - name: Export GitHub Actions cache environment variables diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f37311ca7..52cfdd8bc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,7 +68,6 @@ if(POLICY CMP0028) endif() if(DEPTHAI_BOOTSTRAP_VCPKG) - set(ENV{VCPKG_MAX_CONCURRENCY} "2") message(STATUS "Including vcpkg.cmake") include(cmake/vcpkg.cmake) else() diff --git a/vcpkg.json b/vcpkg.json index 17df9e5e73..ddd434df82 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -27,7 +27,14 @@ }, { "name": "opencv4", - "default-features": false + "default-features": false, + "features": [ + "jpeg", + "png", + "quirc", + "tiff", + "webp" + ] } ], "features": { From 36789cee561da38801016abfe6fe8d79df2719df Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 20 Nov 2024 15:19:46 +0100 Subject: [PATCH 091/131] remove gklib --- cmake/ports/gklib/android.patch | 14 ----- cmake/ports/gklib/build-fixes.patch | 90 ----------------------------- cmake/ports/gklib/portfile.cmake | 27 --------- cmake/ports/gklib/vcpkg.json | 17 ------ 4 files changed, 148 deletions(-) delete mode 100644 cmake/ports/gklib/android.patch delete mode 100644 cmake/ports/gklib/build-fixes.patch delete mode 100644 cmake/ports/gklib/portfile.cmake delete mode 100644 cmake/ports/gklib/vcpkg.json diff --git a/cmake/ports/gklib/android.patch b/cmake/ports/gklib/android.patch deleted file mode 100644 index 0a9f038dcd..0000000000 --- a/cmake/ports/gklib/android.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/GKlibSystem.cmake b/GKlibSystem.cmake -index 31a1cf1..848fd05 100644 ---- a/GKlibSystem.cmake -+++ b/GKlibSystem.cmake -@@ -113,7 +113,9 @@ endif(GKRAND) - - - # Check for features. -+if(NOT ANDROID OR ANDROID_NATIVE_API_LEVEL GREATER 32) - check_include_file(execinfo.h HAVE_EXECINFO_H) -+endif() - if(HAVE_EXECINFO_H) - set(GKlib_COPTIONS "${GKlib_COPTIONS} -DHAVE_EXECINFO_H") - endif(HAVE_EXECINFO_H) diff --git a/cmake/ports/gklib/build-fixes.patch b/cmake/ports/gklib/build-fixes.patch deleted file mode 100644 index 9a711154ff..0000000000 --- a/cmake/ports/gklib/build-fixes.patch +++ /dev/null @@ -1,90 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9cd1b4b..3912b26 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,4 +1,4 @@ --cmake_minimum_required(VERSION 2.8) -+cmake_minimum_required(VERSION 3.22) - project(GKlib C) - - option(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" OFF) -@@ -22,10 +22,11 @@ if(UNIX) - target_link_libraries(GKlib m) - endif(UNIX) - --include_directories("test") --add_subdirectory("test") - - install(TARGETS GKlib -- ARCHIVE DESTINATION lib/${LINSTALL_PATH} -- LIBRARY DESTINATION lib/${LINSTALL_PATH}) -+ EXPORT GKlibTargets -+ INCLUDES DESTINATION "include/GKlib" -+) -+install(EXPORT GKlibTargets FILE "GKlibConfig.cmake" DESTINATION "share/gklib") -+install(FILES "win32/adapt.h" DESTINATION "include/${HINSTALL_PATH}/win32") - install(FILES ${GKlib_includes} DESTINATION include/${HINSTALL_PATH}) -diff --git a/GKlibSystem.cmake b/GKlibSystem.cmake -index 31a1cf1..172a386 100644 ---- a/GKlibSystem.cmake -+++ b/GKlibSystem.cmake -@@ -18,7 +18,6 @@ option(NO_X86 "enable NO_X86 support" OFF) - - # Add compiler flags. - if(MSVC) -- set(GKlib_COPTS "/Ox") - set(GKlib_COPTIONS "-DWIN32 -DMSC -D_CRT_SECURE_NO_DEPRECATE -DUSE_GKREGEX") - elseif(MINGW) - set(GKlib_COPTS "-DUSE_GKREGEX") -@@ -33,6 +32,8 @@ if(CMAKE_COMPILER_IS_GNUCC) - set(GKlib_COPTIONS "${GKlib_COPTIONS} -std=c99 -fno-strict-aliasing") - if(VALGRIND) - set(GKlib_COPTIONS "${GK_COPTIONS} -march=x86-64 -mtune=generic") -+elseif(1) -+ # Use flags from toolchain and triplet - else() - # -march=native is not a valid flag on PPC: - if(CMAKE_SYSTEM_PROCESSOR MATCHES "power|ppc|powerpc|ppc64|powerpc64" OR (APPLE AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc|ppc64")) -@@ -46,6 +47,7 @@ endif(VALGRIND) - endif(NOT MINGW) - # GCC warnings. - set(GKlib_COPTIONS "${GKlib_COPTIONS} -Werror -Wall -pedantic -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label") -+ string(REPLACE " -Werror " " " GKlib_COPTIONS "${GKlib_COPTIONS}") - elseif(${CMAKE_C_COMPILER_ID} MATCHES "Sun") - # Sun insists on -xc99. - set(GKlib_COPTIONS "${GKlib_COPTIONS} -xc99") -@@ -75,6 +77,8 @@ endif(NO_X86) - if(GDB) - set(GKlib_COPTS "${GKlib_COPTS} -g") - set(GKlib_COPTIONS "${GKlib_COPTIONS} -Werror") -+elseif(1) -+ # Use flags from toolchain and triplet - else() - set(GKlib_COPTS "-O3") - endif(GDB) -diff --git a/gk_ms_inttypes.h b/gk_ms_inttypes.h -index b89fc10..7247c38 100644 ---- a/gk_ms_inttypes.h -+++ b/gk_ms_inttypes.h -@@ -35,6 +35,8 @@ - - #ifndef _MSC_INTTYPES_H_ // [ - #define _MSC_INTTYPES_H_ -+#include -+#elif 0 - - #if _MSC_VER > 1000 - #pragma once -diff --git a/gk_ms_stdint.h b/gk_ms_stdint.h -index 7e200dc..1c51958 100644 ---- a/gk_ms_stdint.h -+++ b/gk_ms_stdint.h -@@ -35,6 +35,8 @@ - - #ifndef _MSC_STDINT_H_ // [ - #define _MSC_STDINT_H_ -+#include -+#elif 0 - - #if _MSC_VER > 1000 - #pragma once diff --git a/cmake/ports/gklib/portfile.cmake b/cmake/ports/gklib/portfile.cmake deleted file mode 100644 index d35457b0fd..0000000000 --- a/cmake/ports/gklib/portfile.cmake +++ /dev/null @@ -1,27 +0,0 @@ -if(VCPKG_TARGET_IS_WINDOWS) - vcpkg_check_linkage(ONLY_STATIC_LIBRARY) -endif() - -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO KarypisLab/GKlib - REF 8bd6bad750b2b0d90800c632cf18e8ee93ad72d7 - SHA512 128cd9a48047b18b8013288162556f0b0f1d81845f5445f7cc62590ab28c06ee0a6c602cc999ce268ab27237eca3e8295df6432d377e45071946b98558872997 - PATCHES - android.patch - build-fixes.patch -) - -vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -DHINSTALL_PATH=GKlib - -DCMAKE_C_FLAGS="-D_POSIX_C_SOURCE=199309L" -) - -vcpkg_cmake_install() -vcpkg_cmake_config_fixup() - -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") - -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt") diff --git a/cmake/ports/gklib/vcpkg.json b/cmake/ports/gklib/vcpkg.json deleted file mode 100644 index 5878b88bf3..0000000000 --- a/cmake/ports/gklib/vcpkg.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "gklib", - "version-date": "2023-03-27", - "description": "General helper libraries for KarypisLab.", - "homepage": "https://github.com/KarypisLab/GKlib/", - "license": "Apache-2.0", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - } - ] -} From adf0f288915b3b6bb848e6b0c10c9b557669c3f4 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 20 Nov 2024 18:50:14 +0100 Subject: [PATCH 092/131] update xlink libusb --- cmake/ports/mongoose/CMakeLists.txt | 28 -- cmake/ports/mongoose/portfile.cmake | 41 -- cmake/ports/mongoose/vcpkg.json | 26 - cmake/ports/xlink/hunter.patch | 15 - cmake/ports/xlink/no-hunter.patch | 717 +++++++++++++++++++++++++++ cmake/ports/xlink/portfile.cmake | 4 +- cmake/ports/xlink/vcpkg.json | 7 +- cmake/ports/xlink/windows-link.patch | 20 - cmake/ports/xlink/windows.patch | 67 --- 9 files changed, 724 insertions(+), 201 deletions(-) delete mode 100644 cmake/ports/mongoose/CMakeLists.txt delete mode 100644 cmake/ports/mongoose/portfile.cmake delete mode 100644 cmake/ports/mongoose/vcpkg.json delete mode 100644 cmake/ports/xlink/hunter.patch create mode 100644 cmake/ports/xlink/no-hunter.patch delete mode 100644 cmake/ports/xlink/windows-link.patch delete mode 100644 cmake/ports/xlink/windows.patch diff --git a/cmake/ports/mongoose/CMakeLists.txt b/cmake/ports/mongoose/CMakeLists.txt deleted file mode 100644 index ae2cce34ca..0000000000 --- a/cmake/ports/mongoose/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -cmake_minimum_required(VERSION 3.14) - -project(mongoose C) - -include(GNUInstallDirs) - -option(ENABLE_SSL "Build with openssl support" OFF) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -add_library(mongoose mongoose.c) -target_include_directories(mongoose PUBLIC $) -set_target_properties(mongoose PROPERTIES PUBLIC_HEADER mongoose.h) - -if (ENABLE_SSL) - find_package(OpenSSL REQUIRED) - target_compile_options(mongoose PRIVATE -DMG_ENABLE_SSL) - target_link_libraries(mongoose PRIVATE OpenSSL::SSL OpenSSL::Crypto) -endif() - -install(TARGETS mongoose EXPORT unofficial-mongoose-config) - -install( - EXPORT unofficial-mongoose-config - NAMESPACE unofficial::mongoose:: - DESTINATION share/unofficial-mongoose - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ -) diff --git a/cmake/ports/mongoose/portfile.cmake b/cmake/ports/mongoose/portfile.cmake deleted file mode 100644 index e2b92d72d1..0000000000 --- a/cmake/ports/mongoose/portfile.cmake +++ /dev/null @@ -1,41 +0,0 @@ -vcpkg_check_linkage(ONLY_STATIC_LIBRARY) - -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO cesanta/mongoose - REF "${VERSION}" - SHA512 1db358a3f6fb30db62271ba6a57d0410d80b8460819cbf02973b7fceb3128b9039cc8a70fc1edd52a01597b034a08772542eb7fd080a79ee3e30c47b9900dd72 - HEAD_REF master -) - -file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") - -vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - FEATURES - ssl ENABLE_SSL -) - -vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - ${FEATURE_OPTIONS} - -DCMAKE_CXX_STANDARD=17 - -DCMAKE_C_STANDARD=11 -) - -vcpkg_cmake_install() - -vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT} CONFIG_PATH share/unofficial-${PORT}) - -if("ssl" IN_LIST FEATURES) - vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-${PORT}-config.cmake" - [[# Generated by CMake]] - [[# Generated by CMake -include(CMakeFindDependencyMacro) -find_dependency(OpenSSL)]]) -endif() - -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") - -# Handle copyright -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/cmake/ports/mongoose/vcpkg.json b/cmake/ports/mongoose/vcpkg.json deleted file mode 100644 index 563bdb5060..0000000000 --- a/cmake/ports/mongoose/vcpkg.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "mongoose", - "version": "7.15", - "description": "Embedded web server / embedded networking library", - "homepage": "https://cesanta.com/", - "license": null, - "supports": "!uwp", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - } - ], - "features": { - "ssl": { - "description": "Build with openssl", - "dependencies": [ - "openssl" - ] - } - } -} diff --git a/cmake/ports/xlink/hunter.patch b/cmake/ports/xlink/hunter.patch deleted file mode 100644 index ee66e78cbd..0000000000 --- a/cmake/ports/xlink/hunter.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3161667..873cd8c 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -6,8 +6,8 @@ cmake_minimum_required(VERSION 3.2) - - include("cmake/HunterGate.cmake") - HunterGate( -- URL "https://github.com/cpp-pm/hunter/archive/v0.23.320.tar.gz" -- SHA1 "9b4e732afd22f40482c11ad6342f7d336634226f" -+ URL "https://github.com/cpp-pm/hunter/archive/v0.25.7.tar.gz" -+ SHA1 "99f05ff154c682f7349546d66294d2f69f7193bc" - LOCAL # Local config for dependencies - ) - diff --git a/cmake/ports/xlink/no-hunter.patch b/cmake/ports/xlink/no-hunter.patch new file mode 100644 index 0000000000..991030321c --- /dev/null +++ b/cmake/ports/xlink/no-hunter.patch @@ -0,0 +1,717 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3161667..664a20f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,12 +4,6 @@ + + cmake_minimum_required(VERSION 3.2) + +-include("cmake/HunterGate.cmake") +-HunterGate( +- URL "https://github.com/cpp-pm/hunter/archive/v0.23.320.tar.gz" +- SHA1 "9b4e732afd22f40482c11ad6342f7d336634226f" +- LOCAL # Local config for dependencies +-) + + ### Constants + set(TARGET_NAME "XLink") +@@ -31,10 +25,6 @@ option(XLINK_ENABLE_LIBUSB "Enable USB protocol which requires libusb library" O + option(XLINK_BUILD_EXAMPLES "Build XLink examples" OFF) + # Build tests + option(XLINK_BUILD_TESTS "Build XLink tests" OFF) +-# Debug option +-set(XLINK_LIBUSB_LOCAL "" CACHE STRING "Path to local libub source to use instead of Hunter") +-# Debug option +-option(XLINK_LIBUSB_SYSTEM "Use system libusb library instead of Hunter" OFF) + + # Specify exporting all symbols on Windows (WIP: shared library on windows doesn't yet work fully (eg logging)) + if(WIN32 AND BUILD_SHARED_LIBS) +@@ -66,13 +56,17 @@ if(is_multi_config) + set_target_properties(${TARGET_NAME} PROPERTIES DEBUG_POSTFIX "d") + endif() + ++# Define export header to support shared library on Windows ++include(GenerateExportHeader) ++generate_export_header(${TARGET_NAME} ++ EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}Export.h) + # Add dependencies + include(cmake/XLinkDependencies.cmake) + + if(XLINK_ENABLE_LIBUSB) + if(XLINK_LIBUSB_SYSTEM) + # Find system libusb +- find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h PATH_SUFFIXES "include" "libusb" "libusb-1.0") ++ find_path(LIBUSB_INCLUDE_DIR NAMES "libusb-1.0/libusb.h") + find_library(LIBUSB_LIBRARY NAMES usb-1.0 PATH_SUFFIXES "lib") + if(NOT LIBUSB_INCLUDE_DIR OR NOT LIBUSB_LIBRARY) + message(FATAL_ERROR "libusb is required") +@@ -85,13 +79,16 @@ if(XLINK_ENABLE_LIBUSB) + ) + else() + # Link to CMake libusb +- target_link_libraries(${TARGET_NAME} PRIVATE usb-1.0) ++ target_link_libraries(${TARGET_NAME} PRIVATE PkgConfig::libusb) + if(WIN32 AND NOT MINGW) +- target_link_libraries(${TARGET_NAME} PRIVATE delayimp.lib Pathcch.lib) ++ target_link_libraries(${TARGET_NAME} PRIVATE delayimp.lib) + # workaround https://gitlab.kitware.com/cmake/cmake/-/issues/20022 + target_link_options(${TARGET_NAME} PUBLIC "$:d>.dll>") + endif() + endif() ++ if(WIN32 AND NOT MINGW) ++ target_link_libraries(${TARGET_NAME} PRIVATE Pathcch.lib) ++ endif() + + # Add compile define stating a local libusb usage + if(XLINK_LIBUSB_LOCAL) +@@ -129,6 +126,7 @@ add_library(${TARGET_PUBLIC_NAME} INTERFACE) + target_include_directories(${TARGET_PUBLIC_NAME} INTERFACE + "$" + "$" ++ "$" + ) + + # Link to headers (public, as itself also needs the headers) +@@ -212,11 +210,6 @@ export(TARGETS ${TARGET_NAME} ${TARGET_PUBLIC_NAME} FILE "${PROJECT_NAME}Targets + # Dependencies file + configure_file("cmake/${PROJECT_NAME}Dependencies.cmake" ${PROJECT_NAME}Dependencies.cmake COPYONLY) + +-# Configure config file (one for exporting build directory, one for installation) +-if(${HUNTER_INSTALL_PREFIX}) +- file(RELATIVE_PATH XLINK_DEPENDENCIES_INSTALLATION_PATH_REL "${CMAKE_CURRENT_BINARY_DIR}" "${HUNTER_INSTALL_PREFIX}") +-endif() +- + configure_file(cmake/${PROJECT_NAME}Config.cmake.in ${PROJECT_NAME}Config.cmake @ONLY) + + # Config for installation +@@ -233,12 +226,11 @@ install( + ) + #Install include folder + install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +-# Install Hunter dependencies +-if(XLINK_ENABLE_LIBUSB) +- if(NOT XLINK_LIBUSB_LOCAL AND NOT XLINK_LIBUSB_SYSTEM) +- install(DIRECTORY "${HUNTER_INSTALL_PREFIX}/" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/dependencies") +- endif() +-endif() ++# Install generated export header ++install( ++ FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}Export.h ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/XLink ++) + # Install export group (information about targets) + install(EXPORT ${PROJECT_EXPORT_GROUP} + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" +diff --git a/cmake/Hunter/config.cmake b/cmake/Hunter/config.cmake +deleted file mode 100644 +index 8bb4c5e..0000000 +--- a/cmake/Hunter/config.cmake ++++ /dev/null +@@ -1,11 +0,0 @@ +-# libusb without udev +-hunter_config( +- libusb-luxonis +- VERSION "1.0.24-cmake" +- URL "https://github.com/luxonis/libusb/archive/b7e4548958325b18feb73977163ad44398099534.tar.gz" +- SHA1 "2d79573d57628fe56d2868d2f6ce756d40906cf4" +- CMAKE_ARGS +- WITH_UDEV=OFF +- # Build shared libs by default to not cause licensing issues +- BUILD_SHARED_LIBS=ON +-) +diff --git a/cmake/HunterGate.cmake b/cmake/HunterGate.cmake +deleted file mode 100644 +index 6d9cc24..0000000 +--- a/cmake/HunterGate.cmake ++++ /dev/null +@@ -1,539 +0,0 @@ +-# Copyright (c) 2013-2019, Ruslan Baratov +-# All rights reserved. +-# +-# Redistribution and use in source and binary forms, with or without +-# modification, are permitted provided that the following conditions are met: +-# +-# * Redistributions of source code must retain the above copyright notice, this +-# list of conditions and the following disclaimer. +-# +-# * Redistributions in binary form must reproduce the above copyright notice, +-# this list of conditions and the following disclaimer in the documentation +-# and/or other materials provided with the distribution. +-# +-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +-# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- +-# This is a gate file to Hunter package manager. +-# Include this file using `include` command and add package you need, example: +-# +-# cmake_minimum_required(VERSION 3.2) +-# +-# include("cmake/HunterGate.cmake") +-# HunterGate( +-# URL "https://github.com/path/to/hunter/archive.tar.gz" +-# SHA1 "798501e983f14b28b10cda16afa4de69eee1da1d" +-# ) +-# +-# project(MyProject) +-# +-# hunter_add_package(Foo) +-# hunter_add_package(Boo COMPONENTS Bar Baz) +-# +-# Projects: +-# * https://github.com/hunter-packages/gate/ +-# * https://github.com/ruslo/hunter +- +-option(HUNTER_ENABLED "Enable Hunter package manager support" ON) +- +-if(HUNTER_ENABLED) +- if(CMAKE_VERSION VERSION_LESS "3.2") +- message( +- FATAL_ERROR +- "At least CMake version 3.2 required for Hunter dependency management." +- " Update CMake or set HUNTER_ENABLED to OFF." +- ) +- endif() +-endif() +- +-include(CMakeParseArguments) # cmake_parse_arguments +- +-option(HUNTER_STATUS_PRINT "Print working status" ON) +-option(HUNTER_STATUS_DEBUG "Print a lot info" OFF) +-option(HUNTER_TLS_VERIFY "Enable/disable TLS certificate checking on downloads" ON) +- +-set(HUNTER_ERROR_PAGE "https://docs.hunter.sh/en/latest/reference/errors") +- +-function(hunter_gate_status_print) +- if(HUNTER_STATUS_PRINT OR HUNTER_STATUS_DEBUG) +- foreach(print_message ${ARGV}) +- message(STATUS "[hunter] ${print_message}") +- endforeach() +- endif() +-endfunction() +- +-function(hunter_gate_status_debug) +- if(HUNTER_STATUS_DEBUG) +- foreach(print_message ${ARGV}) +- string(TIMESTAMP timestamp) +- message(STATUS "[hunter *** DEBUG *** ${timestamp}] ${print_message}") +- endforeach() +- endif() +-endfunction() +- +-function(hunter_gate_error_page error_page) +- message("------------------------------ ERROR ------------------------------") +- message(" ${HUNTER_ERROR_PAGE}/${error_page}.html") +- message("-------------------------------------------------------------------") +- message("") +- message(FATAL_ERROR "") +-endfunction() +- +-function(hunter_gate_internal_error) +- message("") +- foreach(print_message ${ARGV}) +- message("[hunter ** INTERNAL **] ${print_message}") +- endforeach() +- message("[hunter ** INTERNAL **] [Directory:${CMAKE_CURRENT_LIST_DIR}]") +- message("") +- hunter_gate_error_page("error.internal") +-endfunction() +- +-function(hunter_gate_fatal_error) +- cmake_parse_arguments(hunter "" "ERROR_PAGE" "" "${ARGV}") +- if("${hunter_ERROR_PAGE}" STREQUAL "") +- hunter_gate_internal_error("Expected ERROR_PAGE") +- endif() +- message("") +- foreach(x ${hunter_UNPARSED_ARGUMENTS}) +- message("[hunter ** FATAL ERROR **] ${x}") +- endforeach() +- message("[hunter ** FATAL ERROR **] [Directory:${CMAKE_CURRENT_LIST_DIR}]") +- message("") +- hunter_gate_error_page("${hunter_ERROR_PAGE}") +-endfunction() +- +-function(hunter_gate_user_error) +- hunter_gate_fatal_error(${ARGV} ERROR_PAGE "error.incorrect.input.data") +-endfunction() +- +-function(hunter_gate_self root version sha1 result) +- string(COMPARE EQUAL "${root}" "" is_bad) +- if(is_bad) +- hunter_gate_internal_error("root is empty") +- endif() +- +- string(COMPARE EQUAL "${version}" "" is_bad) +- if(is_bad) +- hunter_gate_internal_error("version is empty") +- endif() +- +- string(COMPARE EQUAL "${sha1}" "" is_bad) +- if(is_bad) +- hunter_gate_internal_error("sha1 is empty") +- endif() +- +- string(SUBSTRING "${sha1}" 0 7 archive_id) +- +- if(EXISTS "${root}/cmake/Hunter") +- set(hunter_self "${root}") +- else() +- set( +- hunter_self +- "${root}/_Base/Download/Hunter/${version}/${archive_id}/Unpacked" +- ) +- endif() +- +- set("${result}" "${hunter_self}" PARENT_SCOPE) +-endfunction() +- +-# Set HUNTER_GATE_ROOT cmake variable to suitable value. +-function(hunter_gate_detect_root) +- # Check CMake variable +- string(COMPARE NOTEQUAL "${HUNTER_ROOT}" "" not_empty) +- if(not_empty) +- set(HUNTER_GATE_ROOT "${HUNTER_ROOT}" PARENT_SCOPE) +- hunter_gate_status_debug("HUNTER_ROOT detected by cmake variable") +- return() +- endif() +- +- # Check environment variable +- string(COMPARE NOTEQUAL "$ENV{HUNTER_ROOT}" "" not_empty) +- if(not_empty) +- set(HUNTER_GATE_ROOT "$ENV{HUNTER_ROOT}" PARENT_SCOPE) +- hunter_gate_status_debug("HUNTER_ROOT detected by environment variable") +- return() +- endif() +- +- # Check HOME environment variable +- string(COMPARE NOTEQUAL "$ENV{HOME}" "" result) +- if(result) +- set(HUNTER_GATE_ROOT "$ENV{HOME}/.hunter" PARENT_SCOPE) +- hunter_gate_status_debug("HUNTER_ROOT set using HOME environment variable") +- return() +- endif() +- +- # Check SYSTEMDRIVE and USERPROFILE environment variable (windows only) +- if(WIN32) +- string(COMPARE NOTEQUAL "$ENV{SYSTEMDRIVE}" "" result) +- if(result) +- set(HUNTER_GATE_ROOT "$ENV{SYSTEMDRIVE}/.hunter" PARENT_SCOPE) +- hunter_gate_status_debug( +- "HUNTER_ROOT set using SYSTEMDRIVE environment variable" +- ) +- return() +- endif() +- +- string(COMPARE NOTEQUAL "$ENV{USERPROFILE}" "" result) +- if(result) +- set(HUNTER_GATE_ROOT "$ENV{USERPROFILE}/.hunter" PARENT_SCOPE) +- hunter_gate_status_debug( +- "HUNTER_ROOT set using USERPROFILE environment variable" +- ) +- return() +- endif() +- endif() +- +- hunter_gate_fatal_error( +- "Can't detect HUNTER_ROOT" +- ERROR_PAGE "error.detect.hunter.root" +- ) +-endfunction() +- +-function(hunter_gate_download dir) +- string( +- COMPARE +- NOTEQUAL +- "$ENV{HUNTER_DISABLE_AUTOINSTALL}" +- "" +- disable_autoinstall +- ) +- if(disable_autoinstall AND NOT HUNTER_RUN_INSTALL) +- hunter_gate_fatal_error( +- "Hunter not found in '${dir}'" +- "Set HUNTER_RUN_INSTALL=ON to auto-install it from '${HUNTER_GATE_URL}'" +- "Settings:" +- " HUNTER_ROOT: ${HUNTER_GATE_ROOT}" +- " HUNTER_SHA1: ${HUNTER_GATE_SHA1}" +- ERROR_PAGE "error.run.install" +- ) +- endif() +- string(COMPARE EQUAL "${dir}" "" is_bad) +- if(is_bad) +- hunter_gate_internal_error("Empty 'dir' argument") +- endif() +- +- string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" is_bad) +- if(is_bad) +- hunter_gate_internal_error("HUNTER_GATE_SHA1 empty") +- endif() +- +- string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" is_bad) +- if(is_bad) +- hunter_gate_internal_error("HUNTER_GATE_URL empty") +- endif() +- +- set(done_location "${dir}/DONE") +- set(sha1_location "${dir}/SHA1") +- +- set(build_dir "${dir}/Build") +- set(cmakelists "${dir}/CMakeLists.txt") +- +- hunter_gate_status_debug("Locking directory: ${dir}") +- file(LOCK "${dir}" DIRECTORY GUARD FUNCTION) +- hunter_gate_status_debug("Lock done") +- +- if(EXISTS "${done_location}") +- # while waiting for lock other instance can do all the job +- hunter_gate_status_debug("File '${done_location}' found, skip install") +- return() +- endif() +- +- file(REMOVE_RECURSE "${build_dir}") +- file(REMOVE_RECURSE "${cmakelists}") +- +- file(MAKE_DIRECTORY "${build_dir}") # check directory permissions +- +- # Disabling languages speeds up a little bit, reduces noise in the output +- # and avoids path too long windows error +- file( +- WRITE +- "${cmakelists}" +- "cmake_minimum_required(VERSION 3.2)\n" +- "project(HunterDownload LANGUAGES NONE)\n" +- "include(ExternalProject)\n" +- "ExternalProject_Add(\n" +- " Hunter\n" +- " URL\n" +- " \"${HUNTER_GATE_URL}\"\n" +- " URL_HASH\n" +- " SHA1=${HUNTER_GATE_SHA1}\n" +- " DOWNLOAD_DIR\n" +- " \"${dir}\"\n" +- " TLS_VERIFY\n" +- " ${HUNTER_TLS_VERIFY}\n" +- " SOURCE_DIR\n" +- " \"${dir}/Unpacked\"\n" +- " CONFIGURE_COMMAND\n" +- " \"\"\n" +- " BUILD_COMMAND\n" +- " \"\"\n" +- " INSTALL_COMMAND\n" +- " \"\"\n" +- ")\n" +- ) +- +- if(HUNTER_STATUS_DEBUG) +- set(logging_params "") +- else() +- set(logging_params OUTPUT_QUIET) +- endif() +- +- hunter_gate_status_debug("Run generate") +- +- # Need to add toolchain file too. +- # Otherwise on Visual Studio + MDD this will fail with error: +- # "Could not find an appropriate version of the Windows 10 SDK installed on this machine" +- if(EXISTS "${CMAKE_TOOLCHAIN_FILE}") +- get_filename_component(absolute_CMAKE_TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}" ABSOLUTE) +- set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=${absolute_CMAKE_TOOLCHAIN_FILE}") +- else() +- # 'toolchain_arg' can't be empty +- set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=") +- endif() +- +- string(COMPARE EQUAL "${CMAKE_MAKE_PROGRAM}" "" no_make) +- if(no_make) +- set(make_arg "") +- else() +- # Test case: remove Ninja from PATH but set it via CMAKE_MAKE_PROGRAM +- set(make_arg "-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}") +- endif() +- +- execute_process( +- COMMAND +- "${CMAKE_COMMAND}" +- "-H${dir}" +- "-B${build_dir}" +- "-G${CMAKE_GENERATOR}" +- "${toolchain_arg}" +- ${make_arg} +- WORKING_DIRECTORY "${dir}" +- RESULT_VARIABLE download_result +- ${logging_params} +- ) +- +- if(NOT download_result EQUAL 0) +- hunter_gate_internal_error( +- "Configure project failed." +- "To reproduce the error run: ${CMAKE_COMMAND} -H${dir} -B${build_dir} -G${CMAKE_GENERATOR} ${toolchain_arg} ${make_arg}" +- "In directory ${dir}" +- ) +- endif() +- +- hunter_gate_status_print( +- "Initializing Hunter workspace (${HUNTER_GATE_SHA1})" +- " ${HUNTER_GATE_URL}" +- " -> ${dir}" +- ) +- execute_process( +- COMMAND "${CMAKE_COMMAND}" --build "${build_dir}" +- WORKING_DIRECTORY "${dir}" +- RESULT_VARIABLE download_result +- ${logging_params} +- ) +- +- if(NOT download_result EQUAL 0) +- hunter_gate_internal_error("Build project failed") +- endif() +- +- file(REMOVE_RECURSE "${build_dir}") +- file(REMOVE_RECURSE "${cmakelists}") +- +- file(WRITE "${sha1_location}" "${HUNTER_GATE_SHA1}") +- file(WRITE "${done_location}" "DONE") +- +- hunter_gate_status_debug("Finished") +-endfunction() +- +-# Must be a macro so master file 'cmake/Hunter' can +-# apply all variables easily just by 'include' command +-# (otherwise PARENT_SCOPE magic needed) +-macro(HunterGate) +- if(HUNTER_GATE_DONE) +- # variable HUNTER_GATE_DONE set explicitly for external project +- # (see `hunter_download`) +- set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES) +- endif() +- +- # First HunterGate command will init Hunter, others will be ignored +- get_property(_hunter_gate_done GLOBAL PROPERTY HUNTER_GATE_DONE SET) +- +- if(NOT HUNTER_ENABLED) +- # Empty function to avoid error "unknown function" +- function(hunter_add_package) +- endfunction() +- +- set( +- _hunter_gate_disabled_mode_dir +- "${CMAKE_CURRENT_LIST_DIR}/cmake/Hunter/disabled-mode" +- ) +- if(EXISTS "${_hunter_gate_disabled_mode_dir}") +- hunter_gate_status_debug( +- "Adding \"disabled-mode\" modules: ${_hunter_gate_disabled_mode_dir}" +- ) +- list(APPEND CMAKE_PREFIX_PATH "${_hunter_gate_disabled_mode_dir}") +- endif() +- elseif(_hunter_gate_done) +- hunter_gate_status_debug("Secondary HunterGate (use old settings)") +- hunter_gate_self( +- "${HUNTER_CACHED_ROOT}" +- "${HUNTER_VERSION}" +- "${HUNTER_SHA1}" +- _hunter_self +- ) +- include("${_hunter_self}/cmake/Hunter") +- else() +- set(HUNTER_GATE_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}") +- +- string(COMPARE NOTEQUAL "${PROJECT_NAME}" "" _have_project_name) +- if(_have_project_name) +- hunter_gate_fatal_error( +- "Please set HunterGate *before* 'project' command. " +- "Detected project: ${PROJECT_NAME}" +- ERROR_PAGE "error.huntergate.before.project" +- ) +- endif() +- +- cmake_parse_arguments( +- HUNTER_GATE "LOCAL" "URL;SHA1;GLOBAL;FILEPATH" "" ${ARGV} +- ) +- +- string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" _empty_sha1) +- string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" _empty_url) +- string( +- COMPARE +- NOTEQUAL +- "${HUNTER_GATE_UNPARSED_ARGUMENTS}" +- "" +- _have_unparsed +- ) +- string(COMPARE NOTEQUAL "${HUNTER_GATE_GLOBAL}" "" _have_global) +- string(COMPARE NOTEQUAL "${HUNTER_GATE_FILEPATH}" "" _have_filepath) +- +- if(_have_unparsed) +- hunter_gate_user_error( +- "HunterGate unparsed arguments: ${HUNTER_GATE_UNPARSED_ARGUMENTS}" +- ) +- endif() +- if(_empty_sha1) +- hunter_gate_user_error("SHA1 suboption of HunterGate is mandatory") +- endif() +- if(_empty_url) +- hunter_gate_user_error("URL suboption of HunterGate is mandatory") +- endif() +- if(_have_global) +- if(HUNTER_GATE_LOCAL) +- hunter_gate_user_error("Unexpected LOCAL (already has GLOBAL)") +- endif() +- if(_have_filepath) +- hunter_gate_user_error("Unexpected FILEPATH (already has GLOBAL)") +- endif() +- endif() +- if(HUNTER_GATE_LOCAL) +- if(_have_global) +- hunter_gate_user_error("Unexpected GLOBAL (already has LOCAL)") +- endif() +- if(_have_filepath) +- hunter_gate_user_error("Unexpected FILEPATH (already has LOCAL)") +- endif() +- endif() +- if(_have_filepath) +- if(_have_global) +- hunter_gate_user_error("Unexpected GLOBAL (already has FILEPATH)") +- endif() +- if(HUNTER_GATE_LOCAL) +- hunter_gate_user_error("Unexpected LOCAL (already has FILEPATH)") +- endif() +- endif() +- +- hunter_gate_detect_root() # set HUNTER_GATE_ROOT +- +- # Beautify path, fix probable problems with windows path slashes +- get_filename_component( +- HUNTER_GATE_ROOT "${HUNTER_GATE_ROOT}" ABSOLUTE +- ) +- hunter_gate_status_debug("HUNTER_ROOT: ${HUNTER_GATE_ROOT}") +- if(NOT HUNTER_ALLOW_SPACES_IN_PATH) +- string(FIND "${HUNTER_GATE_ROOT}" " " _contain_spaces) +- if(NOT _contain_spaces EQUAL -1) +- hunter_gate_fatal_error( +- "HUNTER_ROOT (${HUNTER_GATE_ROOT}) contains spaces." +- "Set HUNTER_ALLOW_SPACES_IN_PATH=ON to skip this error" +- "(Use at your own risk!)" +- ERROR_PAGE "error.spaces.in.hunter.root" +- ) +- endif() +- endif() +- +- string( +- REGEX +- MATCH +- "[0-9]+\\.[0-9]+\\.[0-9]+[-_a-z0-9]*" +- HUNTER_GATE_VERSION +- "${HUNTER_GATE_URL}" +- ) +- string(COMPARE EQUAL "${HUNTER_GATE_VERSION}" "" _is_empty) +- if(_is_empty) +- set(HUNTER_GATE_VERSION "unknown") +- endif() +- +- hunter_gate_self( +- "${HUNTER_GATE_ROOT}" +- "${HUNTER_GATE_VERSION}" +- "${HUNTER_GATE_SHA1}" +- _hunter_self +- ) +- +- set(_master_location "${_hunter_self}/cmake/Hunter") +- if(EXISTS "${HUNTER_GATE_ROOT}/cmake/Hunter") +- # Hunter downloaded manually (e.g. by 'git clone') +- set(_unused "xxxxxxxxxx") +- set(HUNTER_GATE_SHA1 "${_unused}") +- set(HUNTER_GATE_VERSION "${_unused}") +- else() +- get_filename_component(_archive_id_location "${_hunter_self}/.." ABSOLUTE) +- set(_done_location "${_archive_id_location}/DONE") +- set(_sha1_location "${_archive_id_location}/SHA1") +- +- # Check Hunter already downloaded by HunterGate +- if(NOT EXISTS "${_done_location}") +- hunter_gate_download("${_archive_id_location}") +- endif() +- +- if(NOT EXISTS "${_done_location}") +- hunter_gate_internal_error("hunter_gate_download failed") +- endif() +- +- if(NOT EXISTS "${_sha1_location}") +- hunter_gate_internal_error("${_sha1_location} not found") +- endif() +- file(READ "${_sha1_location}" _sha1_value) +- string(COMPARE EQUAL "${_sha1_value}" "${HUNTER_GATE_SHA1}" _is_equal) +- if(NOT _is_equal) +- hunter_gate_internal_error( +- "Short SHA1 collision:" +- " ${_sha1_value} (from ${_sha1_location})" +- " ${HUNTER_GATE_SHA1} (HunterGate)" +- ) +- endif() +- if(NOT EXISTS "${_master_location}") +- hunter_gate_user_error( +- "Master file not found:" +- " ${_master_location}" +- "try to update Hunter/HunterGate" +- ) +- endif() +- endif() +- include("${_master_location}") +- set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES) +- endif() +-endmacro() +diff --git a/cmake/XLinkDependencies.cmake b/cmake/XLinkDependencies.cmake +index 1072d1d..4cc1e88 100644 +--- a/cmake/XLinkDependencies.cmake ++++ b/cmake/XLinkDependencies.cmake +@@ -5,13 +5,6 @@ if(CONFIG_MODE) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE "BOTH") + set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/${_IMPORT_PREFIX}" ${CMAKE_PREFIX_PATH}) + set(_QUIET "QUIET") +-else() +- # set(XLINK_SHARED_LIBS ${BUILD_SHARED_LIBS}) +- if(XLINK_ENABLE_LIBUSB) +- if(NOT XLINK_LIBUSB_LOCAL AND NOT XLINK_LIBUSB_SYSTEM) +- hunter_add_package(libusb-luxonis) +- endif() +- endif() + endif() + + # libusb +@@ -19,7 +12,8 @@ if(XLINK_ENABLE_LIBUSB) + if(XLINK_LIBUSB_LOCAL) + add_subdirectory("${XLINK_LIBUSB_LOCAL}" "${CMAKE_CURRENT_BINARY_DIR}/libusb" EXCLUDE_FROM_ALL) + elseif(NOT XLINK_LIBUSB_SYSTEM) +- find_package(usb-1.0 ${_QUIET} CONFIG REQUIRED HINTS "${CMAKE_CURRENT_LIST_DIR}/libusb") ++ find_package(PkgConfig REQUIRED) ++ pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0) + endif() + endif() + +diff --git a/include/XLink/XLinkLog.h b/include/XLink/XLinkLog.h +index e487c71..7e1ccb3 100644 +--- a/include/XLink/XLinkLog.h ++++ b/include/XLink/XLinkLog.h +@@ -29,6 +29,7 @@ extern "C" { + #include + #include + #include ++#include "XLinkExport.h" + + #ifndef _GNU_SOURCE + #define _GNU_SOURCE +@@ -72,8 +73,8 @@ FUNCATTR_WEAK mvLog_t __attribute__ ((weak)) MVLOGLEVEL(MVLOG_UNIT_NAME) = MVLOG + #define UNIT_NAME_STR MVLOG_STR(MVLOG_UNIT_NAME) + + +-extern mvLog_t MVLOGLEVEL(global); +-extern mvLog_t MVLOGLEVEL(default); ++extern XLINK_EXPORT mvLog_t MVLOGLEVEL(global); ++extern XLINK_EXPORT mvLog_t MVLOGLEVEL(default); + + int __attribute__ ((unused)) logprintf(mvLog_t curLogLvl, mvLog_t lvl, const char * func, const int line, const char * format, ...); + diff --git a/cmake/ports/xlink/portfile.cmake b/cmake/ports/xlink/portfile.cmake index d1effdfb42..277e51984e 100644 --- a/cmake/ports/xlink/portfile.cmake +++ b/cmake/ports/xlink/portfile.cmake @@ -5,9 +5,7 @@ vcpkg_from_github( SHA512 35fb1c1ee8dea69a6bf577fb374fe6dd3cf815e7baef70671732fa8062d81fc34c17439fbe95f3bfe1a4266e0bc4e47b0d033c8abf586bbd7e0713891ffe6c28 HEAD_REF develop_server PATCHES - hunter.patch - windows.patch - windows-link.patch + no-hunter.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES diff --git a/cmake/ports/xlink/vcpkg.json b/cmake/ports/xlink/vcpkg.json index 6b9fdcea7e..b5075130fb 100644 --- a/cmake/ports/xlink/vcpkg.json +++ b/cmake/ports/xlink/vcpkg.json @@ -14,7 +14,12 @@ ], "features": { "libusb": { - "description": "Build with libusb support" + "description": "Build with libusb support", + "dependencies": [ + { + "name": "libusb" + } + ] } } diff --git a/cmake/ports/xlink/windows-link.patch b/cmake/ports/xlink/windows-link.patch deleted file mode 100644 index 1de3e1318a..0000000000 --- a/cmake/ports/xlink/windows-link.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3806520..43dcfde 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -92,11 +92,14 @@ if(XLINK_ENABLE_LIBUSB) - # Link to CMake libusb - target_link_libraries(${TARGET_NAME} PRIVATE usb-1.0) - if(WIN32 AND NOT MINGW) -- target_link_libraries(${TARGET_NAME} PRIVATE delayimp.lib Pathcch.lib) -+ target_link_libraries(${TARGET_NAME} PRIVATE delayimp.lib) - # workaround https://gitlab.kitware.com/cmake/cmake/-/issues/20022 - target_link_options(${TARGET_NAME} PUBLIC "$:d>.dll>") - endif() - endif() -+ if(WIN32 AND NOT MINGW) -+ target_link_libraries(${TARGET_NAME} PRIVATE Pathcch.lib) -+ endif() - - # Add compile define stating a local libusb usage - if(XLINK_LIBUSB_LOCAL) diff --git a/cmake/ports/xlink/windows.patch b/cmake/ports/xlink/windows.patch deleted file mode 100644 index 0c2567fd2c..0000000000 --- a/cmake/ports/xlink/windows.patch +++ /dev/null @@ -1,67 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 873cd8c..3806520 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -66,13 +66,18 @@ if(is_multi_config) - set_target_properties(${TARGET_NAME} PROPERTIES DEBUG_POSTFIX "d") - endif() - -+# Define export header to support shared library on Windows -+include(GenerateExportHeader) -+generate_export_header(${TARGET_NAME} -+ EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}Export.h) -+ - # Add dependencies - include(cmake/XLinkDependencies.cmake) - - if(XLINK_ENABLE_LIBUSB) - if(XLINK_LIBUSB_SYSTEM) - # Find system libusb -- find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h PATH_SUFFIXES "include" "libusb" "libusb-1.0") -+ find_path(LIBUSB_INCLUDE_DIR NAMES "libusb-1.0/libusb.h") - find_library(LIBUSB_LIBRARY NAMES usb-1.0 PATH_SUFFIXES "lib") - if(NOT LIBUSB_INCLUDE_DIR OR NOT LIBUSB_LIBRARY) - message(FATAL_ERROR "libusb is required") -@@ -129,6 +134,7 @@ add_library(${TARGET_PUBLIC_NAME} INTERFACE) - target_include_directories(${TARGET_PUBLIC_NAME} INTERFACE - "$" - "$" -+ "$" - ) - - # Link to headers (public, as itself also needs the headers) -@@ -233,6 +239,11 @@ install( - ) - #Install include folder - install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -+# Install generated export header -+install( -+ FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}Export.h -+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/XLink -+) - # Install Hunter dependencies - if(XLINK_ENABLE_LIBUSB) - if(NOT XLINK_LIBUSB_LOCAL AND NOT XLINK_LIBUSB_SYSTEM) -diff --git a/include/XLink/XLinkLog.h b/include/XLink/XLinkLog.h -index e487c71..7e1ccb3 100644 ---- a/include/XLink/XLinkLog.h -+++ b/include/XLink/XLinkLog.h -@@ -29,6 +29,7 @@ extern "C" { - #include - #include - #include -+#include "XLinkExport.h" - - #ifndef _GNU_SOURCE - #define _GNU_SOURCE -@@ -72,8 +73,8 @@ FUNCATTR_WEAK mvLog_t __attribute__ ((weak)) MVLOGLEVEL(MVLOG_UNIT_NAME) = MVLOG - #define UNIT_NAME_STR MVLOG_STR(MVLOG_UNIT_NAME) - - --extern mvLog_t MVLOGLEVEL(global); --extern mvLog_t MVLOGLEVEL(default); -+extern XLINK_EXPORT mvLog_t MVLOGLEVEL(global); -+extern XLINK_EXPORT mvLog_t MVLOGLEVEL(default); - - int __attribute__ ((unused)) logprintf(mvLog_t curLogLvl, mvLog_t lvl, const char * func, const int line, const char * format, ...); - From ed6166008bd638e261b8e087af53de74f19144a3 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 20 Nov 2024 18:50:23 +0100 Subject: [PATCH 093/131] update opencv port --- vcpkg-configuration.json | 2 +- vcpkg.json | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index a27db75cf2..e62110f443 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -1,7 +1,7 @@ { "default-registry": { "kind": "git", - "baseline": "509f71e53f45e46c13fa7935d2f6a45803580c07", + "baseline": "89f00b3b8611028566a5264afce725cdfdfddbb4", "repository": "https://github.com/microsoft/vcpkg" }, "registries": [ diff --git a/vcpkg.json b/vcpkg.json index ddd434df82..87825e8c4d 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -29,12 +29,31 @@ "name": "opencv4", "default-features": false, "features": [ + "calib3d", "jpeg", "png", "quirc", "tiff", - "webp" + "webp", + "highgui" ] + }, + { + "name": "opencv4", + "default-features": false, + "features": [ + "gtk" + ], + "platform": "linux" + }, + { + "name": "opencv4", + "default-features": false, + "features": [ + "dshow", + "win32ui" + ], + "platform": "windows & !uwp" } ], "features": { From e8a2630919dddd0fc9353e0e1067f165d4704c41 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 20 Nov 2024 19:31:22 +0100 Subject: [PATCH 094/131] revert back --- vcpkg-configuration.json | 2 +- vcpkg.json | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index e62110f443..a27db75cf2 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -1,7 +1,7 @@ { "default-registry": { "kind": "git", - "baseline": "89f00b3b8611028566a5264afce725cdfdfddbb4", + "baseline": "509f71e53f45e46c13fa7935d2f6a45803580c07", "repository": "https://github.com/microsoft/vcpkg" }, "registries": [ diff --git a/vcpkg.json b/vcpkg.json index 87825e8c4d..21267f062b 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -29,13 +29,11 @@ "name": "opencv4", "default-features": false, "features": [ - "calib3d", "jpeg", "png", "quirc", "tiff", - "webp", - "highgui" + "webp" ] }, { @@ -45,15 +43,6 @@ "gtk" ], "platform": "linux" - }, - { - "name": "opencv4", - "default-features": false, - "features": [ - "dshow", - "win32ui" - ], - "platform": "windows & !uwp" } ], "features": { From 08a4437054f26544fd5a4ac115afa321b756c0bc Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 21 Nov 2024 18:11:35 +0100 Subject: [PATCH 095/131] xlink libusb external, ffmpeg opencv --- CMakeLists.txt | 17 +++++++++-------- cmake/ports/libusb/portfile.cmake | 19 +++++++++++++++++++ cmake/ports/libusb/vcpkg.json | 19 +++++++++++++++++++ cmake/ports/xlink/no-hunter.patch | 21 ++++----------------- tests/CMakeLists.txt | 28 ++++++++++++++-------------- vcpkg.json | 3 ++- 6 files changed, 67 insertions(+), 40 deletions(-) create mode 100644 cmake/ports/libusb/portfile.cmake create mode 100644 cmake/ports/libusb/vcpkg.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 52cfdd8bc5..d3a7bf721c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -486,6 +486,7 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15) # Link merged target libraries and add compile definitions if(DEPTHAI_HAVE_OPENCV_SUPPORT AND DEPTHAI_MERGED_TARGET) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic") # needed for ffmpeg linking # Link to OpenCV (publically) target_link_libraries(${TARGET_CORE_NAME} PUBLIC ${REQUIRED_OPENCV_LIBRARIES} ${THIRDPARTY_OPENCV_LIBRARIES}) @@ -1049,33 +1050,33 @@ if(DEPTHAI_SANITIZE) endif() endif() endif() -function(hunter_private_data) +function(private_data) set(one URL SHA1 CREDENTIALS LOCATION FILE) set(multiple HTTPHEADER) cmake_parse_arguments(x "" "${one}" "${multiple}" "${ARGN}") if(x_HTTPHEADER) - message(FATAL_ERROR "HTTPHEADER argument of hunter_private_data not supported if HUNTER_ENABLED is OFF") + message(FATAL_ERROR "HTTPHEADER argument of private_data not supported if HUNTER_ENABLED is OFF") endif() if(x_CREDENTIALS) - message(FATAL_ERROR "CREDENTIALS argument of hunter_private_data not supported if HUNTER_ENABLED is OFF") + message(FATAL_ERROR "CREDENTIALS argument of private_data not supported if HUNTER_ENABLED is OFF") endif() if(NOT x_URL) - message(FATAL_ERROR "URL not provided to hunter_private_data") + message(FATAL_ERROR "URL not provided to private_data") endif() if(NOT x_SHA1) - message(FATAL_ERROR "SHA1 not provided to hunter_private_data") + message(FATAL_ERROR "SHA1 not provided to private_data") endif() if(NOT x_FILE) - message(FATAL_ERROR "FILE not provided to hunter_private_data") + message(FATAL_ERROR "FILE not provided to private_data") endif() if(NOT x_LOCATION) - message(FATAL_ERROR "LOCATION not provided to hunter_private_data") + message(FATAL_ERROR "LOCATION not provided to private_data") endif() - set(x_DOWNLOAD_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/_hunter_private_data/${x_FILE}") + set(x_DOWNLOAD_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/_private_data/${x_FILE}") file(DOWNLOAD ${x_URL} diff --git a/cmake/ports/libusb/portfile.cmake b/cmake/ports/libusb/portfile.cmake new file mode 100644 index 0000000000..b99523517d --- /dev/null +++ b/cmake/ports/libusb/portfile.cmake @@ -0,0 +1,19 @@ + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO luxonis/libusb + REF b7e4548958325b18feb73977163ad44398099534 + SHA512 b0fd00fe623a6fe527046002d94201cfe2dffe589bd77aa88473f25960e3ce7206a90290ee4fe66fa2e91766c5f6585379ba2b008e9fc7b33da43763127a4ef2 + HEAD_REF main +) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + WITH_UDEV=OFF + # Build shared libs by default to not cause licensing issues + BUILD_SHARED_LIBS=ON +) + +vcpkg_cmake_install() + +vcpkg_fixup_pkgconfig() diff --git a/cmake/ports/libusb/vcpkg.json b/cmake/ports/libusb/vcpkg.json new file mode 100644 index 0000000000..63ad02d45f --- /dev/null +++ b/cmake/ports/libusb/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "libusb", + "version": "1.0.27", + "port-version": 2, + "description": "a cross-platform library to access USB devices", + "homepage": "https://github.com/libusb/libusb", + "license": "LGPL-2.1-or-later", + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/cmake/ports/xlink/no-hunter.patch b/cmake/ports/xlink/no-hunter.patch index 991030321c..51b62bcef0 100644 --- a/cmake/ports/xlink/no-hunter.patch +++ b/cmake/ports/xlink/no-hunter.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3161667..664a20f 100644 +index 3161667..7deaad5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,12 +4,6 @@ @@ -45,12 +45,9 @@ index 3161667..664a20f 100644 find_library(LIBUSB_LIBRARY NAMES usb-1.0 PATH_SUFFIXES "lib") if(NOT LIBUSB_INCLUDE_DIR OR NOT LIBUSB_LIBRARY) message(FATAL_ERROR "libusb is required") -@@ -85,13 +79,16 @@ if(XLINK_ENABLE_LIBUSB) - ) - else() +@@ -87,11 +81,14 @@ if(XLINK_ENABLE_LIBUSB) # Link to CMake libusb -- target_link_libraries(${TARGET_NAME} PRIVATE usb-1.0) -+ target_link_libraries(${TARGET_NAME} PRIVATE PkgConfig::libusb) + target_link_libraries(${TARGET_NAME} PRIVATE usb-1.0) if(WIN32 AND NOT MINGW) - target_link_libraries(${TARGET_NAME} PRIVATE delayimp.lib Pathcch.lib) + target_link_libraries(${TARGET_NAME} PRIVATE delayimp.lib) @@ -665,7 +662,7 @@ index 6d9cc24..0000000 - endif() -endmacro() diff --git a/cmake/XLinkDependencies.cmake b/cmake/XLinkDependencies.cmake -index 1072d1d..4cc1e88 100644 +index 1072d1d..7bc47e6 100644 --- a/cmake/XLinkDependencies.cmake +++ b/cmake/XLinkDependencies.cmake @@ -5,13 +5,6 @@ if(CONFIG_MODE) @@ -682,16 +679,6 @@ index 1072d1d..4cc1e88 100644 endif() # libusb -@@ -19,7 +12,8 @@ if(XLINK_ENABLE_LIBUSB) - if(XLINK_LIBUSB_LOCAL) - add_subdirectory("${XLINK_LIBUSB_LOCAL}" "${CMAKE_CURRENT_BINARY_DIR}/libusb" EXCLUDE_FROM_ALL) - elseif(NOT XLINK_LIBUSB_SYSTEM) -- find_package(usb-1.0 ${_QUIET} CONFIG REQUIRED HINTS "${CMAKE_CURRENT_LIST_DIR}/libusb") -+ find_package(PkgConfig REQUIRED) -+ pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0) - endif() - endif() - diff --git a/include/XLink/XLinkLog.h b/include/XLink/XLinkLog.h index e487c71..7e1ccb3 100644 --- a/include/XLink/XLinkLog.h diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4049b0c260..5cb1782ede 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -110,7 +110,7 @@ function(dai_test_compile_definitions) endfunction() # Mobilenet network -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/mobilenet-ssd_openvino_2021.2_8shave.blob" SHA1 "3329bb8f3a9c881ef9756d232055f9d6f38aa07b" FILE "mobilenet-ssd_openvino_2021.2_8shave.blob" @@ -118,14 +118,14 @@ hunter_private_data( ) # OpenVINO 2020.3 blob -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/text-image-super-resolution-0001_2020.3_4shave.blob" SHA1 "f0134c9b843fe414f6d98b17a70f069d1ab0f3d8" FILE "text-image-super-resolution-0001_2020.3_4shave.blob" LOCATION openvino_2020_3_blob ) # OpenVINO 2020.4 blob -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/text-image-super-resolution-0001_2020.4_4shave.blob" SHA1 "25dcf0b146da8c85c9c4cba00ad5fdd4ed02a1b6" FILE "text-image-super-resolution-0001_2020.4_4shave.blob" @@ -133,42 +133,42 @@ hunter_private_data( ) # OpenVINO 2021.1 blob -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/text-image-super-resolution-0001_2021.1_4shave.blob" SHA1 "39c4f47f2a75627b7561e97dd7cdfcd0b1925a1e" FILE "text-image-super-resolution-0001_2021.1_4shave.blob" LOCATION openvino_2021_1_blob ) # OpenVINO 2021.2 blob -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/text-image-super-resolution-0001_2021.2_4shave.blob" SHA1 "a204467f86aa4ad63d31782ada271bea6f57f789" FILE "text-image-super-resolution-0001_2021.2_4shave.blob" LOCATION openvino_2021_2_blob ) # OpenVINO 2021.3 blob -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/text-image-super-resolution-0001_2021.3_4shave.blob" SHA1 "af19470feb59317e74d045bc31d93ca129c46674" FILE "text-image-super-resolution-0001_2021.3_4shave.blob" LOCATION openvino_2021_3_blob ) # OpenVINO 2021.4.2 blob -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/text-image-super-resolution-0001_2021.4.2_4shave.blob" SHA1 "164b6b2ae48d38bc4f07cc8296b8bcb7644a1578" FILE "text-image-super-resolution-0001_2021.4.2_4shave.blob" LOCATION openvino_2021_4_2_blob ) # OpenVINO 2022.1.0 blob -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/text-image-super-resolution-0001_2022.1.0_4shave.blob" SHA1 "98e94b865b9c48a92eaebd1ddc883712dfe7cfcb" FILE "text-image-super-resolution-0001_2022.1.0_4shave.blob" LOCATION openvino_2022_1_blob ) # YoloV4 resource -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/yolo-v4-tiny-tf_openvino_2021.4_4shave.blob" SHA1 "7da2f96f7300e3828940557e6a86ac6f243eef7e" FILE "yolo-v4-tiny-tf_openvino_2021.4_4shave.blob" @@ -176,7 +176,7 @@ hunter_private_data( ) # Superblob -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/person-reidentification-retail-0277_openvino_2022.1_8shave.superblob" SHA1 "6f14e3a5388946d6de849ff4f6432702601b1003" FILE "person-reidentification-retail-0277_openvino_2022.1_8shave.superblob" @@ -184,28 +184,28 @@ hunter_private_data( ) # NNarchives of different types -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/nnarchive/yolo_blob_nnarchive.tar.xz" SHA1 "6b9697e5aaf1560efbdea7f8d7487bae51def619" FILE "yolo_blob_nnarchive.tar.xz" LOCATION yolo_blob_nnarchive_path ) -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/nnarchive/yolo_superblob_nnarchive.tar.xz" SHA1 "2356fd7e5a203446211a891a74f0b23e0912eaf6" FILE "yolo_superblob_nnarchive.tar.xz" LOCATION yolo_superblob_nnarchive_path ) -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/nnarchive/yolo_onnx_nnarchive.tar.xz" SHA1 "7abb6a8c05c5f66897cd2c5c6b4f0170620dff8b" FILE "yolo_onnx_nnarchive.tar.xz" LOCATION yolo_onnx_nnarchive_path ) -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/images/lenna.png" SHA1 "3ee0d360dc12003c0d43e3579295b52b64906e85" FILE "lenna.png" diff --git a/vcpkg.json b/vcpkg.json index 21267f062b..43e9d72125 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -33,7 +33,8 @@ "png", "quirc", "tiff", - "webp" + "webp", + "ffmpeg" ] }, { From 9bcaed672b945e8bedc82f1787a908130913170d Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 21 Nov 2024 20:33:27 +0100 Subject: [PATCH 096/131] add deps for build-docstrings --- .github/workflows/python-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index ecce4f9e32..d0fe6f8e2e 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -52,7 +52,7 @@ jobs: run: | sudo apt update python -m pip install --upgrade pip - sudo apt install libusb-1.0-0-dev + sudo apt install libusb-1.0-0-dev libx11-dev libxft-dev libxext-dev autoconf libtool python3-jinja2 libxi-dev libxtst-dev libxrandr-dev nasm python -m pip install -r bindings/python/docs/requirements_mkdoc.txt - name: Configure project run: cmake -S . -B build -DDEPTHAI_BUILD_PYTHON=ON -DDEPTHAI_PYTHON_FORCE_DOCSTRINGS=ON -DDEPTHAI_BASALT_SUPPORT=ON -DDEPTHAI_PCL_SUPPORT=ON -DDEPTHAI_RTABMAP_SUPPORT=ON -DDEPTHAI_PYTHON_DOCSTRINGS_OUTPUT="$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" From 9c4215490e5856429ce66bdd28b5ca6024450f88 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 25 Nov 2024 11:20:43 +0100 Subject: [PATCH 097/131] ffmpeg in opencv --- CMakeLists.txt | 5 ++++- cmake/depthaiDependencies.cmake | 1 + cmake/triplets/arm64-linux.cmake | 13 ++++++++++++ cmake/triplets/x64-linux.cmake | 11 ++++++++++ cmake/triplets/x64-osx.cmake | 14 +++++++++++++ cmake/triplets/x64-windows.cmake | 11 ++++++++++ examples/cpp/CMakeLists.txt | 36 ++++++++++++++++---------------- vcpkg-configuration.json | 5 ++++- vcpkg.json | 9 +++++++- 9 files changed, 84 insertions(+), 21 deletions(-) create mode 100644 cmake/triplets/arm64-linux.cmake create mode 100644 cmake/triplets/x64-linux.cmake create mode 100644 cmake/triplets/x64-osx.cmake create mode 100644 cmake/triplets/x64-windows.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index d3a7bf721c..d53af42a86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -486,9 +486,12 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15) # Link merged target libraries and add compile definitions if(DEPTHAI_HAVE_OPENCV_SUPPORT AND DEPTHAI_MERGED_TARGET) - set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic") # needed for ffmpeg linking # Link to OpenCV (publically) target_link_libraries(${TARGET_CORE_NAME} PUBLIC ${REQUIRED_OPENCV_LIBRARIES} ${THIRDPARTY_OPENCV_LIBRARIES}) + # Link to FFMPEG (for video encoding) + target_include_directories(${TARGET_CORE_NAME} PRIVATE ${FFMPEG_INCLUDE_DIRS}) + target_link_directories(${TARGET_CORE_NAME} PRIVATE ${FFMPEG_LIBRARY_DIRS}) + target_link_libraries(${TARGET_CORE_NAME} PRIVATE ${FFMPEG_LIBRARIES}) # Specify that we are building target opencv target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_TARGET_OPENCV) diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake index b23e5809fb..b5f9469647 100644 --- a/cmake/depthaiDependencies.cmake +++ b/cmake/depthaiDependencies.cmake @@ -20,6 +20,7 @@ if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS)) endif() # BZip2 (for bspatch) find_package(BZip2 ${_QUIET} REQUIRED) + find_package(FFMPEG REQUIRED) find_package(lz4 CONFIG REQUIRED) # FP16 for conversions diff --git a/cmake/triplets/arm64-linux.cmake b/cmake/triplets/arm64-linux.cmake new file mode 100644 index 0000000000..bf34129c75 --- /dev/null +++ b/cmake/triplets/arm64-linux.cmake @@ -0,0 +1,13 @@ +set(VCPKG_TARGET_ARCHITECTURE arm64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Linux) + +if(PORT MATCHES "ffmpeg") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() + +if(PORT MATCHES "opencv") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() diff --git a/cmake/triplets/x64-linux.cmake b/cmake/triplets/x64-linux.cmake new file mode 100644 index 0000000000..813aa99f3d --- /dev/null +++ b/cmake/triplets/x64-linux.cmake @@ -0,0 +1,11 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) +if(PORT MATCHES "ffmpeg") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() + +if(PORT MATCHES "opencv") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() +set(VCPKG_CMAKE_SYSTEM_NAME Linux) diff --git a/cmake/triplets/x64-osx.cmake b/cmake/triplets/x64-osx.cmake new file mode 100644 index 0000000000..554e9751e7 --- /dev/null +++ b/cmake/triplets/x64-osx.cmake @@ -0,0 +1,14 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Darwin) +set(VCPKG_OSX_ARCHITECTURES x86_64) + +if(PORT MATCHES "ffmpeg") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() + +if(PORT MATCHES "opencv") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() diff --git a/cmake/triplets/x64-windows.cmake b/cmake/triplets/x64-windows.cmake new file mode 100644 index 0000000000..0739e5c28b --- /dev/null +++ b/cmake/triplets/x64-windows.cmake @@ -0,0 +1,11 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) + +if(PORT MATCHES "ffmpeg") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() + +if(PORT MATCHES "opencv") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt index e94b710960..cfb5a10504 100644 --- a/examples/cpp/CMakeLists.txt +++ b/examples/cpp/CMakeLists.txt @@ -105,7 +105,7 @@ endfunction() # Add any custom binary data using the following snippet ## # Hunter test data download -## hunter_private_data( +## private_data( ## URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/mobilenet.blob" ## SHA1 "e89d3ee9f26d80397e44f89c6b375990064a4a42" ## FILE "mobilenet.blob" @@ -116,7 +116,7 @@ endfunction() # Hunter test data download # NeuralNetwork node, mobilenet example -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/mobilenet-ssd_openvino_2021.4_6shave.blob" SHA1 "4f4506726e3083981064938a0faaf9af6180d2c6" FILE "mobilenet-ssd_openvino_2021.4_6shave.blob" @@ -124,7 +124,7 @@ hunter_private_data( ) # YoloV3 resource -hunter_private_data( +private_data( URL "http://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/yolo-v3-tiny-tf_openvino_2021.4_6shave.blob" SHA1 "dedb2d4d96b23e42d15c15e454b8f02eca2713de" FILE "yolo-v3-tiny-tf_openvino_2021.4_6shave.blob" @@ -132,7 +132,7 @@ hunter_private_data( ) # YoloV4 resource -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/yolo-v4-tiny-tf_openvino_2021.4_6shave.blob" SHA1 "d8d09b697dac298fe83cf8856740a21b1a61ab89" FILE "yolo-v4-tiny-tf_openvino_2021.4_6shave.blob" @@ -140,7 +140,7 @@ hunter_private_data( ) # NeuralNetwork node, mobilenet example, 5 shaves -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/mobilenet-ssd_openvino_2021.4_5shave.blob" SHA1 "14ab3ef446b8a649d6694d94c2fc8b798efd74a3" FILE "mobilenet-ssd_openvino_2021.4_5shave.blob" @@ -148,7 +148,7 @@ hunter_private_data( ) # NeuralNetwork node, mobilenet example, 8 shaves -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/mobilenet-ssd_openvino_2021.4_8shave.blob" SHA1 "7e7ea9a680668f3ca9e8f1d22cc8f3f1a02ac018" FILE "mobilenet-ssd_openvino_2021.4_8shave.blob" @@ -156,7 +156,7 @@ hunter_private_data( ) # Video file with objects to detect -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/construction_vest.mp4" SHA1 "271d8d0b702e683ce02957db7c100843de5ceaec" FILE "construction_vest.mp4" @@ -164,21 +164,21 @@ hunter_private_data( ) # Calibration Sample files -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/misc/depthai_calib.json" SHA1 "ec50a47496473116c51cec1c8249bff2679383c3" FILE "depthai_calib.json" LOCATION calib_v6 ) -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/misc/depthai_v5.calib" SHA1 "adfe9976b9aacfdaa76ac7138810999988177e71" FILE "depthai_v5.calib" LOCATION calib_v5 ) -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/misc/BW1098OBC.json" SHA1 "1e84b6c339ac51e3b254775090b91235a40fac71" FILE "BW1098OBC.json" @@ -186,7 +186,7 @@ hunter_private_data( ) # person-detection -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/person-detection-retail-0013_openvino_2021.4_7shave.blob" SHA1 "946d102874b287292cdb5952fa66356c8d36025f" FILE "person-detection-retail-0013_openvino_2021.4_7shave.blob" @@ -194,7 +194,7 @@ hunter_private_data( ) # concat model -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/concat_openvino_2021.4_6shave.blob" SHA1 "e4af6fb2bed39648a2a4424d8bdc5bac56d616df" FILE "concat_openvino_2021.4_6shave.blob" @@ -202,7 +202,7 @@ hunter_private_data( ) # normalization model -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/normalize_openvino_2021.4_4shave.blob" SHA1 "1435f6d11e0dfdbc60f2dfa45aecd3d530b6153b" FILE "normalize_openvino_2021.4_4shave.blob" @@ -210,7 +210,7 @@ hunter_private_data( ) # mobilnet xml model for S3 example -hunter_private_data( +private_data( URL "https://download.01.org/opencv/2021/openvinotoolkit/2021.1/open_model_zoo/models_bin/1/person-detection-0202/FP32/person-detection-0202.xml" SHA1 "87f9cf8833043162f1b728e9afa6f38ba177d9db" FILE "person-detection-0202.xml" @@ -218,7 +218,7 @@ hunter_private_data( ) # mobilnet xml model for S3 example -hunter_private_data( +private_data( URL "https://download.01.org/opencv/2021/openvinotoolkit/2021.1/open_model_zoo/models_bin/1/person-detection-0202/FP32/person-detection-0202.bin" SHA1 "1560bf2ee372a0640539780ea8bd061278a6cc20" FILE "person-detection-0202.bin" @@ -226,7 +226,7 @@ hunter_private_data( ) # yolo xml model for S3 example -hunter_private_data( +private_data( URL "https://github.com/luxonis/depthai-model-zoo/raw/main/models/yolov4_tiny_coco_416x416/yolov4_tiny_coco_416x416.xml" SHA1 "423069bdff250643cf080c76e15594cfd72cb816" FILE "yolov4_tiny_coco_416x416.xml" @@ -234,7 +234,7 @@ hunter_private_data( ) # yolo bin model for S3 example -hunter_private_data( +private_data( URL "https://robothub.fra1.cdn.digitaloceanspaces.com/models/yolov4_tiny_coco_416x416/yolov4_tiny_coco_416x416.bin" SHA1 "a7627c074ee76ceb9ff9bb8529b67867e3e440bc" FILE "yolov4_tiny_coco_416x416.bin" @@ -242,7 +242,7 @@ hunter_private_data( ) # yolo v5 nn archive -hunter_private_data( +private_data( URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/nnarchive/yolo-v6-openvino_2022.1_6shave-rvc2.tar.xz" SHA1 "63a5bb29d1ca0d3b019f13d66401e634539aac82" FILE "yolo-v6-openvino_2022.1_6shave-rvc2.tar.xz" diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index a27db75cf2..be24627fcd 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -13,5 +13,8 @@ ], "overlay-ports": [ "./cmake/ports" - ] + ], + "overlay-triplets": [ + "./cmake/triplets" + ] } diff --git a/vcpkg.json b/vcpkg.json index 43e9d72125..23d98df849 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -17,6 +17,12 @@ "neargye-semver", "pybind11", "catch2", + { + "name": "ffmpeg", + "features": [ + "openh264" + ] + }, { "name": "libarchive", "default-features": false @@ -34,7 +40,8 @@ "quirc", "tiff", "webp", - "ffmpeg" + "ffmpeg", + "gstreamer" ] }, { From 93b5c6295f6ac939a23a1d05bdb205fd9286747b Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 25 Nov 2024 11:54:08 +0100 Subject: [PATCH 098/131] update deps --- .github/workflows/python-main.yml | 2 +- .github/workflows/test.workflow.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index d0fe6f8e2e..977956303d 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -52,7 +52,7 @@ jobs: run: | sudo apt update python -m pip install --upgrade pip - sudo apt install libusb-1.0-0-dev libx11-dev libxft-dev libxext-dev autoconf libtool python3-jinja2 libxi-dev libxtst-dev libxrandr-dev nasm + sudo apt install libusb-1.0-0-dev pkg-config python3 bison autoconf libtool python3-jinja2 libxi-dev libxtst-dev libxrandr-dev libx11-dev libxft-dev libxext-dev nasm flex libudev-dev python -m pip install -r bindings/python/docs/requirements_mkdoc.txt - name: Configure project run: cmake -S . -B build -DDEPTHAI_BUILD_PYTHON=ON -DDEPTHAI_PYTHON_FORCE_DOCSTRINGS=ON -DDEPTHAI_BASALT_SUPPORT=ON -DDEPTHAI_PCL_SUPPORT=ON -DDEPTHAI_RTABMAP_SUPPORT=ON -DDEPTHAI_PYTHON_DOCSTRINGS_OUTPUT="$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" diff --git a/.github/workflows/test.workflow.yml b/.github/workflows/test.workflow.yml index 89ada01681..d6da57399d 100644 --- a/.github/workflows/test.workflow.yml +++ b/.github/workflows/test.workflow.yml @@ -80,6 +80,7 @@ jobs: export DISPLAY=:99 xdpyinfo -display $DISPLAY >/dev/null 2>&1 || (Xvfb $DISPLAY &) source venv/bin/activate # Activate virtual environment + sudo apt install libusb-1.0-0-dev pkg-config python3 bison autoconf libtool python3-jinja2 libxi-dev libxtst-dev libxrandr-dev libx11-dev libxft-dev libxext-dev nasm flex libudev-dev cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_ROOT=$HOME/.hun2_${{ matrix.flavor }} -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON -D DEPTHAI_TEST_EXAMPLES=ON -D DEPTHAI_BUILD_PYTHON=ON -D DEPTHAI_PYTHON_TEST_EXAMPLES=ON -D DEPTHAI_PYTHON_ENABLE_EXAMPLES=ON cmake --build build --parallel 4 --config Release cd tests From 9c387b13057c8c015acffa6e808ad6dd20e4c07d Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 25 Nov 2024 11:55:05 +0100 Subject: [PATCH 099/131] remove sudo in testing --- .github/workflows/test.workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.workflow.yml b/.github/workflows/test.workflow.yml index d6da57399d..595f49ae6e 100644 --- a/.github/workflows/test.workflow.yml +++ b/.github/workflows/test.workflow.yml @@ -80,7 +80,7 @@ jobs: export DISPLAY=:99 xdpyinfo -display $DISPLAY >/dev/null 2>&1 || (Xvfb $DISPLAY &) source venv/bin/activate # Activate virtual environment - sudo apt install libusb-1.0-0-dev pkg-config python3 bison autoconf libtool python3-jinja2 libxi-dev libxtst-dev libxrandr-dev libx11-dev libxft-dev libxext-dev nasm flex libudev-dev + apt install libusb-1.0-0-dev pkg-config python3 bison autoconf libtool python3-jinja2 libxi-dev libxtst-dev libxrandr-dev libx11-dev libxft-dev libxext-dev nasm flex libudev-dev cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_ROOT=$HOME/.hun2_${{ matrix.flavor }} -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON -D DEPTHAI_TEST_EXAMPLES=ON -D DEPTHAI_BUILD_PYTHON=ON -D DEPTHAI_PYTHON_TEST_EXAMPLES=ON -D DEPTHAI_PYTHON_ENABLE_EXAMPLES=ON cmake --build build --parallel 4 --config Release cd tests From ab4e8fa0ac86264480805b5318513447b48449fe Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 25 Nov 2024 14:26:57 +0100 Subject: [PATCH 100/131] try bumping python version --- .github/workflows/python-main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 977956303d..dd46815896 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -47,12 +47,12 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: 3.10 - name: Install dependencies run: | sudo apt update python -m pip install --upgrade pip - sudo apt install libusb-1.0-0-dev pkg-config python3 bison autoconf libtool python3-jinja2 libxi-dev libxtst-dev libxrandr-dev libx11-dev libxft-dev libxext-dev nasm flex libudev-dev + sudo apt install libusb-1.0-0-dev pkg-config bison autoconf libtool libxi-dev libxtst-dev libxrandr-dev libx11-dev libxft-dev libxext-dev nasm flex libudev-dev python -m pip install -r bindings/python/docs/requirements_mkdoc.txt - name: Configure project run: cmake -S . -B build -DDEPTHAI_BUILD_PYTHON=ON -DDEPTHAI_PYTHON_FORCE_DOCSTRINGS=ON -DDEPTHAI_BASALT_SUPPORT=ON -DDEPTHAI_PCL_SUPPORT=ON -DDEPTHAI_RTABMAP_SUPPORT=ON -DDEPTHAI_PYTHON_DOCSTRINGS_OUTPUT="$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" From b8781cc3e4516aade1b2c95a202ffdf054b544a4 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 25 Nov 2024 14:29:07 +0100 Subject: [PATCH 101/131] typo --- .github/workflows/python-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index dd46815896..46f20e1032 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -47,7 +47,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.10 + python-version: '3.10' - name: Install dependencies run: | sudo apt update From 6f10725f5b99138187c9314ec833054b51d56694 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 25 Nov 2024 15:01:00 +0100 Subject: [PATCH 102/131] try installing jinja2 from pip --- .github/workflows/python-main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 46f20e1032..371f3cc895 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -47,12 +47,13 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: 3.8 - name: Install dependencies run: | sudo apt update python -m pip install --upgrade pip sudo apt install libusb-1.0-0-dev pkg-config bison autoconf libtool libxi-dev libxtst-dev libxrandr-dev libx11-dev libxft-dev libxext-dev nasm flex libudev-dev + python -m pip install jinja2 python -m pip install -r bindings/python/docs/requirements_mkdoc.txt - name: Configure project run: cmake -S . -B build -DDEPTHAI_BUILD_PYTHON=ON -DDEPTHAI_PYTHON_FORCE_DOCSTRINGS=ON -DDEPTHAI_BASALT_SUPPORT=ON -DDEPTHAI_PCL_SUPPORT=ON -DDEPTHAI_RTABMAP_SUPPORT=ON -DDEPTHAI_PYTHON_DOCSTRINGS_OUTPUT="$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" From dea3c194a2bc01e4718a672daef06d3766054366 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 25 Nov 2024 15:09:07 +0100 Subject: [PATCH 103/131] mp4v2 config fixup --- cmake/ports/mp4v2/portfile.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/ports/mp4v2/portfile.cmake b/cmake/ports/mp4v2/portfile.cmake index 16a14b330a..c9a7134ec1 100644 --- a/cmake/ports/mp4v2/portfile.cmake +++ b/cmake/ports/mp4v2/portfile.cmake @@ -16,3 +16,9 @@ vcpkg_cmake_configure( vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/mp4v2") +vcpkg_fixup_pkgconfig() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") From 44819ac4e0c5a42a9686db5d76199c45ab6552db Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 25 Nov 2024 15:09:16 +0100 Subject: [PATCH 104/131] remove apt install from test workflow --- .github/workflows/test.workflow.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.workflow.yml b/.github/workflows/test.workflow.yml index 595f49ae6e..89ada01681 100644 --- a/.github/workflows/test.workflow.yml +++ b/.github/workflows/test.workflow.yml @@ -80,7 +80,6 @@ jobs: export DISPLAY=:99 xdpyinfo -display $DISPLAY >/dev/null 2>&1 || (Xvfb $DISPLAY &) source venv/bin/activate # Activate virtual environment - apt install libusb-1.0-0-dev pkg-config python3 bison autoconf libtool python3-jinja2 libxi-dev libxtst-dev libxrandr-dev libx11-dev libxft-dev libxext-dev nasm flex libudev-dev cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_ROOT=$HOME/.hun2_${{ matrix.flavor }} -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON -D DEPTHAI_TEST_EXAMPLES=ON -D DEPTHAI_BUILD_PYTHON=ON -D DEPTHAI_PYTHON_TEST_EXAMPLES=ON -D DEPTHAI_PYTHON_ENABLE_EXAMPLES=ON cmake --build build --parallel 4 --config Release cd tests From 874f103d48cd944fbeb04042f41ba33cbe463035 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 25 Nov 2024 16:15:33 +0100 Subject: [PATCH 105/131] update deps for manylinux --- .github/workflows/python-main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 371f3cc895..e2d2085e14 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -428,7 +428,7 @@ jobs: with: submodules: 'recursive' - name: Installing libusb1-devel dependency - run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build + run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel nasm pkg-config libtool autoconf automake - name: Installing cmake dependency run: | cd bindings/python @@ -454,7 +454,7 @@ jobs: /opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar mv dist/* wheelhouse/audited/ - name: Build wheels - run: cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done + run: cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIND}/pip" install jinja2 && "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Audit wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done - name: Archive wheel artifacts @@ -505,7 +505,7 @@ jobs: with: submodules: 'recursive' - name: Installing libusb1-devel dependency - run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build + run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel nasm pkg-config libtool autoconf automake - name: Installing cmake dependency run: | cd bindings/python @@ -526,7 +526,7 @@ jobs: run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV - name: Building wheels run: | - cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done + run: cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIND}/pip" install jinja2 && "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Auditing wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done - name: Archive wheel artifacts From ff5c0ed45d8accfe72c5d66709e91a8cd5e5a5b8 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 25 Nov 2024 18:32:20 +0100 Subject: [PATCH 106/131] fix typo --- .github/workflows/python-main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index e2d2085e14..383223c24e 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -454,7 +454,7 @@ jobs: /opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar mv dist/* wheelhouse/audited/ - name: Build wheels - run: cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIND}/pip" install jinja2 && "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done + run: cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" install jinja2 && "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Audit wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done - name: Archive wheel artifacts @@ -526,7 +526,7 @@ jobs: run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV - name: Building wheels run: | - run: cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIND}/pip" install jinja2 && "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done + run: cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" install jinja2 && "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Auditing wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done - name: Archive wheel artifacts From 56c5cd47bd45a5459d50f3760c42e3ed7d458e0e Mon Sep 17 00:00:00 2001 From: Serafadam Date: Mon, 25 Nov 2024 18:34:13 +0100 Subject: [PATCH 107/131] remove pybin cmd --- .github/workflows/python-main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 383223c24e..cc76cbab1f 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -428,7 +428,7 @@ jobs: with: submodules: 'recursive' - name: Installing libusb1-devel dependency - run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel nasm pkg-config libtool autoconf automake + run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel nasm libtool autoconf automake - name: Installing cmake dependency run: | cd bindings/python @@ -454,7 +454,7 @@ jobs: /opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar mv dist/* wheelhouse/audited/ - name: Build wheels - run: cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" install jinja2 && "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done + run: cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Audit wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done - name: Archive wheel artifacts @@ -505,7 +505,7 @@ jobs: with: submodules: 'recursive' - name: Installing libusb1-devel dependency - run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel nasm pkg-config libtool autoconf automake + run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build - name: Installing cmake dependency run: | cd bindings/python @@ -526,7 +526,7 @@ jobs: run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV - name: Building wheels run: | - run: cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" install jinja2 && "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done + cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Auditing wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done - name: Archive wheel artifacts From c89e3739db4d592b10e63ffd337243683197e27f Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 26 Nov 2024 07:31:51 +0100 Subject: [PATCH 108/131] try jinja install separately --- .github/workflows/python-main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index cc76cbab1f..e8d91da43f 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -454,7 +454,10 @@ jobs: /opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar mv dist/* wheelhouse/audited/ - name: Build wheels - run: cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done + run: | + for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" install jinja2; done + cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done + - name: Audit wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done - name: Archive wheel artifacts @@ -526,6 +529,7 @@ jobs: run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV - name: Building wheels run: | + for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" install jinja2; done cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Auditing wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done From b90bd3b1604749482b1f59002d23368b6f87af74 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 26 Nov 2024 10:46:57 +0100 Subject: [PATCH 109/131] remove gstreamer, bump vcpkg baseline --- CMakePresets.json | 3 ++- vcpkg-configuration.json | 2 +- vcpkg.json | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index a72756f85b..4d8bc35bc8 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -5,7 +5,8 @@ "name": "default", "binaryDir": "${sourceDir}/build", "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "VCPKG_INSTALL_OPTIONS": "--clean-buildtrees-after-build;--clean-packages-after-build" } } ] diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index be24627fcd..5505bbd5d4 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -1,7 +1,7 @@ { "default-registry": { "kind": "git", - "baseline": "509f71e53f45e46c13fa7935d2f6a45803580c07", + "baseline": "f56b56e01683ba9fde12b64de246ec0b3eb69b18", "repository": "https://github.com/microsoft/vcpkg" }, "registries": [ diff --git a/vcpkg.json b/vcpkg.json index 23d98df849..948e8cc2a0 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -40,8 +40,7 @@ "quirc", "tiff", "webp", - "ffmpeg", - "gstreamer" + "ffmpeg" ] }, { From 11d172d438cb74945664c7d213679d358a5e670f Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 26 Nov 2024 10:53:34 +0100 Subject: [PATCH 110/131] update python ci --- .github/workflows/python-main.yml | 4 +--- bindings/python/utilities/requirements.txt | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index e8d91da43f..a66845aae5 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -455,7 +455,6 @@ jobs: mv dist/* wheelhouse/audited/ - name: Build wheels run: | - for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" install jinja2; done cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Audit wheels @@ -508,7 +507,7 @@ jobs: with: submodules: 'recursive' - name: Installing libusb1-devel dependency - run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build + run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel nasm libtool autoconf automake - name: Installing cmake dependency run: | cd bindings/python @@ -529,7 +528,6 @@ jobs: run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV - name: Building wheels run: | - for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" install jinja2; done cd bindings/python && for PYBIN in /opt/python/cp3${{ matrix.python-set }}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done - name: Auditing wheels run: cd bindings/python && for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done diff --git a/bindings/python/utilities/requirements.txt b/bindings/python/utilities/requirements.txt index ade6e25c8f..77242602a4 100644 --- a/bindings/python/utilities/requirements.txt +++ b/bindings/python/utilities/requirements.txt @@ -1,6 +1,7 @@ PySimpleGUI==4.60.3 Pillow==9.3.0 psutil==5.9.3 +jinja2==3.0.3 numpy>=1.21.4 # For RPi Buster (last successful build) and macOS M1 (first build). But allow for higher versions, to support Python3.11 (not available in 1.21.4 yet) opencv-contrib-python==4.5.5.62 # Last successful RPi build, also covers M1 with above pinned numpy (otherwise 4.6.0.62 would be required, but that has a bug with charuco boards). Python version not important, abi3 wheels pyqt5>5,<5.15.6 ; platform_machine != "armv6l" and platform_machine != "armv7l" and platform_machine != "aarch64" and platform_machine != "arm64" From f4810d40a3b5d1e629c422038305b9dd72348fac Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 26 Nov 2024 13:12:08 +0100 Subject: [PATCH 111/131] ci update --- .github/workflows/python-main.yml | 4 ++-- .github/workflows/test.workflow.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index a66845aae5..e22bade1af 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -120,7 +120,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | python -m pip install --upgrade pip - sudo apt install libusb-1.0-0-dev libopencv-dev + sudo apt install libusb-1.0-0-dev - name: Install dependencies (MacOS) if: matrix.os == 'macos-latest' @@ -135,7 +135,7 @@ jobs: - name: Install pytest run: | - python -m pip install pytest numpy opencv-python + python -m pip install pytest numpy opencv-python jinja2 - name: Compile run: | diff --git a/.github/workflows/test.workflow.yml b/.github/workflows/test.workflow.yml index 89ada01681..e48512e4c2 100644 --- a/.github/workflows/test.workflow.yml +++ b/.github/workflows/test.workflow.yml @@ -80,6 +80,7 @@ jobs: export DISPLAY=:99 xdpyinfo -display $DISPLAY >/dev/null 2>&1 || (Xvfb $DISPLAY &) source venv/bin/activate # Activate virtual environment + python3 -m pip install jinja2 cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_ROOT=$HOME/.hun2_${{ matrix.flavor }} -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON -D DEPTHAI_TEST_EXAMPLES=ON -D DEPTHAI_BUILD_PYTHON=ON -D DEPTHAI_PYTHON_TEST_EXAMPLES=ON -D DEPTHAI_PYTHON_ENABLE_EXAMPLES=ON cmake --build build --parallel 4 --config Release cd tests From d8639bd4f9be9dc2d04347f9ce167283a491e3bf Mon Sep 17 00:00:00 2001 From: Serafadam Date: Tue, 26 Nov 2024 13:30:17 +0100 Subject: [PATCH 112/131] pytest ci update --- .github/workflows/python-main.yml | 3 +-- bindings/python/docs/requirements_mkdoc.txt | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index e22bade1af..ddfcea848c 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -53,7 +53,6 @@ jobs: sudo apt update python -m pip install --upgrade pip sudo apt install libusb-1.0-0-dev pkg-config bison autoconf libtool libxi-dev libxtst-dev libxrandr-dev libx11-dev libxft-dev libxext-dev nasm flex libudev-dev - python -m pip install jinja2 python -m pip install -r bindings/python/docs/requirements_mkdoc.txt - name: Configure project run: cmake -S . -B build -DDEPTHAI_BUILD_PYTHON=ON -DDEPTHAI_PYTHON_FORCE_DOCSTRINGS=ON -DDEPTHAI_BASALT_SUPPORT=ON -DDEPTHAI_PCL_SUPPORT=ON -DDEPTHAI_RTABMAP_SUPPORT=ON -DDEPTHAI_PYTHON_DOCSTRINGS_OUTPUT="$PWD/bindings/python/docstrings/depthai_python_docstring.hpp" @@ -120,7 +119,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | python -m pip install --upgrade pip - sudo apt install libusb-1.0-0-dev + sudo apt install libusb-1.0-0-dev pkg-config bison autoconf libtool libxi-dev libxtst-dev libxrandr-dev libx11-dev libxft-dev libxext-dev nasm flex libudev-dev - name: Install dependencies (MacOS) if: matrix.os == 'macos-latest' diff --git a/bindings/python/docs/requirements_mkdoc.txt b/bindings/python/docs/requirements_mkdoc.txt index c823ac6cc0..ba2fa6b63b 100644 --- a/bindings/python/docs/requirements_mkdoc.txt +++ b/bindings/python/docs/requirements_mkdoc.txt @@ -1,3 +1,4 @@ git+https://github.com/luxonis/pybind11_mkdoc.git@da6c64251a0ebbc3ffc007477a0b9c9f20cac165 libclang==16.0.6 +jinja2==3.0.3 numpy # Needed because of xtensor-python From 7aec66663d5f4e34710d0da9cddbfd3255381656 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 27 Nov 2024 07:35:59 +0100 Subject: [PATCH 113/131] add jinja to pyproject.toml --- bindings/python/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index 5626df1b4d..78c796a307 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -1,2 +1,2 @@ [build-system] -requires = ["setuptools", "wheel", "mypy", "numpy", "cmake==3.25"] +requires = ["setuptools", "wheel", "mypy", "numpy", "jinja2", "cmake==3.25"] From 48465c7fd95b1e26f9a89998eafee5accf1fdc22 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 27 Nov 2024 08:47:44 +0100 Subject: [PATCH 114/131] extra deps for manylinux --- .github/workflows/python-main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index ddfcea848c..bcf7322c99 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -427,7 +427,7 @@ jobs: with: submodules: 'recursive' - name: Installing libusb1-devel dependency - run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel nasm libtool autoconf automake + run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel libXrandr-devel libXtst-devel libudev-devel lapack-devel nasm libtool autoconf automake - name: Installing cmake dependency run: | cd bindings/python @@ -506,7 +506,7 @@ jobs: with: submodules: 'recursive' - name: Installing libusb1-devel dependency - run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel nasm libtool autoconf automake + run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel libXrandr-devel libXtst-devel libudev-devel lapack-devel nasm libtool autoconf automake - name: Installing cmake dependency run: | cd bindings/python From 50f6f730a64eca79e92476bf154d253dcc1a1001 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 27 Nov 2024 11:05:38 +0100 Subject: [PATCH 115/131] install nasm on mac --- .github/workflows/python-main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index bcf7322c99..5afba9f9bd 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -314,6 +314,7 @@ jobs: run: | python -m pip install --upgrade pip brew install libusb + brew install nasm python -m pip install delocate - name: Building wheels run: cd bindings/python && python -m pip wheel . -w ./wheelhouse/ --verbose From 5e1b15fc537e33be0fdb94dd02f6e4f15a389546 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 27 Nov 2024 12:04:59 +0100 Subject: [PATCH 116/131] basalt post install fixes --- cmake/ports/basalt-headers/portfile.cmake | 4 ++++ cmake/ports/basalt/portfile.cmake | 2 ++ 2 files changed, 6 insertions(+) diff --git a/cmake/ports/basalt-headers/portfile.cmake b/cmake/ports/basalt-headers/portfile.cmake index e1ad78009e..358981b078 100644 --- a/cmake/ports/basalt-headers/portfile.cmake +++ b/cmake/ports/basalt-headers/portfile.cmake @@ -12,3 +12,7 @@ vcpkg_cmake_configure( vcpkg_cmake_install() vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/basalt-headers") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib" "${CURRENT_PACKAGES_DIR}/lib") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/cmake/ports/basalt/portfile.cmake b/cmake/ports/basalt/portfile.cmake index 585587fddc..2dba7e7fb5 100644 --- a/cmake/ports/basalt/portfile.cmake +++ b/cmake/ports/basalt/portfile.cmake @@ -17,3 +17,5 @@ vcpkg_cmake_configure( vcpkg_cmake_install() vcpkg_cmake_config_fixup(PACKAGE_NAME basalt_sdk CONFIG_PATH "lib/cmake/basalt_sdk") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") From f7f3a89b87efeb14585457944d5fb42148a5b66e Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 27 Nov 2024 13:19:45 +0100 Subject: [PATCH 117/131] rtabmap for arm --- .github/workflows/python-main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 5afba9f9bd..2e561122a7 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -494,6 +494,7 @@ jobs: VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" DEPTHAI_BUILD_BASALT: ON DEPTHAI_BUILD_PCL: ON + DEPTHAI_BUILD_RTABMAP: ON VCPKG_MAX_CONCURRENCY: "2" # DEPTHAI_BUILD_RTABMAP: ON steps: From 8f4c37ccc66d7942b0b7f48bb0ccbff549176984 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 27 Nov 2024 13:50:33 +0100 Subject: [PATCH 118/131] remove osx triplet --- .github/workflows/python-main.yml | 2 -- cmake/triplets/x64-osx.cmake | 14 -------------- 2 files changed, 16 deletions(-) delete mode 100644 cmake/triplets/x64-osx.cmake diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 2e561122a7..5ac5195646 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -271,7 +271,6 @@ jobs: runs-on: ${{ matrix.os }} env: VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" - # TODO(Morato) - re-enable basalt, pcl, rtabmap after everything is ported DEPTHAI_BUILD_BASALT: ON DEPTHAI_BUILD_PCL: ON DEPTHAI_BUILD_RTABMAP: ON @@ -496,7 +495,6 @@ jobs: DEPTHAI_BUILD_PCL: ON DEPTHAI_BUILD_RTABMAP: ON VCPKG_MAX_CONCURRENCY: "2" - # DEPTHAI_BUILD_RTABMAP: ON steps: - name: Export GitHub Actions cache environment variables uses: actions/github-script@v7 diff --git a/cmake/triplets/x64-osx.cmake b/cmake/triplets/x64-osx.cmake deleted file mode 100644 index 554e9751e7..0000000000 --- a/cmake/triplets/x64-osx.cmake +++ /dev/null @@ -1,14 +0,0 @@ -set(VCPKG_TARGET_ARCHITECTURE x64) -set(VCPKG_CRT_LINKAGE dynamic) -set(VCPKG_LIBRARY_LINKAGE static) - -set(VCPKG_CMAKE_SYSTEM_NAME Darwin) -set(VCPKG_OSX_ARCHITECTURES x86_64) - -if(PORT MATCHES "ffmpeg") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() - -if(PORT MATCHES "opencv") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() From 9800dfdda9027e3735e1b4111b2e9efab35d7d97 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Wed, 27 Nov 2024 16:45:19 +0100 Subject: [PATCH 119/131] pr updates --- .github/workflows/python-main.yml | 4 ++-- CMakeLists.txt | 40 ++++++++++++++++++++++++------- cmake/depthaiDependencies.cmake | 1 + cmake/ports/xlink/portfile.cmake | 4 ++++ cmake/triplets/arm64-linux.cmake | 5 +--- cmake/triplets/arm64-osx.cmake | 9 +++++++ cmake/triplets/x64-linux.cmake | 5 +--- cmake/triplets/x64-osx.cmake | 11 +++++++++ cmake/triplets/x64-windows.cmake | 5 +--- src/utility/spdlog-fmt.hpp | 2 +- 10 files changed, 62 insertions(+), 24 deletions(-) create mode 100644 cmake/triplets/arm64-osx.cmake create mode 100644 cmake/triplets/x64-osx.cmake diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 5ac5195646..b63c62e42f 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -204,7 +204,7 @@ jobs: python-architecture: [x64] # TODO(Morato) - re-enable x86 - it complains that OpenCV even though it's 32 bit is not compatible fail-fast: false env: - # DEPTHAI_BUILD_BASALT: ON + DEPTHAI_BUILD_BASALT: ON DEPTHAI_BUILD_PCL: ON DEPTHAI_BUILD_RTABMAP: ON VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" @@ -400,7 +400,7 @@ jobs: needs: build-docstrings runs-on: ubuntu-latest container: - image: quay.io/pypa/manylinux_2_28_x86_64 # TODO(mmorato) temporary location, push to luxonis namespace + image: quay.io/pypa/manylinux_2_28_x86_64 env: PLAT: manylinux_2_28_x86_64 strategy: diff --git a/CMakeLists.txt b/CMakeLists.txt index 8035cdcf03..710ca901b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -258,6 +258,8 @@ set(TARGET_OPENCV_NAME ${PROJECT_NAME}-opencv) set(TARGET_OPENCV_ALIAS opencv) if(DEPTHAI_OPENCV_SUPPORT) # Check if required libraries are available + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic") # for FFMPEG + set(REQUIRED_OPENCV_LIBRARIES "opencv_core" "opencv_imgproc" "opencv_videoio" "opencv_highgui") set(OPENCV_SUPPORT_AVAILABLE ${OpenCV_FOUND}) foreach(lib ${REQUIRED_OPENCV_LIBRARIES}) @@ -488,10 +490,6 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15) if(DEPTHAI_HAVE_OPENCV_SUPPORT AND DEPTHAI_MERGED_TARGET) # Link to OpenCV (publically) target_link_libraries(${TARGET_CORE_NAME} PUBLIC ${REQUIRED_OPENCV_LIBRARIES} ${THIRDPARTY_OPENCV_LIBRARIES}) - # Link to FFMPEG (for video encoding) - target_include_directories(${TARGET_CORE_NAME} PRIVATE ${FFMPEG_INCLUDE_DIRS}) - target_link_directories(${TARGET_CORE_NAME} PRIVATE ${FFMPEG_LIBRARY_DIRS}) - target_link_libraries(${TARGET_CORE_NAME} PRIVATE ${FFMPEG_LIBRARIES}) # Specify that we are building target opencv target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_TARGET_OPENCV) @@ -506,9 +504,9 @@ if(DEPTHAI_HAVE_PCL_SUPPORT AND DEPTHAI_MERGED_TARGET) target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_TARGET_PCL) target_compile_definitions(${TARGET_CORE_NAME} PUBLIC DEPTHAI_HAVE_PCL_SUPPORT) target_link_directories(${TARGET_CORE_NAME} PUBLIC - $ - $ - ) + $ + $ + ) target_compile_definitions(${TARGET_CORE_NAME} PUBLIC ${PCL_DEFINITIONS}) endif() if(DEPTHAI_MERGED_TARGET) @@ -707,7 +705,6 @@ if(DEPTHAI_CLANG_FORMAT) target_clangformat_setup(${TARGET_CORE_NAME} "${header_dirs}") endif() -find_package(OpenSSL REQUIRED) # link libraries target_link_libraries(${TARGET_CORE_NAME} PUBLIC @@ -817,6 +814,31 @@ if(DEPTHAI_USB2_PATCH_ONLY_MODE) target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_PATCH_ONLY_MODE) endif() +# Helper function +macro(add_runtime_dependencies depending_target dependency) + if(WIN32) + if(TARGET ${dependency}) + get_property(imported_configs TARGET ${dependency} PROPERTY IMPORTED_CONFIGURATIONS) + set(dlls "") + foreach(cfg ${imported_configs}) + get_property(dll TARGET ${dependency} PROPERTY IMPORTED_LOCATION_${cfg}) + set(dlls ${depthai_dll_libraries} $<$:${dll}>) + endforeach() + endif() + set(depthai_dll_libraries "") + # Create a list of required dll files + set(required_dll_files ${dlls} ${depthai_dll_libraries}) + # Copy the required dlls + add_custom_command(TARGET ${depending_target} POST_BUILD COMMAND + "$<$:${CMAKE_COMMAND};-E;copy_if_different;${required_dll_files};$>" + COMMAND_EXPAND_LISTS + VERBATIM + ) + message(STATUS "Required dlls for core are: ${required_dll_files}") + endif() +endmacro() +# Add libusb dll in build time +add_runtime_dependencies(${TARGET_CORE_NAME} usb-1.0) ######################## # OpenCV Support 2 @@ -1053,7 +1075,7 @@ if(DEPTHAI_SANITIZE) endif() endif() endif() -function(private_data) +function(private_data) set(one URL SHA1 CREDENTIALS LOCATION FILE) set(multiple HTTPHEADER) diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake index b5f9469647..05905af7dd 100644 --- a/cmake/depthaiDependencies.cmake +++ b/cmake/depthaiDependencies.cmake @@ -38,6 +38,7 @@ if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS)) # spdlog for library and device logging find_package(spdlog ${_QUIET} CONFIG REQUIRED) + find_package(OpenSSL REQUIRED) # Log collection dependencies if(DEPTHAI_ENABLE_CURL) find_package(CURL ${_QUIET} CONFIG REQUIRED) diff --git a/cmake/ports/xlink/portfile.cmake b/cmake/ports/xlink/portfile.cmake index 277e51984e..fbe103b87b 100644 --- a/cmake/ports/xlink/portfile.cmake +++ b/cmake/ports/xlink/portfile.cmake @@ -23,3 +23,7 @@ vcpkg_cmake_configure( vcpkg_cmake_install() vcpkg_fixup_pkgconfig() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") +vcpkg_cmake_config_fixup(PACKAGE_NAME xlink CONFIG_PATH "lib/cmake/XLink") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") diff --git a/cmake/triplets/arm64-linux.cmake b/cmake/triplets/arm64-linux.cmake index bf34129c75..5683acaaa6 100644 --- a/cmake/triplets/arm64-linux.cmake +++ b/cmake/triplets/arm64-linux.cmake @@ -4,10 +4,7 @@ set(VCPKG_LIBRARY_LINKAGE static) set(VCPKG_CMAKE_SYSTEM_NAME Linux) -if(PORT MATCHES "ffmpeg") +if(PORT MATCHES "libusb") set(VCPKG_LIBRARY_LINKAGE dynamic) endif() -if(PORT MATCHES "opencv") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() diff --git a/cmake/triplets/arm64-osx.cmake b/cmake/triplets/arm64-osx.cmake new file mode 100644 index 0000000000..1d8c1a5bd6 --- /dev/null +++ b/cmake/triplets/arm64-osx.cmake @@ -0,0 +1,9 @@ +set(VCPKG_TARGET_ARCHITECTURE arm64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Darwin) +set(VCPKG_OSX_ARCHITECTURES arm64) +if(PORT MATCHES "libusb") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() diff --git a/cmake/triplets/x64-linux.cmake b/cmake/triplets/x64-linux.cmake index 813aa99f3d..39f17c4e01 100644 --- a/cmake/triplets/x64-linux.cmake +++ b/cmake/triplets/x64-linux.cmake @@ -1,11 +1,8 @@ set(VCPKG_TARGET_ARCHITECTURE x64) set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE static) -if(PORT MATCHES "ffmpeg") +if(PORT MATCHES "libusb") set(VCPKG_LIBRARY_LINKAGE dynamic) endif() -if(PORT MATCHES "opencv") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() set(VCPKG_CMAKE_SYSTEM_NAME Linux) diff --git a/cmake/triplets/x64-osx.cmake b/cmake/triplets/x64-osx.cmake new file mode 100644 index 0000000000..fb35456978 --- /dev/null +++ b/cmake/triplets/x64-osx.cmake @@ -0,0 +1,11 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Darwin) +set(VCPKG_OSX_ARCHITECTURES x86_64) + +if(PORT MATCHES "libusb") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() + diff --git a/cmake/triplets/x64-windows.cmake b/cmake/triplets/x64-windows.cmake index 0739e5c28b..6cd0473cbf 100644 --- a/cmake/triplets/x64-windows.cmake +++ b/cmake/triplets/x64-windows.cmake @@ -2,10 +2,7 @@ set(VCPKG_TARGET_ARCHITECTURE x64) set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE dynamic) -if(PORT MATCHES "ffmpeg") +if(PORT MATCHES "libusb") set(VCPKG_LIBRARY_LINKAGE dynamic) endif() -if(PORT MATCHES "opencv") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() diff --git a/src/utility/spdlog-fmt.hpp b/src/utility/spdlog-fmt.hpp index 2a8cdf44fd..a42de2fc65 100755 --- a/src/utility/spdlog-fmt.hpp +++ b/src/utility/spdlog-fmt.hpp @@ -24,7 +24,7 @@ struct fmt::formatter : formatter { template #if FMT_VERSION >= 100000 auto format(const dai::Path& p, FormatContext& ctx) const { -#else +#else auto format(const dai::Path& p, FormatContext& ctx) -> decltype(ctx.out()) { #endif std::string output; From 927a899e5076990606f3bd232de45317c9b9ee08 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 28 Nov 2024 09:42:00 +0100 Subject: [PATCH 120/131] stock spdlog --- cmake/ports/spdlog/portfile.cmake | 18 ------------------ cmake/ports/spdlog/vcpkg.json | 15 --------------- 2 files changed, 33 deletions(-) delete mode 100644 cmake/ports/spdlog/portfile.cmake delete mode 100644 cmake/ports/spdlog/vcpkg.json diff --git a/cmake/ports/spdlog/portfile.cmake b/cmake/ports/spdlog/portfile.cmake deleted file mode 100644 index e0e7ff4d52..0000000000 --- a/cmake/ports/spdlog/portfile.cmake +++ /dev/null @@ -1,18 +0,0 @@ -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO gabime/spdlog - REF de0dbfa3596a18cd70a4619b6a9766847a941276 - SHA512 3157cb8769df2e01f89d4f376f71f3a50b28956467978d80d5ec32f9004a3edcbec2ea1969a420a900b326972e534484001297bd7db7e27488108c57d88e1627 - HEAD_REF master -) -vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -DSPDLOG_BUILD_EXAMPLE=OFF - -DSPDLOG_FMT_EXTERNAL=OFF - -DCMAKE_CXX_VISIBILITY_PRESET=hidden - -DCMAKE_C_VISIBILITY_PRESET=hidden -) - -vcpkg_cmake_install() - diff --git a/cmake/ports/spdlog/vcpkg.json b/cmake/ports/spdlog/vcpkg.json deleted file mode 100644 index f8905491d6..0000000000 --- a/cmake/ports/spdlog/vcpkg.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "spdlog", - "version-string": "0.11.2", - "description": "Fast C++ logging library.", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - } -] -} From 2cc7076f61b4a1e2fc6e97b4934b12141d245f6a Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 28 Nov 2024 11:55:02 +0100 Subject: [PATCH 121/131] fix linux wheels build, fp16 from stock, python bindings & tests opts --- CMakeLists.txt | 15 +++++++++++---- bindings/python/CMakeLists.txt | 3 +++ cmake/depthaiDependencies.cmake | 2 +- cmake/ports/fp16/portfile.cmake | 18 ------------------ cmake/ports/fp16/vcpkg.json | 17 ----------------- examples/cpp/CMakeLists.txt | 2 +- vcpkg.json | 27 +++++++++++++++++---------- 7 files changed, 33 insertions(+), 51 deletions(-) delete mode 100644 cmake/ports/fp16/portfile.cmake delete mode 100644 cmake/ports/fp16/vcpkg.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 710ca901b7..649537e683 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ option(DEPTHAI_ENABLE_APRIL_TAG "Enable AprilTag node" ON) option(DEPTHAI_RTABMAP_SUPPORT "Enable optional RTABMap support" OFF) option(DEPTHAI_BASALT_SUPPORT "Enable optional Basalt support" OFF) option(DEPTHAI_ENABLE_PROTOBUF "Enable Protobuf support" ON) +option(DEPTHAI_BUILD_PYTHON "Build python bindings" OFF) +option(DEPTHAI_BUILD_TESTS "Build tests" OFF) option(DEPTHAI_BOOTSTRAP_VCPKG "Automatically bootstrap VCPKG" ON) set(DEPTHAI_HAS_APRIL_TAG ${DEPTHAI_ENABLE_APRIL_TAG}) @@ -82,6 +84,14 @@ else() message(STATUS "Remote Connection support disabled because Protobuf support is disabled.") endif() +if(DEPTHAI_BUILD_PYTHON) + list(APPEND VCPKG_MANIFEST_FEATURES "python-bindings") +endif() + +if(DEPTHAI_BUILD_TESTS) + list(APPEND VCPKG_MANIFEST_FEATURES "tests") +endif() + if(DEPTHAI_ENABLE_REMOTE_CONNECTION) list(APPEND VCPKG_MANIFEST_FEATURES "remote-connection-support") endif() @@ -259,7 +269,6 @@ set(TARGET_OPENCV_ALIAS opencv) if(DEPTHAI_OPENCV_SUPPORT) # Check if required libraries are available set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic") # for FFMPEG - set(REQUIRED_OPENCV_LIBRARIES "opencv_core" "opencv_imgproc" "opencv_videoio" "opencv_highgui") set(OPENCV_SUPPORT_AVAILABLE ${OpenCV_FOUND}) foreach(lib ${REQUIRED_OPENCV_LIBRARIES}) @@ -514,9 +523,7 @@ if(DEPTHAI_MERGED_TARGET) endif() # First specify options -option(DEPTHAI_BUILD_TESTS "Build tests" OFF) option(DEPTHAI_BUILD_EXAMPLES "Build examples - Requires OpenCV library to be installed" OFF) -option(DEPTHAI_BUILD_PYTHON "Build python bindings" OFF) option(DEPTHAI_BUILD_DOCS "Build documentation - requires doxygen to be installed" OFF) # Specify support for FW @@ -690,6 +697,7 @@ target_include_directories(${TARGET_CORE_NAME} "$" "$" "$" + "$" ) target_include_directories(${TARGET_CORE_NAME} SYSTEM @@ -718,7 +726,6 @@ target_link_libraries(${TARGET_CORE_NAME} XLink Threads::Threads BZip2::BZip2 - FP16::fp16 LibArchive::LibArchive liblzma::liblzma ZLIB::ZLIB diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index ed87b8d787..2fd0f13aad 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -273,6 +273,8 @@ if(DEPTHAI_MERGED_TARGET) target_include_directories(${TARGET_NAME} PRIVATE external/pybind11_opencv_numpy) endif() +target_link_options(${TARGET_NAME} PRIVATE "LINKER:-Bsymbolic") + set(DEPTHAI_LINK_TARGET depthai::core) if(NOT DEPTHAI_MERGED_TARGET) list(APPEND DEPTHAI_LINK_TARGET depthai::opencv) @@ -370,6 +372,7 @@ if(SANITIZE_ADDRESS OR SANITIZE_MEMORY OR SANITIZE_THREAD OR SANITIZE_UNDEFINED) message(STATUS "ASAN environment variables: ${ASAN_ENVIRONMENT_VARS}") endif() +set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic") # for FFMPEG ######################## # Testing ######################## diff --git a/cmake/depthaiDependencies.cmake b/cmake/depthaiDependencies.cmake index 05905af7dd..ed1b81676b 100644 --- a/cmake/depthaiDependencies.cmake +++ b/cmake/depthaiDependencies.cmake @@ -24,7 +24,7 @@ if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS)) find_package(lz4 CONFIG REQUIRED) # FP16 for conversions - find_package(FP16 ${_QUIET} CONFIG REQUIRED) + find_path(FP16_INCLUDE_DIR NAMES fp16.h) find_package(PNG REQUIRED) # libarchive for firmware packages diff --git a/cmake/ports/fp16/portfile.cmake b/cmake/ports/fp16/portfile.cmake deleted file mode 100644 index 36509359b9..0000000000 --- a/cmake/ports/fp16/portfile.cmake +++ /dev/null @@ -1,18 +0,0 @@ - - -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO luxonis/FP16 - REF c911175d2717e562976e606c6e5f799bf40cf94e - SHA512 4b892070e43dbaac3a457996981e4a9b6a0faaf7703d99f5f515604d8dcb2ff90c037c2660e36f68bdbb3481cb0fad5d2d7adf564ab19cefa420ee3f84bda4b6 - HEAD_REF master -) -vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -DFP16_BUILD_BENCHMARKS=OFF - -DFP16_BUILD_TESTS=OFF -) - -vcpkg_cmake_install() - diff --git a/cmake/ports/fp16/vcpkg.json b/cmake/ports/fp16/vcpkg.json deleted file mode 100644 index 3d82078248..0000000000 --- a/cmake/ports/fp16/vcpkg.json +++ /dev/null @@ -1,17 +0,0 @@ - - -{ - "name": "fp16", - "version-string": "luxonis-0.0.0", - "description": "Conversion to/from half-precision floating point formats", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - } -] -} diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt index cfb5a10504..46ad027ffd 100644 --- a/examples/cpp/CMakeLists.txt +++ b/examples/cpp/CMakeLists.txt @@ -9,7 +9,7 @@ find_package(Sanitizers) add_library(utility utility/utility.cpp) target_include_directories(utility PUBLIC "utility") add_default_flags(utility LEAN) -target_link_libraries(utility FP16::fp16 ${OpenCV_LIBS}) +target_link_libraries(utility ${OpenCV_LIBS}) set(test_env # Misc diff --git a/vcpkg.json b/vcpkg.json index 948e8cc2a0..eec5132136 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -15,8 +15,6 @@ "mp4v2", "libnop", "neargye-semver", - "pybind11", - "catch2", { "name": "ffmpeg", "features": [ @@ -27,10 +25,6 @@ "name": "libarchive", "default-features": false }, - { - "name": "opencv", - "default-features": false - }, { "name": "opencv4", "default-features": false, @@ -65,6 +59,12 @@ "protobuf" ] }, + "python-bindings": { + "description": "Enable Python bindings", + "dependencies": [ + "pybind11" + ] + }, "remote-connection-support": { "description": "Enable remote connection support", "dependencies": [ @@ -115,10 +115,6 @@ "name": "opencv4", "default-features": false }, - { - "name": "opencv", - "default-features": false - }, { "name": "basalt" } @@ -140,6 +136,17 @@ "features": [ "libusb" ] + }, + { + "name": "libusb" + } + ] + }, + "tests": { + "description": "Enable tests", + "dependencies": [ + { + "name": "catch2" } ] } From 177327bab7b47ff31e13c53e4f96a0171fd3792a Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 28 Nov 2024 13:47:50 +0100 Subject: [PATCH 122/131] fix linux arm and linker errors on other systems --- .github/workflows/python-main.yml | 10 ++++++++-- bindings/python/CMakeLists.txt | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index b63c62e42f..789b067b07 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -427,12 +427,19 @@ jobs: with: submodules: 'recursive' - name: Installing libusb1-devel dependency - run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel libXrandr-devel libXtst-devel libudev-devel lapack-devel nasm libtool autoconf automake + run: yum install -y libusb1-devel perl-core curl zip unzip tar zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel libXrandr-devel libXtst-devel libudev-devel lapack-devel nasm libtool autoconf automake - name: Installing cmake dependency run: | cd bindings/python /opt/python/cp38-cp38/bin/python3.8 -m pip install cmake ln -s /opt/python/cp38-cp38/bin/cmake /bin/ + - name: Setup ninja required for arm64 builds + run: | + git clone https://github.com/ninja-build/ninja.git + cd ninja + git checkout v1.10.2 + cmake -Bbuild-cmake + cmake --build build-cmake --target install - name: Create folder structure run: cd bindings/python && mkdir -p wheelhouse/audited/ @@ -488,7 +495,6 @@ jobs: python-set: ["7", "8", "9", "10", "11", "12"] env: # workaround required for cache@v3, https://github.com/actions/cache/issues/1428 - DEPTHAI_VCPKG_CFLAGS: "-std=c99" # Needed so vpckg can bootstrap itself with the old GCC on the manylinux image VCPKG_FORCE_SYSTEM_BINARIES: "1" # Needed so vpckg can bootstrap itself VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" DEPTHAI_BUILD_BASALT: ON diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index 2fd0f13aad..a1fa1b2e2c 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -273,7 +273,10 @@ if(DEPTHAI_MERGED_TARGET) target_include_directories(${TARGET_NAME} PRIVATE external/pybind11_opencv_numpy) endif() -target_link_options(${TARGET_NAME} PRIVATE "LINKER:-Bsymbolic") +if(UNIX) + # Add -Bsymbolic for FFMPEG linking + target_link_options(${TARGET_NAME} PRIVATE "LINKER:-Bsymbolic") +endif() set(DEPTHAI_LINK_TARGET depthai::core) if(NOT DEPTHAI_MERGED_TARGET) From 6c32c1e32d57195b97035c9cacd73dbf55d2e0dd Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 28 Nov 2024 13:59:26 +0100 Subject: [PATCH 123/131] fix arm --- .github/workflows/python-main.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index 789b067b07..bf45cad914 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -427,19 +427,12 @@ jobs: with: submodules: 'recursive' - name: Installing libusb1-devel dependency - run: yum install -y libusb1-devel perl-core curl zip unzip tar zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel libXrandr-devel libXtst-devel libudev-devel lapack-devel nasm libtool autoconf automake + run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel libXrandr-devel libXtst-devel libudev-devel lapack-devel nasm libtool autoconf automake - name: Installing cmake dependency run: | cd bindings/python /opt/python/cp38-cp38/bin/python3.8 -m pip install cmake ln -s /opt/python/cp38-cp38/bin/cmake /bin/ - - name: Setup ninja required for arm64 builds - run: | - git clone https://github.com/ninja-build/ninja.git - cd ninja - git checkout v1.10.2 - cmake -Bbuild-cmake - cmake --build build-cmake --target install - name: Create folder structure run: cd bindings/python && mkdir -p wheelhouse/audited/ @@ -512,12 +505,19 @@ jobs: with: submodules: 'recursive' - name: Installing libusb1-devel dependency - run: yum install -y libusb1-devel perl-core curl zip unzip tar ninja-build zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel libXrandr-devel libXtst-devel libudev-devel lapack-devel nasm libtool autoconf automake + run: yum install -y libusb1-devel perl-core curl zip unzip tar zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel libXrandr-devel libXtst-devel libudev-devel lapack-devel nasm libtool autoconf automake - name: Installing cmake dependency run: | cd bindings/python /opt/python/cp38-cp38/bin/python3.8 -m pip install cmake ln -s /opt/python/cp38-cp38/bin/cmake /bin/ + - name: Setup ninja required for arm64 builds + run: | + git clone https://github.com/ninja-build/ninja.git + cd ninja + git checkout v1.10.2 + cmake -Bbuild-cmake + cmake --build build-cmake --target install - name: Create folder structure run: cd bindings/python && mkdir -p wheelhouse/audited/ From 8777724f5995d39ffde719ea0fcb90f8ab82d139 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 28 Nov 2024 15:56:51 +0100 Subject: [PATCH 124/131] fixing ci on other platforms --- .github/workflows/python-main.yml | 2 +- CMakeLists.txt | 4 +++- bindings/python/CMakeLists.txt | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index bf45cad914..addfa5db51 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -204,7 +204,7 @@ jobs: python-architecture: [x64] # TODO(Morato) - re-enable x86 - it complains that OpenCV even though it's 32 bit is not compatible fail-fast: false env: - DEPTHAI_BUILD_BASALT: ON + DEPTHAI_BUILD_BASALT: OFF DEPTHAI_BUILD_PCL: ON DEPTHAI_BUILD_RTABMAP: ON VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" diff --git a/CMakeLists.txt b/CMakeLists.txt index 649537e683..2ee8ca849c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -268,7 +268,9 @@ set(TARGET_OPENCV_NAME ${PROJECT_NAME}-opencv) set(TARGET_OPENCV_ALIAS opencv) if(DEPTHAI_OPENCV_SUPPORT) # Check if required libraries are available - set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic") # for FFMPEG + if(UNIX AND NOT APPLE) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic") # for FFMPEG + endif() set(REQUIRED_OPENCV_LIBRARIES "opencv_core" "opencv_imgproc" "opencv_videoio" "opencv_highgui") set(OPENCV_SUPPORT_AVAILABLE ${OpenCV_FOUND}) foreach(lib ${REQUIRED_OPENCV_LIBRARIES}) diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index a1fa1b2e2c..3e111dccb7 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -273,7 +273,7 @@ if(DEPTHAI_MERGED_TARGET) target_include_directories(${TARGET_NAME} PRIVATE external/pybind11_opencv_numpy) endif() -if(UNIX) +if(UNIX AND NOT APPLE) # Add -Bsymbolic for FFMPEG linking target_link_options(${TARGET_NAME} PRIVATE "LINKER:-Bsymbolic") endif() @@ -375,7 +375,6 @@ if(SANITIZE_ADDRESS OR SANITIZE_MEMORY OR SANITIZE_THREAD OR SANITIZE_UNDEFINED) message(STATUS "ASAN environment variables: ${ASAN_ENVIRONMENT_VARS}") endif() -set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic") # for FFMPEG ######################## # Testing ######################## From 57cf12e52be880798533f804d08fad7dcba4f678 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 28 Nov 2024 16:05:27 +0100 Subject: [PATCH 125/131] try fixing basalt symbols on win --- .github/workflows/python-main.yml | 2 +- cmake/ports/basalt/win.patch | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index addfa5db51..bf45cad914 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -204,7 +204,7 @@ jobs: python-architecture: [x64] # TODO(Morato) - re-enable x86 - it complains that OpenCV even though it's 32 bit is not compatible fail-fast: false env: - DEPTHAI_BUILD_BASALT: OFF + DEPTHAI_BUILD_BASALT: ON DEPTHAI_BUILD_PCL: ON DEPTHAI_BUILD_RTABMAP: ON VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" diff --git a/cmake/ports/basalt/win.patch b/cmake/ports/basalt/win.patch index dad1b28a79..19e54793db 100644 --- a/cmake/ports/basalt/win.patch +++ b/cmake/ports/basalt/win.patch @@ -16,6 +16,7 @@ index 4094b79..128e56b 100644 +if(WIN32) +set (BASALT_CXX_FLAGS "/bigobj") ++set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif() + # For avoiding libfmt >9 issues, see https://github.com/strasdat/Sophus/issues/366 #issuecomment-1229178088 From 2cffe897e1101d6d3cbdae66eccef1b8a6782641 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 28 Nov 2024 16:28:31 +0100 Subject: [PATCH 126/131] try to fix pytest --- bindings/python/tests/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bindings/python/tests/CMakeLists.txt b/bindings/python/tests/CMakeLists.txt index 7a5a8feb04..29a0ea8a16 100644 --- a/bindings/python/tests/CMakeLists.txt +++ b/bindings/python/tests/CMakeLists.txt @@ -40,6 +40,9 @@ add_custom_target( WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" USES_TERMINAL ) - +if(UNIX AND NOT APPLE) + # Add -Bsymbolic for FFMPEG linking + target_link_options(${TARGET_TEST_MODULE} PRIVATE "LINKER:-Bsymbolic") +endif() # Link to depthai target_link_libraries(${TARGET_TEST_MODULE} PRIVATE pybind11::pybind11 depthai::core) \ No newline at end of file From 060cad1b27aaa8fbbde93d7e7c21bfe9dcda5378 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 28 Nov 2024 17:06:42 +0100 Subject: [PATCH 127/131] fix basalt patch --- cmake/ports/basalt/win.patch | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/cmake/ports/basalt/win.patch b/cmake/ports/basalt/win.patch index 19e54793db..0b853d3f4b 100644 --- a/cmake/ports/basalt/win.patch +++ b/cmake/ports/basalt/win.patch @@ -1,25 +1,15 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 4094b79..128e56b 100644 +index 4094b79..5735247 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -76,7 +76,6 @@ set(CMAKE_CXX_EXTENSIONS OFF) - set(CMAKE_POSITION_INDEPENDENT_CODE ON) - set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - -- - # Flags used for CHECK_CXX_SOURCE_COMPILES - set(CMAKE_REQUIRED_FLAGS "-Wno-error") - -@@ -104,6 +103,10 @@ endif() +@@ -104,6 +104,10 @@ endif() # base set of compile flags set (BASALT_CXX_FLAGS) +if(WIN32) -+set (BASALT_CXX_FLAGS "/bigobj") -+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) ++ set(BASALT_CXX_FLAGS "/bigobj") ++ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif() -+ # For avoiding libfmt >9 issues, see https://github.com/strasdat/Sophus/issues/366 #issuecomment-1229178088 add_definitions(-DFMT_DEPRECATED_OSTREAM=1) - From e6b67471f9f0faeb7eb320e85bffdef293c1c215 Mon Sep 17 00:00:00 2001 From: Serafadam Date: Thu, 28 Nov 2024 16:42:21 +0100 Subject: [PATCH 128/131] disable basalt for win for now --- .github/workflows/python-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-main.yml b/.github/workflows/python-main.yml index bf45cad914..addfa5db51 100644 --- a/.github/workflows/python-main.yml +++ b/.github/workflows/python-main.yml @@ -204,7 +204,7 @@ jobs: python-architecture: [x64] # TODO(Morato) - re-enable x86 - it complains that OpenCV even though it's 32 bit is not compatible fail-fast: false env: - DEPTHAI_BUILD_BASALT: ON + DEPTHAI_BUILD_BASALT: OFF DEPTHAI_BUILD_PCL: ON DEPTHAI_BUILD_RTABMAP: ON VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" From 812ead934a0dc234fd68f9ab3ab5ce9b8fd5daeb Mon Sep 17 00:00:00 2001 From: Matevz Morato Date: Fri, 29 Nov 2024 14:27:36 +0100 Subject: [PATCH 129/131] Static linking by default on Windows --- cmake/triplets/x64-windows.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/triplets/x64-windows.cmake b/cmake/triplets/x64-windows.cmake index 6cd0473cbf..4615a4ae9a 100644 --- a/cmake/triplets/x64-windows.cmake +++ b/cmake/triplets/x64-windows.cmake @@ -1,6 +1,6 @@ set(VCPKG_TARGET_ARCHITECTURE x64) -set(VCPKG_CRT_LINKAGE dynamic) -set(VCPKG_LIBRARY_LINKAGE dynamic) +set(VCPKG_CRT_LINKAGE static) +set(VCPKG_LIBRARY_LINKAGE static) if(PORT MATCHES "libusb") set(VCPKG_LIBRARY_LINKAGE dynamic) From 2c4436eee6435a4164e69e8f39e3390f7ec4af21 Mon Sep 17 00:00:00 2001 From: Matevz Morato Date: Fri, 29 Nov 2024 18:11:13 +0100 Subject: [PATCH 130/131] Try to override the static compilation of CRT for Windows --- bindings/python/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index 3e111dccb7..1b9155794f 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -190,6 +190,9 @@ if(WIN32) # Disable "d" postfix, so python can import the library as is set_target_properties(${TARGET_NAME} PROPERTIES DEBUG_POSTFIX "") + + # Statically compile CRT + target_compile_options(${TARGET_NAME} PRIVATE "/MT") endif() # Add stubs (pyi) generation step after building bindings From b3d38c72cb7b30af16e94547f0aaeee622d090da Mon Sep 17 00:00:00 2001 From: Matevz Morato Date: Fri, 29 Nov 2024 18:52:31 +0100 Subject: [PATCH 131/131] Make static runtime library "global" --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ee8ca849c..46b4d124c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.16) # Early options option(DEPTHAI_ENABLE_LIBUSB "Enable usage of libusb and interaction with USB devices" ON) # Build AprilTag node code (note, that even if set to OFF, an AprilTagNode can be used with setRunOnHost(false)) @@ -14,6 +14,10 @@ set(DEPTHAI_HAS_APRIL_TAG ${DEPTHAI_ENABLE_APRIL_TAG}) if(WIN32) message(STATUS "AprilTag node is not supported on Windows") set(DEPTHAI_HAS_APRIL_TAG OFF) + + # Statically compile vcruntime library + add_compile_options(/MT) + endif() if(DEPTHAI_HAS_APRIL_TAG) list(APPEND VCPKG_MANIFEST_FEATURES "apriltag")