aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libmultisense
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libmultisense
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/libmultisense')
-rw-r--r--vcpkg/ports/libmultisense/0000-platform-specific-links.patch133
-rw-r--r--vcpkg/ports/libmultisense/0001-find-public-api-dependencies.patch15
-rw-r--r--vcpkg/ports/libmultisense/0002-disable-error-on-warning.patch20
-rw-r--r--vcpkg/ports/libmultisense/0003-utilities-cc-unreachable-code.patch12
-rw-r--r--vcpkg/ports/libmultisense/portfile.cmake103
-rw-r--r--vcpkg/ports/libmultisense/usage4
-rw-r--r--vcpkg/ports/libmultisense/vcpkg.json36
7 files changed, 323 insertions, 0 deletions
diff --git a/vcpkg/ports/libmultisense/0000-platform-specific-links.patch b/vcpkg/ports/libmultisense/0000-platform-specific-links.patch
new file mode 100644
index 0000000..665e4c5
--- /dev/null
+++ b/vcpkg/ports/libmultisense/0000-platform-specific-links.patch
@@ -0,0 +1,133 @@
+diff --git a/source/Legacy/CMakeLists.txt b/source/Legacy/CMakeLists.txt
+index 2a7367c..a0bfbd3 100644
+--- a/source/Legacy/CMakeLists.txt
++++ b/source/Legacy/CMakeLists.txt
+@@ -86,12 +86,12 @@ set_target_properties(MultiSense PROPERTIES PUBLIC_HEADER "${MULTISENSE_HEADERS}
+ # We want to link against our child libraries.
+ #
+
+-if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
++find_package(Threads REQUIRED)
++target_link_libraries(MultiSense Threads::Threads)
++if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ target_link_libraries(MultiSense ws2_32)
+-elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+- target_link_libraries(MultiSense pthread)
+-else()
+- target_link_libraries(MultiSense pthread rt)
++elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
++ target_link_libraries(MultiSense rt)
+ endif()
+
+ include(CMakePackageConfigHelpers)
+diff --git a/source/LibMultiSense/CMakeLists.txt b/source/LibMultiSense/CMakeLists.txt
+index 7a4cb8e..72e2e54 100644
+--- a/source/LibMultiSense/CMakeLists.txt
++++ b/source/LibMultiSense/CMakeLists.txt
+@@ -66,12 +66,12 @@ set_target_properties(MultiSense PROPERTIES PUBLIC_HEADER "${MULTISENSE_HEADERS}
+ # We want to link against our child libraries.
+ #
+
+-if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
++find_package(Threads REQUIRED)
++target_link_libraries(MultiSense Threads::Threads)
++if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ target_link_libraries(MultiSense ws2_32)
+-elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+- target_link_libraries(MultiSense pthread)
+-else()
+- target_link_libraries(MultiSense pthread rt)
++elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
++ target_link_libraries(MultiSense rt)
+ endif()
+
+ if (BUILD_TESTS)
+diff --git a/source/Utilities/Legacy/CMakeLists.txt b/source/Utilities/Legacy/CMakeLists.txt
+index 21c747d..da05f78 100644
+--- a/source/Utilities/Legacy/CMakeLists.txt
++++ b/source/Utilities/Legacy/CMakeLists.txt
+@@ -8,32 +8,16 @@ include_directories(shared)
+ # Common libraries that each utility needs to link with.
+ #
+
+-if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+-
+-set (MULTISENSE_UTILITY_LIBS
+- ${MULTISENSE_UTILITY_LIBS}
+- MultiSense
+- ws2_32
+-)
+-
+-elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+-
+-set (MULTISENSE_UTILITY_LIBS
+- ${MULTISENSE_UTILITY_LIBS}
++find_package(Threads REQUIRED)
++list(APPEND MULTISENSE_UTILITY_LIBS
+ MultiSense
+- pthread
++ Threads::Threads
+ )
+-
+-else ()
+-
+-set (MULTISENSE_UTILITY_LIBS
+- ${MULTISENSE_UTILITY_LIBS}
+- MultiSense
+- pthread
+- rt
+-)
+-
+-endif ()
++if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
++ list(APPEND MULTISENSE_UTILITY_LIBS ws2_32)
++elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
++ list(APPEND MULTISENSE_UTILITY_LIBS rt)
++endif()
+
+ #
+ # Recurse into each of these directories.
+diff --git a/source/Utilities/LibMultiSense/CMakeLists.txt b/source/Utilities/LibMultiSense/CMakeLists.txt
+index 3d21f9b..0d9a992 100644
+--- a/source/Utilities/LibMultiSense/CMakeLists.txt
++++ b/source/Utilities/LibMultiSense/CMakeLists.txt
+@@ -1,30 +1,13 @@
+-
+-if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+-
+-set (MULTISENSE_UTILITY_LIBS
+- ${MULTISENSE_UTILITY_LIBS}
+- MultiSense
+- ws2_32
+-)
+-
+-elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+-
+-set (MULTISENSE_UTILITY_LIBS
+- ${MULTISENSE_UTILITY_LIBS}
+- MultiSense
+- pthread
++find_package(Threads REQUIRED)
++list(APPEND MULTISENSE_UTILITY_LIBS
++ MultiSense
++ Threads::Threads
+ )
+-
+-else ()
+-
+-set (MULTISENSE_UTILITY_LIBS
+- ${MULTISENSE_UTILITY_LIBS}
+- MultiSense
+- pthread
+- rt
+-)
+-
+-endif ()
++if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
++ list(APPEND MULTISENSE_UTILITY_LIBS ws2_32)
++elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
++ list(APPEND MULTISENSE_UTILITY_LIBS rt)
++endif()
+
+ add_subdirectory(ChangeIpUtility)
+ add_subdirectory(DeviceInfoUtility)
diff --git a/vcpkg/ports/libmultisense/0001-find-public-api-dependencies.patch b/vcpkg/ports/libmultisense/0001-find-public-api-dependencies.patch
new file mode 100644
index 0000000..58e24e9
--- /dev/null
+++ b/vcpkg/ports/libmultisense/0001-find-public-api-dependencies.patch
@@ -0,0 +1,15 @@
+diff --git a/source/LibMultiSense/MultiSenseConfig.cmake.in b/source/LibMultiSense/MultiSenseConfig.cmake.in
+index cf98076..dee7a62 100644
+--- a/source/LibMultiSense/MultiSenseConfig.cmake.in
++++ b/source/LibMultiSense/MultiSenseConfig.cmake.in
+@@ -2,6 +2,10 @@
+
+ include(CMakeFindDependencyMacro)
+ find_dependency(MultiSenseWire)
++find_dependency(Threads)
++if (@BUILD_JSON_SERIALIZATION@)
++ find_dependency(nlohmann_json 3.9)
++endif ()
+
+ include("${CMAKE_CURRENT_LIST_DIR}/MultiSenseTargets.cmake")
+
diff --git a/vcpkg/ports/libmultisense/0002-disable-error-on-warning.patch b/vcpkg/ports/libmultisense/0002-disable-error-on-warning.patch
new file mode 100644
index 0000000..e22d961
--- /dev/null
+++ b/vcpkg/ports/libmultisense/0002-disable-error-on-warning.patch
@@ -0,0 +1,20 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 333d8ca..d0e6160 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -24,6 +24,7 @@ project(LibMultiSense
+
+ include (CheckCXXSourceCompiles)
+
++if(0)
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ string (REGEX REPLACE "/W3" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+ string (REGEX REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+@@ -41,6 +42,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Ap
+ #
+ add_compile_options(-Wno-gnu-zero-variadic-macro-arguments)
+ endif()
++endif()
+
+ option(BUILD_LEGACY_API "Build the legacy MultiSense API. Defaults to On for backwards compatibility." ON)
+ option(MULTISENSE_BUILD_UTILITIES "Build MultiSense utility applications. Defaults to ON for backwards compatibility." ON)
diff --git a/vcpkg/ports/libmultisense/0003-utilities-cc-unreachable-code.patch b/vcpkg/ports/libmultisense/0003-utilities-cc-unreachable-code.patch
new file mode 100644
index 0000000..78e0db9
--- /dev/null
+++ b/vcpkg/ports/libmultisense/0003-utilities-cc-unreachable-code.patch
@@ -0,0 +1,12 @@
+diff --git a/source/LibMultiSense/details/utilities.cc b/source/LibMultiSense/details/utilities.cc
+index 5c20566..768a291 100644
+--- a/source/LibMultiSense/details/utilities.cc
++++ b/source/LibMultiSense/details/utilities.cc
+@@ -185,7 +185,6 @@ bool write_image(const Image &image, const std::filesystem::path &path)
+ }
+ throw std::runtime_error("Unsupported path extension: " + extension.string() + ". Try compiling with OpenCV");
+ #endif
+- return false;
+ }
+
+ std::optional<Image> create_depth_image(const ImageFrame &frame,
diff --git a/vcpkg/ports/libmultisense/portfile.cmake b/vcpkg/ports/libmultisense/portfile.cmake
new file mode 100644
index 0000000..54db661
--- /dev/null
+++ b/vcpkg/ports/libmultisense/portfile.cmake
@@ -0,0 +1,103 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO carnegierobotics/LibMultiSense
+ REF ${VERSION}
+ SHA512 69472f288de46c0ecdbbbcb8c280610c1c80778d660098e3b639ab653b108096c3fb4cd92a21afd4745b959a0c80812c5bf2d42053760bbceeafd90e67c20388
+ HEAD_REF master
+ PATCHES
+ 0000-platform-specific-links.patch
+ 0001-find-public-api-dependencies.patch
+ 0002-disable-error-on-warning.patch
+ 0003-utilities-cc-unreachable-code.patch
+)
+
+vcpkg_check_features(
+ OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ json-serialization BUILD_JSON_SERIALIZATION
+ json-serialization CMAKE_REQUIRE_FIND_PACKAGE_nlohmann_json
+ opencv BUILD_OPENCV
+ utilities MULTISENSE_BUILD_UTILITIES
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DBUILD_LEGACY_API=OFF
+ ${FEATURE_OPTIONS}
+)
+
+vcpkg_cmake_install()
+
+vcpkg_cmake_config_fixup(
+ PACKAGE_NAME "MultiSenseWire"
+ CONFIG_PATH "lib/cmake/MultiSenseWire"
+ DO_NOT_DELETE_PARENT_CONFIG_PATH
+)
+vcpkg_cmake_config_fixup(
+ PACKAGE_NAME "MultiSense"
+ CONFIG_PATH "lib/cmake/MultiSense"
+)
+vcpkg_fixup_pkgconfig()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+if ("utilities" IN_LIST FEATURES)
+ set(_tool_names
+ ChangeIpUtility
+ ImageCalUtility
+ PointCloudUtility
+ RectifiedFocalLengthUtility
+ SaveImageUtility
+ VersionInfoUtility
+ )
+ if ("json-serialization" IN_LIST FEATURES)
+ list(APPEND _tool_names DeviceInfoUtility)
+ endif ()
+ vcpkg_copy_tools(
+ TOOL_NAMES ${_tool_names}
+ AUTO_CLEAN
+ )
+
+ # Python equivalents of the above tools are also installed into bin. These tools are duplicates and require that
+ # the Python bindings be built, which we are not doing. Since they provide no additional functionality, remove
+ # them.
+ set(_python_tool_names
+ change_ip_utility.py
+ device_info_utility.py
+ image_cal_utility.py
+ point_cloud_utility.py
+ rectified_focal_length_utility.py
+ save_image_utility.py
+ version_info_utility.py
+ )
+ foreach (_python_tool_name IN LISTS _python_tool_names)
+ file(
+ REMOVE
+ "${CURRENT_PACKAGES_DIR}/debug/bin/${_python_tool_name}"
+ "${CURRENT_PACKAGES_DIR}/bin/${_python_tool_name}"
+ )
+ endforeach ()
+
+ # Remove the bin directory if its empty (anticipated on non-Windows platforms).
+ foreach (_directory IN ITEMS
+ "${CURRENT_PACKAGES_DIR}/debug/bin/${_python_tool_name}"
+ "${CURRENT_PACKAGES_DIR}/bin/${_python_tool_name}")
+ if (NOT IS_DIRECTORY "${_directory}")
+ continue()
+ endif ()
+
+ file(GLOB _files_in_directory "${_directory}/*")
+ if("${_files_in_directory}" STREQUAL "")
+ file(REMOVE_RECURSE "${_directory}")
+ endif()
+ endforeach()
+endif ()
+
+vcpkg_install_copyright(
+ FILE_LIST "${SOURCE_PATH}/LICENSE.TXT"
+)
+file(
+ INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage"
+ DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
+)
diff --git a/vcpkg/ports/libmultisense/usage b/vcpkg/ports/libmultisense/usage
new file mode 100644
index 0000000..b32f054
--- /dev/null
+++ b/vcpkg/ports/libmultisense/usage
@@ -0,0 +1,4 @@
+libmultisense provides CMake targets:
+
+ find_package(MultiSense)
+ target_link_libraries(main PRIVATE MultiSense)
diff --git a/vcpkg/ports/libmultisense/vcpkg.json b/vcpkg/ports/libmultisense/vcpkg.json
new file mode 100644
index 0000000..53a2940
--- /dev/null
+++ b/vcpkg/ports/libmultisense/vcpkg.json
@@ -0,0 +1,36 @@
+{
+ "name": "libmultisense",
+ "version": "7.2.0",
+ "description": "A C++ library for interfacing with the MultiSense S family of sensors from Carnegie Robotics.",
+ "homepage": "https://github.com/carnegierobotics/LibMultiSense",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "json-serialization": {
+ "description": "Build JSON type serialization helpers.",
+ "dependencies": [
+ {
+ "name": "nlohmann-json",
+ "version>=": "3.10.2"
+ }
+ ]
+ },
+ "opencv": {
+ "description": "Build OpenCV helpers.",
+ "dependencies": [
+ "opencv"
+ ]
+ },
+ "utilities": {
+ "description": "Build MultiSense utility applications."
+ }
+ }
+}