You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2022/07/29 09:45:38 UTC

[inlong] branch master updated: [INLONG-5265][SDK] DataProxy SDK(cpp) build config (#5266)

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

dockerzhang 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 3ce0ae3ea [INLONG-5265][SDK] DataProxy SDK(cpp) build config (#5266)
3ce0ae3ea is described below

commit 3ce0ae3ea234f59f8dc3599826f1cfb9f4cafbc5
Author: xueyingzhang <86...@users.noreply.github.com>
AuthorDate: Fri Jul 29 17:45:34 2022 +0800

    [INLONG-5265][SDK] DataProxy SDK(cpp) build config (#5266)
---
 .../dataproxy-sdk-cpp/CMakeLists.txt               | 56 +++++++++++++++
 .../dataproxy-sdk-twins/dataproxy-sdk-cpp/build.sh | 27 +++++++
 .../dataproxy-sdk-cpp/src/base/CMakeLists.txt      | 26 +++++++
 .../dataproxy-sdk-cpp/src/net/CMakeLists.txt       | 25 +++++++
 .../dataproxy-sdk-cpp/third_party/CMakeLists.txt   | 83 ++++++++++++++++++++++
 5 files changed, 217 insertions(+)

diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/CMakeLists.txt b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/CMakeLists.txt
new file mode 100644
index 000000000..2ead458d5
--- /dev/null
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/CMakeLists.txt
@@ -0,0 +1,56 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, 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.
+#
+
+cmake_minimum_required(VERSION 3.1)
+
+project(DataProxySDK)
+
+# compile level -O2
+set(CMAKE_CXX_FLAGS "-std=c++11 -O2 -g -Wall  -Wsign-compare -Wfloat-equal -fno-strict-aliasing -fPIC -DASIO_STANDALONE")
+
+include_directories(${CMAKE_BINARY_DIR}/third_party/include)
+include_directories(${CMAKE_BINARY_DIR}/third_party/rapidjson/src/rapidjson/include)
+include_directories(release/inc)
+include_directories(src/base)
+include_directories(src/net)
+
+link_directories(${CMAKE_BINARY_DIR}/third_party/lib)
+link_directories(${CMAKE_BINARY_DIR}/third_party/lib64)
+
+add_subdirectory(third_party)
+add_subdirectory(src/base)
+add_subdirectory(src/net)
+# add_subdirectory(test)
+add_subdirectory(release)
+
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/release/lib)
+# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/release/so)
+aux_source_directory(src/base BASE_SRCS)
+aux_source_directory(src/net NET_SRCS)
+
+# dynamic library
+# # add_library(dataproxy_sdk SHARED ${BASE_SRCS} ${NET_SRCS})
+# # set_target_properties(dataproxy_sdk PROPERTIES PREFIX "")
+# # target_link_libraries(dataproxy_sdk -llog4cplus -lsnappy -lcurl)
+
+# static library
+add_library(dataproxy_sdk STATIC ${BASE_SRCS} ${NET_SRCS})
+set_target_properties(dataproxy_sdk PROPERTIES OUTPUT_NAME "dataproxy_sdk" PREFIX "")
+target_link_libraries(dataproxy_sdk liblog4cplus.a libsnappy.a libcurl.a)
+
diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/build.sh b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/build.sh
new file mode 100755
index 000000000..2f0ec8705
--- /dev/null
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/build.sh
@@ -0,0 +1,27 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, 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.
+#
+
+#!/bin/bash
+
+rm -r build
+mkdir build
+# mkdir release
+cd build
+cmake ../
+make
diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/base/CMakeLists.txt b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/base/CMakeLists.txt
new file mode 100644
index 000000000..60c482e18
--- /dev/null
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/base/CMakeLists.txt
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, 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.
+#
+
+cmake_minimum_required(VERSION 3.1)
+
+aux_source_directory(. BASE_SRCS)
+add_library(sdk_base STATIC ${BASE_SRCS})
+
+# set link lib
+target_link_libraries(sdk_base liblog4cplus.a libsnappy.a libcurl.a) 
\ No newline at end of file
diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/net/CMakeLists.txt b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/net/CMakeLists.txt
new file mode 100644
index 000000000..c67e8331d
--- /dev/null
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/net/CMakeLists.txt
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, 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.
+#
+
+cmake_minimum_required(VERSION 3.1)
+
+aux_source_directory(. BASE_SRCS)
+add_library(sdk_net STATIC ${BASE_SRCS})
+
+target_link_libraries(sdk_net liblog4cplus.a) 
\ No newline at end of file
diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/third_party/CMakeLists.txt b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/third_party/CMakeLists.txt
new file mode 100644
index 000000000..05c6ad757
--- /dev/null
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/third_party/CMakeLists.txt
@@ -0,0 +1,83 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, 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.
+#
+
+cmake_minimum_required(VERSION 3.1)
+
+project(dataproxysdk_third_party)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error")
+
+include(ExternalProject)
+
+ExternalProject_Add(
+    log4cplus_proj
+    URL https://github.com/log4cplus/log4cplus/releases/download/REL_2_0_5/log4cplus-2.0.5.tar.gz
+    CONFIGURE_COMMAND ./configure --prefix=<INSTALL_DIR> --disable-shared --with-pic CFLAGS=-O2\  CXXFLAGS=-O2\ -fPIC
+    TEST_BEFORE_INSTALL 0
+    BUILD_IN_SOURCE 1
+    INSTALL_DIR ${CMAKE_BINARY_DIR}/third_party/
+    )
+
+ExternalProject_Add(
+    snappy_proj
+    URL https://github.com/google/snappy/archive/1.1.8.tar.gz
+    INSTALL_DIR ${CMAKE_BINARY_DIR}/third_party/
+    CMAKE_ARGS
+    -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
+    -DSNAPPY_BUILD_TESTS=OFF
+    -DHAVE_LIBLZO2=OFF
+    -DCMAKE_CXX_FLAGS=-fPIC
+    TEST_BEFORE_INSTALL 0
+    BUILD_IN_SOURCE 1
+    )
+
+ExternalProject_Add(
+    curl_proj
+    URL https://github.com/curl/curl/releases/download/curl-7_78_0/curl-7.78.0.tar.gz
+    INSTALL_DIR ${CMAKE_BINARY_DIR}/third_party/
+    CONFIGURE_COMMAND ./configure --prefix=<INSTALL_DIR> --without-zlib --without-ssl --disable-shared --disable-ldap && make install
+    TEST_BEFORE_INSTALL 0
+    BUILD_IN_SOURCE 1
+    )
+
+ExternalProject_Add(
+    rapidjson
+    PREFIX "rapidjson"
+    URL "https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz"
+    INSTALL_DIR ${CMAKE_BINARY_DIR}/third_party/
+    CMAKE_ARGS
+    -DRAPIDJSON_BUILD_TESTS=OFF
+    -DRAPIDJSON_BUILD_DOC=OFF
+    -DRAPIDJSON_BUILD_EXAMPLES=OFF
+    CONFIGURE_COMMAND ""
+    BUILD_COMMAND ""
+    INSTALL_COMMAND ""
+    UPDATE_COMMAND ""
+    )
+
+ExternalProject_Add(
+    asio_proj
+    URL https://github.com/chriskohlhoff/asio/archive/asio-1-18-0.tar.gz 
+    INSTALL_DIR ${CMAKE_BINARY_DIR}/third_party/
+    CONFIGURE_COMMAND cd ../asio_proj/asio && ./autogen.sh && ./configure --prefix=<INSTALL_DIR> CFLAGS=-std=c++11 CPPFLAGS=-std=c++11 CXXFLAGS=-std=c++11 && make install
+    TEST_BEFORE_INSTALL 0
+    BUILD_IN_SOURCE 0
+    BUILD_COMMAND "" 
+    INSTALL_COMMAND ""
+    )