Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3368581
D5045.id16513.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D5045.id16513.diff
View Options
diff --git a/native/cpp/CommonCpp/grpc/CMakeLists.txt b/native/cpp/CommonCpp/grpc/CMakeLists.txt
--- a/native/cpp/CommonCpp/grpc/CMakeLists.txt
+++ b/native/cpp/CommonCpp/grpc/CMakeLists.txt
@@ -6,81 +6,10 @@
find_package(gRPC REQUIRED)
set(CMAKE_CXX_STANDARD 14)
-# Allow for tools on PATH to be found
-find_program(_PROTOBUF_PROTOC protoc
- HINTS "${_PROTOBUF_PROTOC}")
-find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin
- HINTS "${_GRPC_CPP_PLUGIN_EXECUTABLE}")
-set(_proto_dir "${CMAKE_CURRENT_SOURCE_DIR}/protos")
-set(_components backup blob tunnelbroker)
-set(TARGETS)
-
-# Iterate through each protobuf file
-# and create headers, sources, and export as component library
-foreach(component ${_components})
- set(LIB_NAME comm-${component}-grpc)
- set(TARGETS ${TARGETS} ${LIB_NAME})
-
- set(BIN_PROTO_HDRS
- ${component}.pb.h
- ${component}.grpc.pb.h
- )
-
- set(BIN_PROTO_SRCS
- ${component}.pb.cc
- ${component}.grpc.pb.cc
- )
-
- set(_proto_file "${_proto_dir}/${component}.proto")
- # Generate headers from protobuf files, and copy them to _generated dir
- add_custom_command(
- OUTPUT ${BIN_PROTO_HDRS} ${BIN_PROTO_SRCS}
- COMMAND ${_PROTOBUF_PROTOC} --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
- --cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
- -I "${_proto_dir}"
- --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
- "${_proto_file}"
- COMMAND sed 's|^// Genera|// @genera|g' ${component}.grpc.pb.h
- > ${CMAKE_CURRENT_SOURCE_DIR}/_generated/${component}.grpc.pb.h
- COMMAND sed 's|^// Genera|// @genera|g' ${component}.grpc.pb.cc
- > ${CMAKE_CURRENT_SOURCE_DIR}/_generated/${component}.grpc.pb.cc
- COMMAND sed 's|^// Genera|// @genera|g' ${component}.pb.h
- > ${CMAKE_CURRENT_SOURCE_DIR}/_generated/${component}.pb.h
- COMMAND sed 's|^// Genera|// @genera|g' ${component}.pb.cc
- > ${CMAKE_CURRENT_SOURCE_DIR}/_generated/${component}.pb.cc
- DEPENDS "${_proto_file}"
- MAIN_DEPENDENCY "${_proto_file}"
- COMMENT "Generate protobuf files for ${component}"
- )
-
- add_library(${LIB_NAME}
- ${BIN_PROTO_HDRS} ${BIN_PROTO_SRCS}
- )
-
- target_link_libraries(${LIB_NAME}
- gRPC::grpc++
- protobuf::libprotobuf
- )
-
- # reference local directory when building
- # use installation path when installing
- target_include_directories(${LIB_NAME}
- PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../Tools>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
- )
-
- install(TARGETS ${LIB_NAME} EXPORT comm-export
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${LIB_NAME}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${LIB_NAME}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${LIB_NAME}
- )
-
- # ensure headers are also installed
- install(FILES ${PROTO_HDRS} DESTINATION include/comm/grpc)
-endforeach()
+add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../../../../shared/protos"
+ "${CMAKE_CURRENT_BINARY_DIR}/protos"
+)
set(CLIENT_HDRS
"Client.h"
@@ -108,6 +37,7 @@
target_include_directories(comm-client
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../Tools>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
# HACK: add complete cmake support to react-native?
@@ -125,9 +55,9 @@
install(FILES ${CLIENT_HDRS} DESTINATION include/grpc)
# For development purposes, able to reference build directory
-export(TARGETS ${TARGETS} comm-client
- NAMESPACE comm-grpc::
- FILE ${CMAKE_CURRENT_BINARY_DIR}/cmake/comm-grpc/comm-grpc-targets.cmake
+export(TARGETS comm-client
+ NAMESPACE comm::
+ FILE ${CMAKE_CURRENT_BINARY_DIR}/cmake/comm/comm-grpc-client-targets.cmake
)
# For installation
diff --git a/native/cpp/CommonCpp/grpc/Client.h b/native/cpp/CommonCpp/grpc/Client.h
--- a/native/cpp/CommonCpp/grpc/Client.h
+++ b/native/cpp/CommonCpp/grpc/Client.h
@@ -6,8 +6,8 @@
#include <grpcpp/grpcpp.h>
#include "ClientGetReadReactor.h"
-#include "_generated/tunnelbroker.grpc.pb.h"
-#include "_generated/tunnelbroker.pb.h"
+#include "tunnelbroker.grpc.pb.h"
+#include "tunnelbroker.pb.h"
namespace comm {
namespace network {
diff --git a/native/cpp/CommonCpp/grpc/ClientGetReadReactor.h b/native/cpp/CommonCpp/grpc/ClientGetReadReactor.h
--- a/native/cpp/CommonCpp/grpc/ClientGetReadReactor.h
+++ b/native/cpp/CommonCpp/grpc/ClientGetReadReactor.h
@@ -3,8 +3,8 @@
#include "../NativeModules/InternalModules/SocketStatus.h"
#include <grpcpp/grpcpp.h>
-#include "_generated/tunnelbroker.grpc.pb.h"
-#include "_generated/tunnelbroker.pb.h"
+#include "tunnelbroker.grpc.pb.h"
+#include "tunnelbroker.pb.h"
class ClientGetReadReactor
: public grpc::ClientReadReactor<tunnelbroker::GetResponse> {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 26, 8:18 PM (20 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2585915
Default Alt Text
D5045.id16513.diff (4 KB)
Attached To
Mode
D5045: [Native] Prune protobuf logic from CMakeLists.txt
Attached
Detach File
Event Timeline
Log In to Comment