You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2018/05/03 11:39:55 UTC

[arrow] branch master updated: ARROW-2522: [C++] Version shared library files

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

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 8797390  ARROW-2522: [C++] Version shared library files
8797390 is described below

commit 879739097f5d5d0aae3273eb7b36db243de03df3
Author: Antoine Pitrou <an...@python.org>
AuthorDate: Thu May 3 20:39:25 2018 +0900

    ARROW-2522: [C++] Version shared library files
    
    Author: Antoine Pitrou <an...@python.org>
    
    Closes #1975 from pitrou/ARROW-2522-version-so-files and squashes the following commits:
    
    b57311c0 [Antoine Pitrou] Use cmake's project versioning logic
    d6073132 [Antoine Pitrou] Version libplasma.so the same way libarrow.so is
    d6d02f5a [Antoine Pitrou] Generate SO version from full Arrow version
    e079f57d [Antoine Pitrou] ARROW-2522: [C++] Version shared library files
---
 cpp/CMakeLists.txt                 | 32 ++++++++++++++++++++++++++++----
 cpp/cmake_modules/BuildUtils.cmake |  2 +-
 cpp/cmake_modules/FindArrow.cmake  |  7 ++++---
 cpp/cmake_modules/FindPlasma.cmake |  7 ++++---
 cpp/src/arrow/arrow.pc.in          |  3 ++-
 cpp/src/plasma/CMakeLists.txt      | 10 ++++++----
 cpp/src/plasma/plasma.pc.in        |  3 ++-
 7 files changed, 47 insertions(+), 17 deletions(-)

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 52a843a..0051c73 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -16,13 +16,40 @@
 # under the License.
 
 cmake_minimum_required(VERSION 3.2)
-project(arrow)
 
+# Extract Arrow version number
 file(READ "${CMAKE_CURRENT_SOURCE_DIR}/../java/pom.xml" POM_XML)
 string(REGEX MATCHALL
   "\n  <version>[^<]+</version>" ARROW_VERSION_TAG "${POM_XML}")
 string(REGEX REPLACE
   "(\n  <version>|</version>)" "" ARROW_VERSION "${ARROW_VERSION_TAG}")
+string(REGEX MATCH
+  "^[0-9]+\\.[0-9]+\\.[0-9]+" ARROW_BASE_VERSION "${ARROW_VERSION}")
+
+project(arrow VERSION "${ARROW_BASE_VERSION}")
+
+set(ARROW_VERSION_MAJOR "${arrow_VERSION_MAJOR}")
+set(ARROW_VERSION_MINOR "${arrow_VERSION_MINOR}")
+set(ARROW_VERSION_PATCH "${arrow_VERSION_PATCH}")
+if (ARROW_VERSION_MAJOR STREQUAL "" OR
+    ARROW_VERSION_MINOR STREQUAL "" OR
+    ARROW_VERSION_PATCH STREQUAL "")
+  MESSAGE(FATAL_ERROR "Failed to determine Arrow version from '${ARROW_VERSION}'")
+endif()
+
+# The SO version is also the ABI version
+if(arrow_VERSION_MAJOR STREQUAL "0")
+  # Arrow 0.x.y => SO version is "x", full SO version is "x.y.0"
+  set(ARROW_SO_VERSION "${ARROW_VERSION_MINOR}")
+  set(ARROW_FULL_SO_VERSION "${ARROW_SO_VERSION}.${ARROW_VERSION_PATCH}.0")
+else()
+  message(FATAL_ERROR "Need to implement SO version generation for Arrow 1.0+")
+endif()
+
+message(STATUS "Arrow version: "
+  "${ARROW_VERSION_MAJOR}.${ARROW_VERSION_MINOR}.${ARROW_VERSION_PATCH} "
+  "(full: '${ARROW_VERSION}')")
+
 
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules")
 
@@ -43,9 +70,6 @@ if(POLICY CMP0054)
   cmake_policy(SET CMP0054 NEW)
 endif()
 
-set(ARROW_SO_VERSION "0")
-set(ARROW_ABI_VERSION "${ARROW_SO_VERSION}.0.0")
-
 set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support")
 
 set(CLANG_FORMAT_VERSION "6.0")
diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake
index f8c0f5e..f10a7ca 100644
--- a/cpp/cmake_modules/BuildUtils.cmake
+++ b/cpp/cmake_modules/BuildUtils.cmake
@@ -137,7 +137,7 @@ function(ADD_ARROW_LIB LIB_NAME)
       PDB_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}"
       LINK_FLAGS "${ARG_SHARED_LINK_FLAGS}"
       OUTPUT_NAME ${LIB_NAME}
-      VERSION "${ARROW_ABI_VERSION}"
+      VERSION "${ARROW_FULL_SO_VERSION}"
       SOVERSION "${ARROW_SO_VERSION}")
 
     target_link_libraries(${LIB_NAME}_shared
diff --git a/cpp/cmake_modules/FindArrow.cmake b/cpp/cmake_modules/FindArrow.cmake
index 0a1789a..f4b0a81 100644
--- a/cpp/cmake_modules/FindArrow.cmake
+++ b/cpp/cmake_modules/FindArrow.cmake
@@ -30,10 +30,11 @@ include(GNUInstallDirs)
 if ("$ENV{ARROW_HOME}" STREQUAL "")
   pkg_check_modules(ARROW arrow)
   if (ARROW_FOUND)
-    pkg_get_variable(ARROW_ABI_VERSION arrow abi_version)
-    message(STATUS "Arrow ABI version: ${ARROW_ABI_VERSION}")
     pkg_get_variable(ARROW_SO_VERSION arrow so_version)
-    message(STATUS "Arrow SO version: ${ARROW_SO_VERSION}")
+    set(ARROW_ABI_VERSION ${ARROW_SO_VERSION})
+    message(STATUS "Arrow SO and ABI version: ${ARROW_SO_VERSION}")
+    pkg_get_variable(ARROW_FULL_SO_VERSION arrow full_so_version)
+    message(STATUS "Arrow full SO version: ${ARROW_FULL_SO_VERSION}")
     if ("${ARROW_INCLUDE_DIRS}" STREQUAL "")
       set(ARROW_INCLUDE_DIRS "/usr/${CMAKE_INSTALL_INCLUDEDIR}")
     endif()
diff --git a/cpp/cmake_modules/FindPlasma.cmake b/cpp/cmake_modules/FindPlasma.cmake
index 3acaa34..d85df09 100644
--- a/cpp/cmake_modules/FindPlasma.cmake
+++ b/cpp/cmake_modules/FindPlasma.cmake
@@ -30,10 +30,11 @@ if ("$ENV{ARROW_HOME}" STREQUAL "")
   pkg_check_modules(PLASMA plasma)
   if (PLASMA_FOUND)
     pkg_get_variable(PLASMA_EXECUTABLE plasma executable)
-    pkg_get_variable(PLASMA_ABI_VERSION plasma abi_version)
-    message(STATUS "Plasma ABI version: ${PLASMA_ABI_VERSION}")
     pkg_get_variable(PLASMA_SO_VERSION plasma so_version)
-    message(STATUS "Plasma SO version: ${PLASMA_SO_VERSION}")
+    set(PLASMA_ABI_VERSION ${PLASMA_SO_VERSION})
+    message(STATUS "Plasma SO and ABI version: ${PLASMA_SO_VERSION}")
+    pkg_get_variable(PLASMA_FULL_SO_VERSION plasma full_so_version)
+    message(STATUS "Plasma full SO version: ${PLASMA_FULL_SO_VERSION}")
     set(PLASMA_INCLUDE_DIR ${PLASMA_INCLUDE_DIRS})
     set(PLASMA_LIBS ${PLASMA_LIBRARY_DIRS})
     set(PLASMA_SEARCH_LIB_PATH ${PLASMA_LIBRARY_DIRS})
diff --git a/cpp/src/arrow/arrow.pc.in b/cpp/src/arrow/arrow.pc.in
index cae815a..b3d32ff 100644
--- a/cpp/src/arrow/arrow.pc.in
+++ b/cpp/src/arrow/arrow.pc.in
@@ -19,7 +19,8 @@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@
 includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
 
 so_version=@ARROW_SO_VERSION@
-abi_version=@ARROW_ABI_VERSION@
+abi_version=@ARROW_SO_VERSION@
+full_so_version=@ARROW_FULL_SO_VERSION@
 
 Name: Apache Arrow
 Description: Arrow is a set of technologies that enable big-data systems to process and move data fast.
diff --git a/cpp/src/plasma/CMakeLists.txt b/cpp/src/plasma/CMakeLists.txt
index 31c007f..ed425f6 100644
--- a/cpp/src/plasma/CMakeLists.txt
+++ b/cpp/src/plasma/CMakeLists.txt
@@ -15,17 +15,19 @@
 # specific language governing permissions and limitations
 # under the License.
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.2)
 
-project(plasma)
+# For the moment, Plasma is versioned like Arrow
+project(plasma VERSION "${ARROW_BASE_VERSION}")
 
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../python/cmake_modules")
 
 find_package(PythonLibsNew REQUIRED)
 find_package(Threads)
 
-set(PLASMA_SO_VERSION "0")
-set(PLASMA_ABI_VERSION "${PLASMA_SO_VERSION}.0.0")
+# The SO version is also the ABI version
+set(PLASMA_SO_VERSION "${ARROW_SO_VERSION}")
+set(PLASMA_FULL_SO_VERSION "${ARROW_FULL_SO_VERSION}")
 
 include_directories(SYSTEM ${PYTHON_INCLUDE_DIRS})
 include_directories("${FLATBUFFERS_INCLUDE_DIR}" "${CMAKE_CURRENT_LIST_DIR}/" "${CMAKE_CURRENT_LIST_DIR}/thirdparty/" "${CMAKE_CURRENT_LIST_DIR}/../")
diff --git a/cpp/src/plasma/plasma.pc.in b/cpp/src/plasma/plasma.pc.in
index d868689..60cc113 100644
--- a/cpp/src/plasma/plasma.pc.in
+++ b/cpp/src/plasma/plasma.pc.in
@@ -20,7 +20,8 @@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
 includedir=${prefix}/include
 
 so_version=@PLASMA_SO_VERSION@
-abi_version=@PLASMA_ABI_VERSION@
+abi_version=@PLASMA_SO_VERSION@
+full_so_version=@PLASMA_FULL_SO_VERSION@
 executable=${prefix}/@CMAKE_INSTALL_BINDIR@/plasma_store
 
 Name: Plasma

-- 
To stop receiving notification emails like this one, please contact
kou@apache.org.