This is an automated email from the ASF dual-hosted git repository.

ethanfeng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/celeborn.git


The following commit(s) were added to refs/heads/main by this push:
     new 80ebb1983 [CELEBORN-1761][CIP-14] Add cppProto to cppClient
80ebb1983 is described below

commit 80ebb19836f886451b0115e8b0eaa53dac3d94da
Author: HolyLow <[email protected]>
AuthorDate: Tue Dec 10 17:04:46 2024 +0800

    [CELEBORN-1761][CIP-14] Add cppProto to cppClient
    
    ### What changes were proposed in this pull request?
    Add cppProto (TransportMessages.proto, softlinked as 
TransportMessagesCpp.proto) to cppClient
    
    ### Why are the changes needed?
    To support proto in cppClient and align with java's definition.
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    Compilation.
    
    Closes #2976 from HolyLow/issue/celeborn-1761-add-cpp-proto-to-cppClient.
    
    Authored-by: HolyLow <[email protected]>
    Signed-off-by: mingji <[email protected]>
---
 cpp/CMakeLists.txt                            | 17 +++++++++++++++++
 cpp/README.md                                 |  7 +++++++
 cpp/celeborn/CMakeLists.txt                   |  1 +
 cpp/celeborn/{ => proto}/CMakeLists.txt       |  4 +++-
 cpp/celeborn/proto/TransportMessagesCpp.proto |  1 +
 5 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index e3d869fbb..8552b7ef1 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -141,6 +141,23 @@ include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR})
 include_directories(SYSTEM celeborn)
 include_directories(.)
 
+## TODO: to avoid the file location dependency problem caused by 
protobuf_cpp_generate,
+## we hardcode the protoc procedure here. Maybe we could find a more elegant 
way to fix
+## this later...
+set(ProtoFile 
"${CMAKE_CURRENT_SOURCE_DIR}/celeborn/proto/TransportMessagesCpp.proto")
+set(ProtoGenHeader 
"${CMAKE_BINARY_DIR}/celeborn/proto/TransportMessagesCpp.pb.h")
+set(ProtoGenSource 
"${CMAKE_BINARY_DIR}/celeborn/proto/TransportMessagesCpp.pb.cc")
+add_custom_command(
+        OUTPUT ${ProtoGenSource} ${ProtoGenHeader}
+        COMMAND mkdir -p ${CMAKE_BINARY_DIR}/celeborn/proto
+        COMMAND protoc --proto_path=${CMAKE_CURRENT_SOURCE_DIR}/celeborn/proto 
--cpp_out=${CMAKE_BINARY_DIR}/celeborn/proto ${ProtoFile}
+        DEPENDS ${ProtoFile}
+        VERBATIM)
+add_custom_target(
+        generate_proto_source
+        DEPENDS
+        ${ProtoGenSource} ${ProtoGenHeader})
+
 option(CELEBORN_BUILD_TESTS "CELEBORN_BUILD_TESTS" ON)
 if(CELEBORN_BUILD_TESTS)
     ### TODO: we use prebuilt gtest prebuilt package here. A better way is
diff --git a/cpp/README.md b/cpp/README.md
index 159ce5ab9..89f0acbb0 100644
--- a/cpp/README.md
+++ b/cpp/README.md
@@ -5,6 +5,13 @@ We provide several methods to setup dev environment for 
CelebornCpp.
 Note that currently the scripts only take care of the cpp-related 
dependencies, 
 and java dependencies are not included.
 
+### Clone the project
+We should clone the project as:
+```
+# the option `--config core.symlinks=true` is to make sure that the softlink 
works
+git clone [email protected]:apache/celeborn.git --config core.symlinks=true
+```
+
 ### Use container with prebuilt image
 We provide a pre-built image ready to be pulled and used so you could launch a 
container directly:
 ```
diff --git a/cpp/celeborn/CMakeLists.txt b/cpp/celeborn/CMakeLists.txt
index 97591cb0c..70e335101 100644
--- a/cpp/celeborn/CMakeLists.txt
+++ b/cpp/celeborn/CMakeLists.txt
@@ -13,3 +13,4 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 add_subdirectory(utils)
+add_subdirectory(proto)
diff --git a/cpp/celeborn/CMakeLists.txt b/cpp/celeborn/proto/CMakeLists.txt
similarity index 81%
copy from cpp/celeborn/CMakeLists.txt
copy to cpp/celeborn/proto/CMakeLists.txt
index 97591cb0c..f83dafba8 100644
--- a/cpp/celeborn/CMakeLists.txt
+++ b/cpp/celeborn/proto/CMakeLists.txt
@@ -12,4 +12,6 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-add_subdirectory(utils)
+add_library(proto STATIC ${ProtoGenSource} ${ProtoGenHeader})
+add_dependencies(proto generate_proto_source)
+target_link_libraries(proto ${Boost_LIBRARIES} ${PROTOBUF_LIBRARY})
diff --git a/cpp/celeborn/proto/TransportMessagesCpp.proto 
b/cpp/celeborn/proto/TransportMessagesCpp.proto
new file mode 120000
index 000000000..a37382d99
--- /dev/null
+++ b/cpp/celeborn/proto/TransportMessagesCpp.proto
@@ -0,0 +1 @@
+../../../common/src/main/proto/TransportMessages.proto
\ No newline at end of file

Reply via email to