Skip to content

Commit 83c0c04

Browse files
authored
GG IPC & Echo Client (#287)
* Added Greengrass IPC client * Added EventStream RPC capability
1 parent 163fdf3 commit 83c0c04

26 files changed

+17508
-2
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ add_subdirectory(jobs)
6262
add_subdirectory(shadow)
6363
add_subdirectory(discovery)
6464
add_subdirectory(identity)
65+
add_subdirectory(eventstream_rpc)
66+
add_subdirectory(greengrass_ipc)
6567
if (NOT BYO_CRYPTO)
6668
# TODO: get these working with BYO_CRYPTO
6769
add_subdirectory(iotdevicecommon)

eventstream_rpc/CMakeLists.txt

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
cmake_minimum_required(VERSION 3.1)
2+
project(EventstreamRpc-cpp CXX)
3+
4+
set(RUNTIME_DIRECTORY bin)
5+
6+
if (UNIX AND NOT APPLE)
7+
include(GNUInstallDirs)
8+
elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
9+
set(CMAKE_INSTALL_LIBDIR "lib")
10+
11+
if (${CMAKE_INSTALL_LIBDIR} STREQUAL "lib64")
12+
set(FIND_LIBRARY_USE_LIB64_PATHS true)
13+
endif()
14+
endif()
15+
16+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake")
17+
18+
if (NOT CMAKE_CXX_STANDARD)
19+
set(CMAKE_CXX_STANDARD 11)
20+
endif()
21+
22+
file(GLOB AWS_EVENTSTREAMRPC_HEADERS
23+
"include/aws/eventstreamrpc/*.h"
24+
)
25+
26+
file(GLOB AWS_EVENTSTREAMRPC_SRC
27+
"source/*.cpp"
28+
)
29+
30+
file(GLOB AWS_EVENTSTREAMRPC_CPP_SRC
31+
${AWS_EVENTSTREAMRPC_SRC}
32+
)
33+
34+
if (WIN32)
35+
if (MSVC)
36+
source_group("Header Files\\aws\\eventstreamrpc\\" FILES ${AWS_EVENTSTREAMRPC_HEADERS})
37+
38+
source_group("Source Files" FILES ${AWS_EVENTSTREAMRPC_SRC})
39+
endif ()
40+
endif()
41+
42+
add_library(EventstreamRpc-cpp ${AWS_EVENTSTREAMRPC_CPP_SRC})
43+
44+
set_target_properties(EventstreamRpc-cpp PROPERTIES LINKER_LANGUAGE CXX)
45+
46+
set(CMAKE_C_FLAGS_DEBUGOPT "")
47+
48+
#set warnings
49+
if (MSVC)
50+
target_compile_options(EventstreamRpc-cpp PRIVATE /W4 /WX)
51+
else ()
52+
target_compile_options(EventstreamRpc-cpp PRIVATE -Wall -Wno-long-long -pedantic -Werror)
53+
endif ()
54+
55+
if (CMAKE_BUILD_TYPE STREQUAL "" OR CMAKE_BUILD_TYPE MATCHES Debug)
56+
target_compile_definitions(EventstreamRpc-cpp PRIVATE "-DDEBUG_BUILD")
57+
endif ()
58+
59+
if (BUILD_SHARED_LIBS)
60+
target_compile_definitions(EventstreamRpc-cpp PUBLIC "-DAWS_EVENTSTREAMRPC_USE_IMPORT_EXPORT")
61+
target_compile_definitions(EventstreamRpc-cpp PRIVATE "-DAWS_EVENTSTREAMRPC_EXPORTS")
62+
63+
install(TARGETS EventstreamRpc-cpp
64+
EXPORT EventstreamRpc-cpp-targets
65+
ARCHIVE
66+
DESTINATION ${CMAKE_INSTALL_LIBDIR}
67+
COMPONENT Development
68+
LIBRARY
69+
DESTINATION ${CMAKE_INSTALL_LIBDIR}
70+
NAMELINK_SKIP
71+
COMPONENT Runtime
72+
RUNTIME
73+
DESTINATION ${RUNTIME_DIRECTORY}
74+
COMPONENT Runtime)
75+
76+
install(TARGETS EventstreamRpc-cpp
77+
EXPORT EventstreamRpc-cpp-targets
78+
LIBRARY
79+
DESTINATION ${CMAKE_INSTALL_LIBDIR}
80+
NAMELINK_ONLY
81+
COMPONENT Development)
82+
else()
83+
install(TARGETS EventstreamRpc-cpp
84+
EXPORT EventstreamRpc-cpp-targets
85+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
86+
COMPONENT Development)
87+
endif()
88+
89+
target_include_directories(EventstreamRpc-cpp PUBLIC
90+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
91+
$<INSTALL_INTERFACE:include>)
92+
93+
if (NOT IS_SUBDIRECTORY_INCLUDE)
94+
aws_use_package(aws-crt-cpp)
95+
endif()
96+
97+
98+
target_link_libraries(EventstreamRpc-cpp ${DEP_AWS_LIBS})
99+
100+
install(FILES ${AWS_EVENTSTREAMRPC_HEADERS} DESTINATION "include/aws/eventstreamrpc/" COMPONENT Development)
101+
102+
if (BUILD_SHARED_LIBS)
103+
set(TARGET_DIR "shared")
104+
else()
105+
set(TARGET_DIR "static")
106+
endif()
107+
108+
install(EXPORT "EventstreamRpc-cpp-targets"
109+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/EventstreamRpc-cpp/cmake/${TARGET_DIR}"
110+
NAMESPACE AWS::
111+
COMPONENT Development)
112+
113+
configure_file("cmake/eventstreamrpc-cpp-config.cmake"
114+
"${CMAKE_CURRENT_BINARY_DIR}/eventstreamrpc-cpp-config.cmake"
115+
@ONLY)
116+
117+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/eventstreamrpc-cpp-config.cmake"
118+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/EventstreamRpc-cpp/cmake/"
119+
COMPONENT Development)
120+
121+
if (BUILD_TESTING)
122+
add_subdirectory(tests)
123+
endif()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
include(CMakeFindDependencyMacro)
2+
3+
find_dependency(aws-crt-cpp)
4+
5+
if (BUILD_SHARED_LIBS)
6+
include(${CMAKE_CURRENT_LIST_DIR}/shared/@PROJECT_NAME@-targets.cmake)
7+
else()
8+
include(${CMAKE_CURRENT_LIST_DIR}/static/@PROJECT_NAME@-targets.cmake)
9+
endif()

0 commit comments

Comments
 (0)