Skip to content

Obliterate Boost #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ project("Libmultiprocess" CXX)
include(CMakePushCheckState)
include(CTest)
include(CheckCXXSourceCompiles)
find_package(Boost)
find_package(CapnProto REQUIRED)
find_package(Threads REQUIRED)

Expand Down Expand Up @@ -64,11 +63,10 @@ target_include_directories(multiprocess PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include>
${CAPNP_INCLUDE_DIRECTORY}
${Boost_INCLUDE_DIR})
${CAPNP_INCLUDE_DIRECTORY})
set_target_properties(multiprocess PROPERTIES
PUBLIC_HEADER "${MP_PUBLIC_HEADERS}"
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES)
install(TARGETS multiprocess EXPORT Multiprocess ARCHIVE DESTINATION lib PUBLIC_HEADER DESTINATION include/mp)

Expand All @@ -83,7 +81,7 @@ target_link_libraries(mpgen PRIVATE Threads::Threads)
target_link_libraries(mpgen PRIVATE multiprocess)
set_target_properties(mpgen PROPERTIES
INSTALL_RPATH_USE_LINK_PATH TRUE
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES)
install(TARGETS mpgen EXPORT Multiprocess RUNTIME DESTINATION bin)

Expand Down Expand Up @@ -135,7 +133,7 @@ if(BUILD_TESTING AND TARGET CapnProto::kj-test)
target_link_libraries(mptest PRIVATE Threads::Threads)
target_link_libraries(mptest PRIVATE multiprocess)
set_target_properties(mptest PROPERTIES
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES)
add_test(NAME mptest COMMAND mptest)
endif()
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ _libmultiprocess_ is currently compatible with sandboxing but could add platform

## Installation

Installation currently requires boost[*] and Cap'n Proto:
Installation currently requires Cap'n Proto:

```sh
apt install libboost-dev libcapnp-dev capnproto
brew install boost capnp
dnf install boost-devel capnproto
apt install libcapnp-dev capnproto
brew install capnp
dnf install capnproto

Installation steps are:

Expand All @@ -46,5 +46,3 @@ make
make all test
make install
```

[*] The boost dependency should be eliminated; it is solely for `boost::optional`.
4 changes: 2 additions & 2 deletions include/mp/proxy-io.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

#include <mp/proxy.capnp.h>

#include <boost/exception/diagnostic_information.hpp>
#include <boost/optional/optional.hpp>
#include <capnp/rpc-twoparty.h>

#include <assert.h>
#include <functional>
#include <map>
#include <memory>
#include <sstream>
#include <string>

namespace mp {
Expand Down
17 changes: 11 additions & 6 deletions include/mp/proxy-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#define MP_PROXY_TYPES_H

#include <mp/proxy-io.h>

#include <exception>
#include <optional>
#include <set>
#include <vector>

Expand Down Expand Up @@ -178,7 +181,7 @@ class Emplace
Value& m_value;

template <typename T, typename... Params>
static T& call(boost::optional<T>& value, Params&&... params)
static T& call(std::optional<T>& value, Params&&... params)
{
value.emplace(std::forward<Params>(params)...);
return *value;
Expand Down Expand Up @@ -227,7 +230,7 @@ class Emplace
};

template <typename LocalType, typename Input, typename DestValue>
void ReadFieldUpdate(TypeList<boost::optional<LocalType>>,
void ReadFieldUpdate(TypeList<std::optional<LocalType>>,
InvokeContext& invoke_context,
Input&& input,
DestValue&& value)
Expand Down Expand Up @@ -832,7 +835,7 @@ LocalType BuildPrimitive(InvokeContext& invoke_context,
}

template <typename LocalType, typename Value, typename Output>
void CustomBuildField(TypeList<boost::optional<LocalType>>,
void CustomBuildField(TypeList<std::optional<LocalType>>,
Priority<1>,
InvokeContext& invoke_context,
Value&& value,
Expand Down Expand Up @@ -1038,7 +1041,7 @@ template <typename Accessor, typename LocalType, typename ServerContext, typenam
void DefaultPassField(TypeList<LocalType>, ServerContext& server_context, Fn&& fn, Args&&... args)
{
InvokeContext& invoke_context = server_context;
boost::optional<Decay<LocalType>> param;
std::optional<Decay<LocalType>> param;
const auto& params = server_context.call_context.getParams();
MaybeReadField(std::integral_constant<bool, Accessor::in>(), TypeList<LocalType>(), invoke_context,
Make<StructField, Accessor>(params), Emplace<decltype(param)>(param));
Expand Down Expand Up @@ -1434,9 +1437,11 @@ kj::Promise<void> serverInvoke(Server& server, CallContext& call_context, Fn fn)
server.m_connection.m_loop.log() << "IPC server send response #" << req << " " << TypeName<Results>()
<< " " << LogEscape(call_context.getResults().toString());
});
} catch (const std::exception& e) {
server.m_connection.m_loop.log() << "IPC server unhandled exception: " << e.what();
throw;
} catch (...) {
server.m_connection.m_loop.log()
<< "IPC server unhandled exception " << boost::current_exception_diagnostic_information();
server.m_connection.m_loop.log() << "IPC server unhandled exception";
throw;
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkgconfig/libmultiprocess.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Description: Multiprocess IPC library
Version: 0.0

Libs: -L${libdir} -lmultiprocess -L${capnp_prefix}/lib -lcapnp-rpc -lcapnp -lkj-async -lkj -pthread -lpthread
Cflags: -std=c++14 -I${includedir} -I${capnp_prefix}/include -pthread
Cflags: -std=c++17 -I${includedir} -I${capnp_prefix}/include -pthread