-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b52035d
commit beaf1b4
Showing
39 changed files
with
2,895 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
exclude_paths: | ||
- CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Build system for header-only boost libraries. | ||
# | ||
# In general, we prefer avoiding boost or use header-only boost libraries. | ||
# Compiling boost libraries can addup to the build time. | ||
# | ||
# Current boost libraries: | ||
# - predef (header-only) | ||
|
||
include(ExternalProject) | ||
|
||
if(WIN32) | ||
message(FATAL_ERROR "Win32 not supported.") | ||
endif() | ||
|
||
ExternalProject_Add( | ||
ext_boost | ||
PREFIX boost | ||
GIT_REPOSITORY https://github.com/boostorg/boost.git | ||
GIT_TAG boost-1.73.0 | ||
GIT_SUBMODULES tools/boostdep libs/predef # Only need a subset of boost | ||
GIT_SHALLOW ON # git clone --depth 1 | ||
GIT_SUBMODULES_RECURSE OFF | ||
BUILD_IN_SOURCE ON | ||
CONFIGURE_COMMAND "" | ||
BUILD_COMMAND echo "Running Boost build..." | ||
COMMAND python tools/boostdep/depinst/depinst.py predef | ||
COMMAND ./bootstrap.sh | ||
COMMAND ./b2 headers | ||
UPDATE_COMMAND "" | ||
INSTALL_COMMAND "" | ||
) | ||
|
||
ExternalProject_Get_Property(ext_boost SOURCE_DIR) | ||
message(STATUS "Boost source dir: ${SOURCE_DIR}") | ||
|
||
# By default, BOOST_INCLUDE_DIRS should not have trailing "/". | ||
# The actual headers files are located in `${SOURCE_DIR}/boost`. | ||
set(BOOST_INCLUDE_DIRS ${SOURCE_DIR}/ext_boost) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
include(ExternalProject) | ||
|
||
ExternalProject_Add( | ||
ext_msgpack-c | ||
PREFIX msgpack-c | ||
URL https://github.com/msgpack/msgpack-c/releases/download/cpp-3.3.0/msgpack-3.3.0.tar.gz | ||
URL_HASH MD5=e676575d52caae974e579c3d5f0ba6a2 | ||
# do not configure | ||
CONFIGURE_COMMAND "" | ||
# do not build | ||
BUILD_COMMAND "" | ||
# do not install | ||
INSTALL_COMMAND "" | ||
) | ||
ExternalProject_Get_Property( ext_msgpack-c SOURCE_DIR ) | ||
set( MSGPACK_INCLUDE_DIRS "${SOURCE_DIR}/include/" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
include(ExternalProject) | ||
include(FetchContent) | ||
|
||
# ExternalProject seems to be the best solution for including zeromq. | ||
# The projects defines options which clash with and pollute our CMake cache. | ||
|
||
ExternalProject_Add( | ||
ext_zeromq | ||
PREFIX "${CMAKE_BINARY_DIR}/zeromq" | ||
URL "https://github.com/zeromq/libzmq/releases/download/v4.3.2/zeromq-4.3.2.tar.gz" | ||
URL_HASH MD5=2047e917c2cc93505e2579bcba67a573 | ||
# do not update | ||
UPDATE_COMMAND "" | ||
CMAKE_ARGS | ||
-DBUILD_STATIC=ON | ||
-DBUILD_SHARED=OFF | ||
-DBUILD_TESTS=OFF | ||
-DENABLE_CPACK=OFF | ||
-DENABLE_CURVE=OFF | ||
-DZMQ_BUILD_TESTS=OFF | ||
-DWITH_DOCS=OFF | ||
-DWITH_PERF_TOOL=OFF | ||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> | ||
) | ||
|
||
# cppzmq is header only. we just need to download | ||
FetchContent_Declare( | ||
ext_cppzmq | ||
URL "https://github.com/zeromq/cppzmq/archive/v4.6.0.tar.gz" | ||
URL_HASH MD5=7cae1b3fbfeaddb9cf1f70e99a98add2 | ||
) | ||
FetchContent_GetProperties(ext_cppzmq) | ||
if(NOT ext_cppzmq_POPULATED) | ||
FetchContent_Populate(ext_cppzmq) | ||
# do not add subdirectory here | ||
endif() | ||
|
||
ExternalProject_Get_Property( ext_zeromq INSTALL_DIR ) | ||
set(ZEROMQ_LIBRARIES zmq) | ||
set(ZEROMQ_LIB_DIR ${INSTALL_DIR}/lib) | ||
set(ZEROMQ_INCLUDE_DIRS "${INSTALL_DIR}/include/;${ext_cppzmq_SOURCE_DIR}/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// ---------------------------------------------------------------------------- | ||
// - Open3D: www.open3d.org - | ||
// ---------------------------------------------------------------------------- | ||
// The MIT License (MIT) | ||
// | ||
// Copyright (c) 2020 www.open3d.org | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
// IN THE SOFTWARE. | ||
// ---------------------------------------------------------------------------- | ||
|
||
#include "open3d/io/rpc/BufferConnection.h" | ||
|
||
#include <zmq.hpp> | ||
|
||
#include "open3d/io/rpc/Messages.h" | ||
#include "open3d/utility/Console.h" | ||
|
||
using namespace open3d::utility; | ||
|
||
namespace open3d { | ||
namespace io { | ||
namespace rpc { | ||
|
||
std::shared_ptr<zmq::message_t> BufferConnection::Send( | ||
zmq::message_t& send_msg) { | ||
buffer_.write((char*)send_msg.data(), send_msg.size()); | ||
|
||
auto OK = messages::Status::OK(); | ||
msgpack::sbuffer sbuf; | ||
messages::Reply reply{OK.MsgId()}; | ||
msgpack::pack(sbuf, reply); | ||
msgpack::pack(sbuf, OK); | ||
return std::shared_ptr<zmq::message_t>( | ||
new zmq::message_t(sbuf.data(), sbuf.size())); | ||
} | ||
|
||
std::shared_ptr<zmq::message_t> BufferConnection::Send(const void* data, | ||
size_t size) { | ||
zmq::message_t send_msg(data, size); | ||
return Send(send_msg); | ||
} | ||
|
||
} // namespace rpc | ||
} // namespace io | ||
} // namespace open3d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// ---------------------------------------------------------------------------- | ||
// - Open3D: www.open3d.org - | ||
// ---------------------------------------------------------------------------- | ||
// The MIT License (MIT) | ||
// | ||
// Copyright (c) 2020 www.open3d.org | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
// IN THE SOFTWARE. | ||
// ---------------------------------------------------------------------------- | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
#include <sstream> | ||
|
||
#include "open3d/io/rpc/ConnectionBase.h" | ||
|
||
namespace open3d { | ||
namespace io { | ||
namespace rpc { | ||
|
||
/// Implements a connection writing to a buffer | ||
class BufferConnection : public ConnectionBase { | ||
public: | ||
BufferConnection() {} | ||
|
||
/// Function for sending data wrapped in a zmq message object. | ||
std::shared_ptr<zmq::message_t> Send(zmq::message_t& send_msg); | ||
|
||
/// Function for sending raw data. Meant for testing purposes | ||
std::shared_ptr<zmq::message_t> Send(const void* data, size_t size); | ||
|
||
std::stringstream& buffer() { return buffer_; } | ||
const std::stringstream& buffer() const { return buffer_; } | ||
|
||
private: | ||
std::stringstream buffer_; | ||
}; | ||
} // namespace rpc | ||
} // namespace io | ||
} // namespace open3d |
Oops, something went wrong.