This is an automated email from the ASF dual-hosted git repository. doleyzi pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push: new 12c2c5db95 [INLONG-10774][SDK] Optimize Cmake compilation script for CPP DataProxy SDK (#10777) 12c2c5db95 is described below commit 12c2c5db95d9097a6acf6fccc05c2151d5716b78 Author: doleyzi <43397300+dole...@users.noreply.github.com> AuthorDate: Tue Aug 13 11:03:59 2024 +0800 [INLONG-10774][SDK] Optimize Cmake compilation script for CPP DataProxy SDK (#10777) --- .../dataproxy-sdk-cpp/CMakeLists.txt | 3 +-- .../dataproxy-sdk-twins/dataproxy-sdk-cpp/README.md | 21 ++++++++++++--------- .../dataproxy-sdk-twins/dataproxy-sdk-cpp/build.sh | 11 +---------- .../{build.sh => build_third_party.sh} | 16 +++------------- 4 files changed, 17 insertions(+), 34 deletions(-) diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/CMakeLists.txt b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/CMakeLists.txt index 236843494e..ccbab35336 100644 --- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/CMakeLists.txt +++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/CMakeLists.txt @@ -37,7 +37,6 @@ include_directories(src/client) link_directories(${PROJECT_SOURCE_DIR}/third_party/lib) link_directories(${PROJECT_SOURCE_DIR}/third_party/lib64) -add_subdirectory(third_party) add_subdirectory(src/utils) add_subdirectory(src/config) add_subdirectory(src/core) @@ -62,5 +61,5 @@ add_library(dataproxy_sdk STATIC ${UTILS} ${CONFIGS} ${CORE} ${MANAGER} ${GROUP} set_target_properties(dataproxy_sdk PROPERTIES OUTPUT_NAME "dataproxy_sdk" PREFIX "") -target_link_libraries(dataproxy_sdk liblog4cplusS.a libsnappy.a libcurl.a) +target_link_libraries(dataproxy_sdk liblog4cplusS.a libsnappy.a libcurl.a libssl.a libcrypto.a) diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/README.md b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/README.md index c136444328..fb50cbadf9 100644 --- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/README.md +++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/README.md @@ -30,12 +30,15 @@ dataproxy-sdk cpp version, used for sending data to dataproxy * curl * rapidjson * asio +* log4cplus ## Build Go to the dataproxy-sdk-cpp root, and run ``` +./build_third_party.sh + ./build.sh ``` @@ -74,24 +77,24 @@ Refer to `release/conf/config_example.json`. 1. First, init dataproxy-sdk, there are two ways you can choose: -- A) `int32_t tc_api_init(const char* config_file)`. Here, `config_file` is the path of your config file, and absolute +- A) `int32_t InitApi(const char* config_file)`. Here, `config_file` is the path of your config file, and absolute path is recommended. Note that only once called is needed in one process. -- B) `int32_t tc_api_init(ClientConfig& client_config)`. Here, `client_config` is the pointer of a `ClientConfig` - object. 2. Then, send - data: `int32_t tc_api_send(const char* inlong_group_id, const char* inlong_stream_id, const char* msg, int32_t msg_len, UserCallBack call_back = NULL)`. + data: `int32_t Send(const char* inlong_group_id, const char* inlong_stream_id, const char* msg, int32_t msg_len, UserCallBack call_back = NULL)`. If you set `call_back`, it will be callbacked if your data failed to send. See the signature of `UserCallBack` - in `release/inc/user_msg.h`. + in `src/core/sdk_msg.h`. -3. Finally, close sdk if no more data to be sent: `int32_t tc_api_close(int32_t max_waitms)`. Here, `max_waitms` is the +3. Finally, close sdk if no more data to be sent: `int32_t CloseApi(int32_t max_waitms)`. Here, `max_waitms` is the interval of waiting data in memory to be sent. -4. Note, the above functions return 0 if success, otherwise it means failure. As for other return results, please refer - to `SDKInvalidResult` in `release/inc/tc_api.h`. +4. Note, the above functions return 0 if success, otherwise it m + +5. eans failure. As for other return results, please refer + to `SDKInvalidResult` in `src/core/inlong_api.h`. ## Demo 1. Refer to `release/demo/send_demo.cc`. -2. Static lib is in `release/lib`. Header file is in `release/inc`. +2. Static lib is in `release/lib`. Header file is in `release/lib`. diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/build.sh b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/build.sh index b0d0e9e571..aa914e9c1e 100755 --- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/build.sh +++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/build.sh @@ -19,17 +19,8 @@ #!/bin/bash - -# Install third-party components -cd ./third_party -cmake . -make - -cd ../ rm -r build mkdir build - -# Compile project code cd build cmake ../ -make +make -j4 diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/build.sh b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/build_third_party.sh similarity index 85% copy from inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/build.sh copy to inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/build_third_party.sh index b0d0e9e571..5b0cf742b3 100755 --- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/build.sh +++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/build_third_party.sh @@ -19,17 +19,7 @@ #!/bin/bash - -# Install third-party components -cd ./third_party +cd third_party cmake . -make - -cd ../ -rm -r build -mkdir build - -# Compile project code -cd build -cmake ../ -make +make clean +make -j1 \ No newline at end of file