You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/05/19 09:10:09 UTC

[GitHub] [incubator-iotdb] wshao08 commented on a change in pull request #1218: [IoTDB-682]Add client-cpp and update docs/UserGuide/3-Server/1-Download.md

wshao08 commented on a change in pull request #1218:
URL: https://github.com/apache/incubator-iotdb/pull/1218#discussion_r427093612



##########
File path: client-cpp/compile.sh
##########
@@ -0,0 +1,36 @@
+# 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.
+#
+
+export THRIFT_EXE=thrift
+export CMAKE_EXE=cmake
+export MAKE_EXE=make
+export SH_DIR=$(dirname $0)/
+export THRIFT_SCRIPT=${SH_DIR}rpc.thrift
+export THRIFT_OUT=${SH_DIR}gen-cpp
+export USELESS_FILE=${SH_DIR}/gen-cpp/TSIService_server.skeleton.cpp
+export SUB_CMAKELISTS=${SH_DIR}/gen-cpp/CMakeLists.txt
+export BUILD_FOLDER=${SH_DIR}/build
+
+rm -rf ${THRIFT_OUT}
+${THRIFT_EXE} -gen cpp ${THRIFT_SCRIPT}
+rm -rf ${USELESS_FILE}
+touch ${SUB_CMAKELISTS}
+cd ${BUILD_FOLDER}

Review comment:
       Add directory check before accessing ${BUILD_FOLDER}
   
   if [ ! -d ${BUILD_FOLDER} ]; then
       mkdir ${BUILD_FOLDER}
   fi

##########
File path: client-cpp/README.md
##########
@@ -0,0 +1,40 @@
+# client-cpp
+Client in language C++ for Apache IoTDB using CMake on Linux
+
+# 0. Apache IoTDB:
+* [Apache IoTDB website](http://iotdb.apache.org/)
+
+* [Apache IoTDB github](https://github.com/apache/incubator-iotdb)
+
+# 1. Description of client-cpp structure
+* `SessionExample.cpp` : the main function of the project, containing examples of the client methods to use IoTDB 
+* `compile.sh` : The script to compile the client automatically.
+* `Session` (folder) : Class Session which wrap the rpc interfaces generated by thrift
+* `CMakeLists.txt` (the one under project root directory) : the CMakeLists for the whole project
+* `build` (folder) : The files generated by cmake while compiling and after compiled. Before compiling, this folder is empty.
+* `libthrift.a, libthriftnb.a` : thrift cpp static library
+
+# 2. How to run
+Under the project root directory, run commands:
+```
+./chmod u+x compile.sh
+
+./compile.sh
+
+./client-cpp
+```
+
+# 3. Prerequisites

Review comment:
       I think Boost should be added here as a prerequisite. It is required by thrift.

##########
File path: client-cpp/CMakeLists.txt
##########
@@ -0,0 +1,39 @@
+# 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.
+#
+
+project(client-cpp)
+cmake_minimum_required(VERSION 3.16)
+add_subdirectory(Session)
+add_subdirectory(gen-cpp)

Review comment:
       I tested it on my Mac. It looks I had to specify "-std=c++11" flag to proceed the compilation.
   ```set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall)```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org