You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2023/05/24 02:33:03 UTC

[iotdb] branch refactorPackage updated: add CMakeLists forcely

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

xiangweiwei pushed a commit to branch refactorPackage
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/refactorPackage by this push:
     new 60ee447ad04 add CMakeLists forcely
60ee447ad04 is described below

commit 60ee447ad040bcfe8b8dd9fa802062e8afdbdeed
Author: Alima777 <wx...@gmail.com>
AuthorDate: Wed May 24 10:32:43 2023 +0800

    add CMakeLists forcely
---
 client/client-cpp/src/main/CMakeLists.txt | 54 ++++++++++++++++++++++++++
 client/client-cpp/src/test/CMakeLists.txt | 63 +++++++++++++++++++++++++++++++
 client/client-py/pom.xml                  |  2 +-
 3 files changed, 118 insertions(+), 1 deletion(-)

diff --git a/client/client-cpp/src/main/CMakeLists.txt b/client/client-cpp/src/main/CMakeLists.txt
new file mode 100644
index 00000000000..5a044a6383f
--- /dev/null
+++ b/client/client-cpp/src/main/CMakeLists.txt
@@ -0,0 +1,54 @@
+# 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.7)
+PROJECT(iotdb_session CXX)
+SET(CMAKE_CXX_STANDARD 11)
+SET(CMAKE_CXX_STANDARD_REQUIRED ON)
+SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -g -O2 ")
+SET(TOOLS_DIR "${CMAKE_SOURCE_DIR}/../../../../compile-tools")
+
+# Add Thrift include directory
+INCLUDE_DIRECTORIES(${TOOLS_DIR}/thrift/target/thrift-0.14.1/lib/cpp/src)
+
+FIND_PACKAGE(Boost REQUIRED)
+IF (DEFINED BOOST_INCLUDEDIR)
+    INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
+ENDIF()
+
+IF(MSVC)
+    SET(THRIFT_STATIC_LIB "${TOOLS_DIR}/thrift/target/build/lib/Release/thriftmd.lib")
+ELSE()
+    SET(THRIFT_STATIC_LIB "${TOOLS_DIR}/thrift/target/build/lib/libthrift.a")
+ENDIF()
+
+# Add Boost include path for MacOS
+INCLUDE_DIRECTORIES(/usr/local/include)
+
+# Add ./generated-sources-cpp as a Cmake subdirectory
+AUX_SOURCE_DIRECTORY(./generated-sources-cpp SESSION_SRCS)
+
+IF(MSVC)
+    ADD_LIBRARY(iotdb_session ${SESSION_SRCS})
+ELSE()
+    ADD_LIBRARY(iotdb_session SHARED ${SESSION_SRCS})
+ENDIF()
+
+# Link with Thrift static library
+TARGET_LINK_LIBRARIES(iotdb_session ${THRIFT_STATIC_LIB})
diff --git a/client/client-cpp/src/test/CMakeLists.txt b/client/client-cpp/src/test/CMakeLists.txt
new file mode 100644
index 00000000000..7d6d18bcd5f
--- /dev/null
+++ b/client/client-cpp/src/test/CMakeLists.txt
@@ -0,0 +1,63 @@
+# 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.7)
+INCLUDE( CTest )
+SET(CMAKE_CXX_STANDARD 11)
+SET(CMAKE_CXX_STANDARD_REQUIRED ON)
+SET(TARGET_NAME session_tests)
+SET(TOOLS_DIR "${CMAKE_SOURCE_DIR}/../../../../compile-tools")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -g -O2")
+ENABLE_TESTING()
+
+# Add Boost include path for MacOS
+INCLUDE_DIRECTORIES(/usr/local/include)
+# Add Session related include files
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../main/generated-sources-cpp)
+# Add Thrift include directory
+INCLUDE_DIRECTORIES(${TOOLS_DIR}/thrift/target/thrift-0.14.1/lib/cpp/src)
+
+find_package(Boost REQUIRED)
+IF (DEFINED BOOST_INCLUDEDIR)
+    include_directories("${Boost_INCLUDE_DIR}")
+ENDIF()
+
+# Link directories are different for Windows and Linux/Mac
+IF(MSVC)
+    LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/../main/Release)
+    SET(THRIFT_STATIC_LIB "${TOOLS_DIR}/thrift/target/build/lib/Release/thriftmd.lib")
+ELSE()
+    LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/../main)
+ENDIF()
+
+ADD_EXECUTABLE(${TARGET_NAME} main.cpp cpp/sessionIT.cpp)
+
+# Link with shared library iotdb_session and pthread
+IF(MSVC)
+    TARGET_LINK_LIBRARIES(${TARGET_NAME} iotdb_session ${THRIFT_STATIC_LIB})
+ELSE()
+    TARGET_LINK_LIBRARIES(${TARGET_NAME} iotdb_session pthread)
+ENDIF()
+TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME} PUBLIC ./catch2/)
+
+# Add 'sessionIT' to the project to be run by ctest
+IF(MSVC)
+    ADD_TEST(NAME sessionIT CONFIGURATIONS Release COMMAND ${TARGET_NAME})
+ELSE()
+    ADD_TEST(NAME sessionIT COMMAND ${TARGET_NAME})
+ENDIF()
diff --git a/client/client-py/pom.xml b/client/client-py/pom.xml
index 09ef12d8449..ede2919e02f 100644
--- a/client/client-py/pom.xml
+++ b/client/client-py/pom.xml
@@ -87,7 +87,7 @@
                         </goals>
                         <configuration>
                             <encoding>utf-8</encoding>
-                            <outputDirectory>${basedir}/iotdb/thrift</outputDirectory>
+                            <outputDirectory>${basedir}/iotdb/thrift/</outputDirectory>
                             <resources>
                                 <resource>
                                     <directory>${basedir}/../../thrift/target/generated-sources-python/iotdb/thrift/</directory>