diff options
author | Aki <please@ignore.pl> | 2021-10-14 22:51:43 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2021-10-14 22:51:43 +0200 |
commit | 0dd0ba272f247ca6e9b7948b648e42ff544c71ac (patch) | |
tree | 81d291a87456a6909d311f4b31ce6f56c5490dac /library | |
download | hwd-0dd0ba272f247ca6e9b7948b648e42ff544c71ac.zip hwd-0dd0ba272f247ca6e9b7948b648e42ff544c71ac.tar.gz hwd-0dd0ba272f247ca6e9b7948b648e42ff544c71ac.tar.bz2 |
Created stub daemon with a communication library
Diffstat (limited to 'library')
-rw-r--r-- | library/CMakeLists.txt | 29 | ||||
-rw-r--r-- | library/include/hwd.h | 4 | ||||
-rw-r--r-- | library/src/library.cpp | 19 |
3 files changed, 52 insertions, 0 deletions
diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt new file mode 100644 index 0000000..a1e146b --- /dev/null +++ b/library/CMakeLists.txt @@ -0,0 +1,29 @@ +project(library CXX) +add_library(${PROJECT_NAME} SHARED + src/library.cpp + ) +target_link_libraries(${PROJECT_NAME} + PUBLIC rpclib::rpc + PUBLIC Threads::Threads + PRIVATE common + ) +target_include_directories(${PROJECT_NAME} + PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" + PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" + ) +set_target_properties(${PROJECT_NAME} + PROPERTIES OUTPUT_NAME hwd + ) +install(TARGETS ${PROJECT_NAME} + EXPORT HwdTargets + RUNTIME + INCLUDES + ) +install(FILES include/hwd.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) +install(EXPORT HwdTargets + FILE HwdTargets.cmake + NAMESPACE Hwd:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Hwd + ) diff --git a/library/include/hwd.h b/library/include/hwd.h new file mode 100644 index 0000000..0deba70 --- /dev/null +++ b/library/include/hwd.h @@ -0,0 +1,4 @@ +namespace hwd +{ +void stop_server(); +} diff --git a/library/src/library.cpp b/library/src/library.cpp new file mode 100644 index 0000000..4691849 --- /dev/null +++ b/library/src/library.cpp @@ -0,0 +1,19 @@ +#include <rpc/client.h> + +#include <hwd/internal.h> + +namespace hwd +{ + +static rpc::client & get_client() +{ + static rpc::client c("127.0.0.1", hwd::internal::default_port); + return c; +} + +void stop_server() +{ + get_client().call("stop_server"); +} + +} // namespace hwd |