You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2018/12/15 21:57:46 UTC

[arrow] branch master updated: ARROW-4029: [C++] Exclude headers with 'internal' from installation. Document header file conventions in README

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

wesm 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 055496c  ARROW-4029: [C++] Exclude headers with 'internal' from installation. Document header file conventions in README
055496c is described below

commit 055496cd9a040d64d4a00d773261e61e7caac31b
Author: Wes McKinney <we...@apache.org>
AuthorDate: Sat Dec 15 15:57:40 2018 -0600

    ARROW-4029: [C++] Exclude headers with 'internal' from installation. Document header file conventions in README
    
    In reviewing what usages of the `install` command we have, I added a helper function to add `.pc` files to reduce code duplication
    
    Author: Wes McKinney <we...@apache.org>
    
    Closes #3176 from wesm/ARROW-4029 and squashes the following commits:
    
    f5b3811fc <Wes McKinney> Exclude headers with 'internal' from installation. Document in README. Add function to reduce code duplication in adding pkg-config files
---
 cpp/README.md                                 |  6 ++++++
 cpp/cmake_modules/BuildUtils.cmake            | 18 +++++++++++++++++-
 cpp/src/arrow/CMakeLists.txt                  |  7 +------
 cpp/src/arrow/array/CMakeLists.txt            | 10 +---------
 cpp/src/arrow/compute/CMakeLists.txt          |  7 +------
 cpp/src/arrow/compute/kernels/CMakeLists.txt  |  6 +-----
 cpp/src/arrow/flight/CMakeLists.txt           |  7 +------
 cpp/src/arrow/gpu/CMakeLists.txt              | 10 +---------
 cpp/src/arrow/io/CMakeLists.txt               | 11 +----------
 cpp/src/arrow/python/CMakeLists.txt           |  7 +------
 cpp/src/arrow/util/string_view/CMakeLists.txt |  2 +-
 cpp/src/arrow/util/variant/CMakeLists.txt     |  8 +-------
 cpp/src/gandiva/CMakeLists.txt                |  7 +------
 cpp/src/parquet/CMakeLists.txt                |  8 +-------
 cpp/src/plasma/CMakeLists.txt                 |  7 +------
 15 files changed, 36 insertions(+), 85 deletions(-)

diff --git a/cpp/README.md b/cpp/README.md
index 71aa98e..010387d 100644
--- a/cpp/README.md
+++ b/cpp/README.md
@@ -313,6 +313,12 @@ which use the default pool without explicitly passing it. You can disable these
 constructors in your application (so that you are accounting properly for all
 memory allocations) by defining `ARROW_NO_DEFAULT_MEMORY_POOL`.
 
+### Header files
+
+We use the `.h` extension for C++ header files. Any header file name not
+containing `internal` is considered to be a public header, and will be
+automatically installed by the build.
+
 ### Error Handling and Exceptions
 
 For error handling, we use `arrow::Status` values instead of throwing C++
diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake
index 1abe97e..7585ae9 100644
--- a/cpp/cmake_modules/BuildUtils.cmake
+++ b/cpp/cmake_modules/BuildUtils.cmake
@@ -583,7 +583,23 @@ function(ARROW_INSTALL_ALL_HEADERS PATH)
     set(ARG_PATTERN "*.h")
   endif()
   file(GLOB CURRENT_DIRECTORY_HEADERS ${ARG_PATTERN})
+
+  set(PUBLIC_HEADERS)
+  foreach(HEADER ${CURRENT_DIRECTORY_HEADERS})
+    if (NOT ((HEADER MATCHES "internal")))
+      LIST(APPEND PUBLIC_HEADERS ${HEADER})
+    endif()
+  endforeach()
   install(FILES
-    ${CURRENT_DIRECTORY_HEADERS}
+    ${PUBLIC_HEADERS}
     DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PATH}")
 endfunction()
+
+function(ARROW_ADD_PKG_CONFIG MODULE)
+  configure_file(${MODULE}.pc.in
+    "${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.pc"
+    @ONLY)
+  install(
+    FILES "${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.pc"
+    DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
+endfunction()
diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt
index b13c9b6..bec290d 100644
--- a/cpp/src/arrow/CMakeLists.txt
+++ b/cpp/src/arrow/CMakeLists.txt
@@ -252,12 +252,7 @@ endforeach()
 ARROW_INSTALL_ALL_HEADERS("arrow")
 
 # pkg-config support
-configure_file(arrow.pc.in
-  "${CMAKE_CURRENT_BINARY_DIR}/arrow.pc"
-  @ONLY)
-install(
-  FILES "${CMAKE_CURRENT_BINARY_DIR}/arrow.pc"
-  DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
+ARROW_ADD_PKG_CONFIG("arrow")
 
 #######################################
 # Unit tests
diff --git a/cpp/src/arrow/array/CMakeLists.txt b/cpp/src/arrow/array/CMakeLists.txt
index a789c88..4a8ce34 100644
--- a/cpp/src/arrow/array/CMakeLists.txt
+++ b/cpp/src/arrow/array/CMakeLists.txt
@@ -16,12 +16,4 @@
 # under the License.
 
 # Headers: top level
-install(FILES
-  builder_adaptive.h
-  builder_base.h
-  builder_binary.h
-  builder_decimal.h
-  builder_dict.h
-  builder_nested.h
-  builder_primitive.h
-  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/array")
+ARROW_INSTALL_ALL_HEADERS("arrow/array")
diff --git a/cpp/src/arrow/compute/CMakeLists.txt b/cpp/src/arrow/compute/CMakeLists.txt
index 2429370..75d152b 100644
--- a/cpp/src/arrow/compute/CMakeLists.txt
+++ b/cpp/src/arrow/compute/CMakeLists.txt
@@ -18,12 +18,7 @@
 ARROW_INSTALL_ALL_HEADERS("arrow/compute")
 
 # pkg-config support
-configure_file(arrow-compute.pc.in
-  "${CMAKE_CURRENT_BINARY_DIR}/arrow-compute.pc"
-  @ONLY)
-install(
-  FILES "${CMAKE_CURRENT_BINARY_DIR}/arrow-compute.pc"
-  DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
+ARROW_ADD_PKG_CONFIG("arrow-compute")
 
 #######################################
 # Unit tests
diff --git a/cpp/src/arrow/compute/kernels/CMakeLists.txt b/cpp/src/arrow/compute/kernels/CMakeLists.txt
index 923c8c3..a5a142b 100644
--- a/cpp/src/arrow/compute/kernels/CMakeLists.txt
+++ b/cpp/src/arrow/compute/kernels/CMakeLists.txt
@@ -15,8 +15,4 @@
 # specific language governing permissions and limitations
 # under the License.
 
-install(FILES
-  boolean.h
-  cast.h
-  hash.h
-  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/compute/kernels")
+ARROW_INSTALL_ALL_HEADERS("arrow/compute/kernels")
diff --git a/cpp/src/arrow/flight/CMakeLists.txt b/cpp/src/arrow/flight/CMakeLists.txt
index bc22d60..aa56269 100644
--- a/cpp/src/arrow/flight/CMakeLists.txt
+++ b/cpp/src/arrow/flight/CMakeLists.txt
@@ -18,12 +18,7 @@
 add_custom_target(arrow_flight)
 
 # Header files
-install(FILES
-  api.h
-  client.h
-  server.h
-  types.h
-  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/flight")
+ARROW_INSTALL_ALL_HEADERS("arrow/flight")
 
 SET(ARROW_FLIGHT_STATIC_LINK_LIBS
   grpc_grpcpp
diff --git a/cpp/src/arrow/gpu/CMakeLists.txt b/cpp/src/arrow/gpu/CMakeLists.txt
index c37779a..8b69c65 100644
--- a/cpp/src/arrow/gpu/CMakeLists.txt
+++ b/cpp/src/arrow/gpu/CMakeLists.txt
@@ -64,15 +64,7 @@ install(FILES
   DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/gpu")
 
 ARROW_INSTALL_ALL_HEADERS("arrow/gpu")
-
-# pkg-config support
-configure_file(arrow-cuda.pc.in
-  "${CMAKE_CURRENT_BINARY_DIR}/arrow-cuda.pc"
-  @ONLY)
-
-install(
-  FILES "${CMAKE_CURRENT_BINARY_DIR}/arrow-cuda.pc"
-  DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
+ARROW_ADD_PKG_CONFIG("arrow-cuda")
 
 set(ARROW_CUDA_TEST_LINK_LIBS
   arrow_cuda_shared
diff --git a/cpp/src/arrow/io/CMakeLists.txt b/cpp/src/arrow/io/CMakeLists.txt
index 80d68fb..13b577f 100644
--- a/cpp/src/arrow/io/CMakeLists.txt
+++ b/cpp/src/arrow/io/CMakeLists.txt
@@ -41,13 +41,4 @@ ADD_ARROW_BENCHMARK(memory-benchmark
   PREFIX "arrow-io")
 
 # Headers: top level
-install(FILES
-  api.h
-  buffered.h
-  compressed.h
-  file.h
-  hdfs.h
-  interfaces.h
-  memory.h
-  readahead.h
-  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/io")
+ARROW_INSTALL_ALL_HEADERS("arrow/io")
diff --git a/cpp/src/arrow/python/CMakeLists.txt b/cpp/src/arrow/python/CMakeLists.txt
index 4913083..98c105a 100644
--- a/cpp/src/arrow/python/CMakeLists.txt
+++ b/cpp/src/arrow/python/CMakeLists.txt
@@ -94,12 +94,7 @@ endif()
 ARROW_INSTALL_ALL_HEADERS("arrow/python")
 
 # pkg-config support
-configure_file(arrow-python.pc.in
-  "${CMAKE_CURRENT_BINARY_DIR}/arrow-python.pc"
-  @ONLY)
-install(
-  FILES "${CMAKE_CURRENT_BINARY_DIR}/arrow-python.pc"
-  DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
+ARROW_ADD_PKG_CONFIG("arrow-python")
 
 # ----------------------------------------------------------------------
 
diff --git a/cpp/src/arrow/util/string_view/CMakeLists.txt b/cpp/src/arrow/util/string_view/CMakeLists.txt
index bae6bdb..7e55307 100644
--- a/cpp/src/arrow/util/string_view/CMakeLists.txt
+++ b/cpp/src/arrow/util/string_view/CMakeLists.txt
@@ -17,4 +17,4 @@
 
 install(FILES
   string_view.hpp
-  DESTINATION include/arrow/util/string_view)
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/util/string_view")
diff --git a/cpp/src/arrow/util/variant/CMakeLists.txt b/cpp/src/arrow/util/variant/CMakeLists.txt
index 0ebb251..b7a5692 100644
--- a/cpp/src/arrow/util/variant/CMakeLists.txt
+++ b/cpp/src/arrow/util/variant/CMakeLists.txt
@@ -19,10 +19,4 @@
 # arrow_util_variant
 #######################################
 
-install(FILES
-  optional.h
-  recursive_wrapper.h
-  variant_cast.h
-  variant_io.h
-  variant_visitor.h
-  DESTINATION include/arrow/util/variant)
+ARROW_INSTALL_ALL_HEADERS("arrow/util/variant")
diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt
index 9763f29..da0d3bb 100644
--- a/cpp/src/gandiva/CMakeLists.txt
+++ b/cpp/src/gandiva/CMakeLists.txt
@@ -96,12 +96,7 @@ include(GNUInstallDirs)
 ARROW_INSTALL_ALL_HEADERS("gandiva")
 
 # pkg-config support
-configure_file(gandiva.pc.in
-  "${CMAKE_CURRENT_BINARY_DIR}/gandiva.pc"
-  @ONLY)
-install(
-  FILES "${CMAKE_CURRENT_BINARY_DIR}/gandiva.pc"
-  DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
+ARROW_ADD_PKG_CONFIG("gandiva")
 
 set(GANDIVA_STATIC_TEST_LINK_LIBS
   gandiva_static
diff --git a/cpp/src/parquet/CMakeLists.txt b/cpp/src/parquet/CMakeLists.txt
index 6b7846b..995c39a 100644
--- a/cpp/src/parquet/CMakeLists.txt
+++ b/cpp/src/parquet/CMakeLists.txt
@@ -249,13 +249,7 @@ install(FILES
   DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/parquet")
 
 # pkg-config support
-configure_file(parquet.pc.in
-  "${CMAKE_CURRENT_BINARY_DIR}/parquet.pc"
-  @ONLY)
-
-install(FILES
-  "${CMAKE_CURRENT_BINARY_DIR}/parquet.pc"
-  DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
+ARROW_ADD_PKG_CONFIG("parquet")
 
 ADD_PARQUET_TEST(bloom_filter-test)
 ADD_PARQUET_TEST(column_reader-test)
diff --git a/cpp/src/plasma/CMakeLists.txt b/cpp/src/plasma/CMakeLists.txt
index 15d16af..83c201d 100644
--- a/cpp/src/plasma/CMakeLists.txt
+++ b/cpp/src/plasma/CMakeLists.txt
@@ -150,12 +150,7 @@ install(TARGETS plasma_store_server
   DESTINATION ${CMAKE_INSTALL_BINDIR})
 
 # pkg-config support
-configure_file(plasma.pc.in
-  "${CMAKE_CURRENT_BINARY_DIR}/plasma.pc"
-  @ONLY)
-install(
-  FILES "${CMAKE_CURRENT_BINARY_DIR}/plasma.pc"
-  DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
+ARROW_ADD_PKG_CONFIG("plasma")
 
 if(ARROW_PLASMA_JAVA_CLIENT)
   # Plasma java client support