[1/5] arrow git commit: ARROW-341: [Python] Move pyarrow's C++ code to the main C++ source tree, install libarrow_python and headers
Repository: arrow Updated Branches: refs/heads/master 6d4e86290 -> 3aac4adef http://git-wip-us.apache.org/repos/asf/arrow/blob/3aac4ade/python/src/pyarrow/io.cc -- diff --git a/python/src/pyarrow/io.cc b/python/src/pyarrow/io.cc deleted file mode 100644 index c66155b..000 --- a/python/src/pyarrow/io.cc +++ /dev/null @@ -1,221 +0,0 @@ -// 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. - -#include "pyarrow/io.h" - -#include -#include - -#include "arrow/io/memory.h" -#include "arrow/memory_pool.h" -#include "arrow/status.h" - -#include "pyarrow/common.h" - -namespace arrow { -namespace py { - -// -- -// Python file - -PythonFile::PythonFile(PyObject* file) : file_(file) { - Py_INCREF(file_); -} - -PythonFile::~PythonFile() { - Py_DECREF(file_); -} - -static Status CheckPyError() { - if (PyErr_Occurred()) { -PyObject *exc_type, *exc_value, *traceback; -PyErr_Fetch(_type, _value, ); -PyObjectStringify stringified(exc_value); -std::string message(stringified.bytes); -Py_XDECREF(exc_type); -Py_XDECREF(exc_value); -Py_XDECREF(traceback); -PyErr_Clear(); -return Status::IOError(message); - } - return Status::OK(); -} - -// This is annoying: because C++11 does not allow implicit conversion of string -// literals to non-const char*, we need to go through some gymnastics to use -// PyObject_CallMethod without a lot of pain (its arguments are non-const -// char*) -template -static inline PyObject* cpp_PyObject_CallMethod( -PyObject* obj, const char* method_name, const char* argspec, ArgTypes... args) { - return PyObject_CallMethod( - obj, const_cast(method_name), const_cast (argspec), args...); -} - -Status PythonFile::Close() { - // whence: 0 for relative to start of file, 2 for end of file - PyObject* result = cpp_PyObject_CallMethod(file_, "close", "()"); - Py_XDECREF(result); - ARROW_RETURN_NOT_OK(CheckPyError()); - return Status::OK(); -} - -Status PythonFile::Seek(int64_t position, int whence) { - // whence: 0 for relative to start of file, 2 for end of file - PyObject* result = cpp_PyObject_CallMethod(file_, "seek", "(ii)", position, whence); - Py_XDECREF(result); - ARROW_RETURN_NOT_OK(CheckPyError()); - return Status::OK(); -} - -Status PythonFile::Read(int64_t nbytes, PyObject** out) { - PyObject* result = cpp_PyObject_CallMethod(file_, "read", "(i)", nbytes); - ARROW_RETURN_NOT_OK(CheckPyError()); - *out = result; - return Status::OK(); -} - -Status PythonFile::Write(const uint8_t* data, int64_t nbytes) { - PyObject* py_data = - PyBytes_FromStringAndSize(reinterpret_cast(data), nbytes); - ARROW_RETURN_NOT_OK(CheckPyError()); - - PyObject* result = cpp_PyObject_CallMethod(file_, "write", "(O)", py_data); - Py_XDECREF(py_data); - Py_XDECREF(result); - ARROW_RETURN_NOT_OK(CheckPyError()); - return Status::OK(); -} - -Status PythonFile::Tell(int64_t* position) { - PyObject* result = cpp_PyObject_CallMethod(file_, "tell", "()"); - ARROW_RETURN_NOT_OK(CheckPyError()); - - *position = PyLong_AsLongLong(result); - Py_DECREF(result); - - // PyLong_AsLongLong can raise OverflowError - ARROW_RETURN_NOT_OK(CheckPyError()); - - return Status::OK(); -} - -// -- -// Seekable input stream - -PyReadableFile::PyReadableFile(PyObject* file) { - file_.reset(new PythonFile(file)); -} - -PyReadableFile::~PyReadableFile() {} - -Status PyReadableFile::Close() { - PyAcquireGIL lock; - return file_->Close(); -} - -Status PyReadableFile::Seek(int64_t position) { - PyAcquireGIL lock; - return file_->Seek(position, 0); -} - -Status PyReadableFile::Tell(int64_t* position) { - PyAcquireGIL lock; - return file_->Tell(position); -} - -Status PyReadableFile::Read(int64_t nbytes, int64_t* bytes_read, uint8_t* out) { - PyAcquireGIL lock; - PyObject* bytes_obj; - ARROW_RETURN_NOT_OK(file_->Read(nbytes, _obj)); - - *bytes_read = PyBytes_GET_SIZE(bytes_obj); - std::memcpy(out, PyBytes_AS_STRING(bytes_obj), *bytes_read); - Py_DECREF(bytes_obj); - - return Status::OK(); -}
[2/5] arrow git commit: ARROW-341: [Python] Move pyarrow's C++ code to the main C++ source tree, install libarrow_python and headers
http://git-wip-us.apache.org/repos/asf/arrow/blob/3aac4ade/python/src/pyarrow/adapters/pandas.cc -- diff --git a/python/src/pyarrow/adapters/pandas.cc b/python/src/pyarrow/adapters/pandas.cc deleted file mode 100644 index a7386ce..000 --- a/python/src/pyarrow/adapters/pandas.cc +++ /dev/null @@ -1,1936 +0,0 @@ -// 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. - -// Functions for pandas conversion via NumPy - -#include - -#include "pyarrow/adapters/pandas.h" -#include "pyarrow/numpy_interop.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "arrow/array.h" -#include "arrow/column.h" -#include "arrow/loader.h" -#include "arrow/status.h" -#include "arrow/table.h" -#include "arrow/type_fwd.h" -#include "arrow/type_traits.h" -#include "arrow/util/bit-util.h" -#include "arrow/util/macros.h" - -#include "pyarrow/adapters/builtin.h" -#include "pyarrow/common.h" -#include "pyarrow/config.h" -#include "pyarrow/type_traits.h" -#include "pyarrow/util/datetime.h" - -namespace arrow { -namespace py { - -// -- -// Utility code - -int cast_npy_type_compat(int type_num) { -// Both LONGLONG and INT64 can be observed in the wild, which is buggy. We set -// U/LONGLONG to U/INT64 so things work properly. - -#if (NPY_INT64 == NPY_LONGLONG) && (NPY_SIZEOF_LONGLONG == 8) - if (type_num == NPY_LONGLONG) { type_num = NPY_INT64; } - if (type_num == NPY_ULONGLONG) { type_num = NPY_UINT64; } -#endif - - return type_num; -} - -static inline bool PyObject_is_null(const PyObject* obj) { - return obj == Py_None || obj == numpy_nan; -} - -static inline bool PyObject_is_string(const PyObject* obj) { -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_Check(obj) || PyBytes_Check(obj); -#else - return PyString_Check(obj) || PyUnicode_Check(obj); -#endif -} - -template -static int64_t ValuesToBitmap(const void* data, int64_t length, uint8_t* bitmap) { - typedef npy_traits traits; - typedef typename traits::value_type T; - - int64_t null_count = 0; - const T* values = reinterpret_cast(data); - - // TODO(wesm): striding - for (int i = 0; i < length; ++i) { -if (traits::isnull(values[i])) { - ++null_count; -} else { - BitUtil::SetBit(bitmap, i); -} - } - - return null_count; -} - -// Returns null count -static int64_t MaskToBitmap(PyArrayObject* mask, int64_t length, uint8_t* bitmap) { - int64_t null_count = 0; - const uint8_t* mask_values = static_cast(PyArray_DATA(mask)); - // TODO(wesm): strided null mask - for (int i = 0; i < length; ++i) { -if (mask_values[i]) { - ++null_count; -} else { - BitUtil::SetBit(bitmap, i); -} - } - return null_count; -} - -template -static int64_t ValuesToValidBytes( -const void* data, int64_t length, uint8_t* valid_bytes) { - typedef npy_traits traits; - typedef typename traits::value_type T; - - int64_t null_count = 0; - const T* values = reinterpret_cast(data); - - // TODO(wesm): striding - for (int i = 0; i < length; ++i) { -valid_bytes[i] = not traits::isnull(values[i]); -if (traits::isnull(values[i])) null_count++; - } - - return null_count; -} - -Status CheckFlatNumpyArray(PyArrayObject* numpy_array, int np_type) { - if (PyArray_NDIM(numpy_array) != 1) { -return Status::Invalid("only handle 1-dimensional arrays"); - } - - if (PyArray_DESCR(numpy_array)->type_num != np_type) { -return Status::Invalid("can only handle exact conversions"); - } - - npy_intp* astrides = PyArray_STRIDES(numpy_array); - if (astrides[0] != PyArray_DESCR(numpy_array)->elsize) { -return Status::Invalid("No support for strided arrays in lists yet"); - } - return Status::OK(); -} - -Status AppendObjectStrings(StringBuilder& string_builder, PyObject** objects, -int64_t objects_length, bool* have_bytes) { - PyObject* obj; - - for (int64_t i = 0; i < objects_length; ++i) { -obj = objects[i]; -if (PyUnicode_Check(obj)) { - obj = PyUnicode_AsUTF8String(obj); - if (obj == NULL) { -PyErr_Clear(); -return Status::TypeError("failed
[4/5] arrow git commit: ARROW-341: [Python] Move pyarrow's C++ code to the main C++ source tree, install libarrow_python and headers
http://git-wip-us.apache.org/repos/asf/arrow/blob/3aac4ade/cpp/src/arrow/python/pandas_convert.cc -- diff --git a/cpp/src/arrow/python/pandas_convert.cc b/cpp/src/arrow/python/pandas_convert.cc new file mode 100644 index 000..f2c2415 --- /dev/null +++ b/cpp/src/arrow/python/pandas_convert.cc @@ -0,0 +1,1936 @@ +// 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. + +// Functions for pandas conversion via NumPy + +#include + +#include "arrow/python/numpy_interop.h" +#include "arrow/python/pandas_convert.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "arrow/array.h" +#include "arrow/column.h" +#include "arrow/loader.h" +#include "arrow/python/builtin_convert.h" +#include "arrow/python/common.h" +#include "arrow/python/config.h" +#include "arrow/python/type_traits.h" +#include "arrow/python/util/datetime.h" +#include "arrow/status.h" +#include "arrow/table.h" +#include "arrow/type_fwd.h" +#include "arrow/type_traits.h" +#include "arrow/util/bit-util.h" +#include "arrow/util/macros.h" + +namespace arrow { +namespace py { + +// -- +// Utility code + +int cast_npy_type_compat(int type_num) { +// Both LONGLONG and INT64 can be observed in the wild, which is buggy. We set +// U/LONGLONG to U/INT64 so things work properly. + +#if (NPY_INT64 == NPY_LONGLONG) && (NPY_SIZEOF_LONGLONG == 8) + if (type_num == NPY_LONGLONG) { type_num = NPY_INT64; } + if (type_num == NPY_ULONGLONG) { type_num = NPY_UINT64; } +#endif + + return type_num; +} + +static inline bool PyObject_is_null(const PyObject* obj) { + return obj == Py_None || obj == numpy_nan; +} + +static inline bool PyObject_is_string(const PyObject* obj) { +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_Check(obj) || PyBytes_Check(obj); +#else + return PyString_Check(obj) || PyUnicode_Check(obj); +#endif +} + +template +static int64_t ValuesToBitmap(const void* data, int64_t length, uint8_t* bitmap) { + typedef npy_traits traits; + typedef typename traits::value_type T; + + int64_t null_count = 0; + const T* values = reinterpret_cast(data); + + // TODO(wesm): striding + for (int i = 0; i < length; ++i) { +if (traits::isnull(values[i])) { + ++null_count; +} else { + BitUtil::SetBit(bitmap, i); +} + } + + return null_count; +} + +// Returns null count +static int64_t MaskToBitmap(PyArrayObject* mask, int64_t length, uint8_t* bitmap) { + int64_t null_count = 0; + const uint8_t* mask_values = static_cast(PyArray_DATA(mask)); + // TODO(wesm): strided null mask + for (int i = 0; i < length; ++i) { +if (mask_values[i]) { + ++null_count; +} else { + BitUtil::SetBit(bitmap, i); +} + } + return null_count; +} + +template +static int64_t ValuesToValidBytes( +const void* data, int64_t length, uint8_t* valid_bytes) { + typedef npy_traits traits; + typedef typename traits::value_type T; + + int64_t null_count = 0; + const T* values = reinterpret_cast(data); + + // TODO(wesm): striding + for (int i = 0; i < length; ++i) { +valid_bytes[i] = !traits::isnull(values[i]); +if (traits::isnull(values[i])) null_count++; + } + + return null_count; +} + +Status CheckFlatNumpyArray(PyArrayObject* numpy_array, int np_type) { + if (PyArray_NDIM(numpy_array) != 1) { +return Status::Invalid("only handle 1-dimensional arrays"); + } + + if (PyArray_DESCR(numpy_array)->type_num != np_type) { +return Status::Invalid("can only handle exact conversions"); + } + + npy_intp* astrides = PyArray_STRIDES(numpy_array); + if (astrides[0] != PyArray_DESCR(numpy_array)->elsize) { +return Status::Invalid("No support for strided arrays in lists yet"); + } + return Status::OK(); +} + +Status AppendObjectStrings(StringBuilder& string_builder, PyObject** objects, +int64_t objects_length, bool* have_bytes) { + PyObject* obj; + + for (int64_t i = 0; i < objects_length; ++i) { +obj = objects[i]; +if (PyUnicode_Check(obj)) { + obj = PyUnicode_AsUTF8String(obj); + if (obj == NULL) { +PyErr_Clear(); +
[5/5] arrow git commit: ARROW-341: [Python] Move pyarrow's C++ code to the main C++ source tree, install libarrow_python and headers
ARROW-341: [Python] Move pyarrow's C++ code to the main C++ source tree, install libarrow_python and headers This will enable third parties to link to `libarrow_python`. For now, the pyarrow build system continues to use CMake -- for the purpose of resolving the thirdparty toolchain we may or may not want to go completely to distutils, but we can sort that out later. Author: Wes McKinneyCloses #440 from wesm/ARROW-341 and squashes the following commits: 193bc51 [Wes McKinney] Ensure that '-undefined dynamic_lookup' is passed when linking shared library on OS X a93496b [Wes McKinney] Add missing backslash 7620f50 [Wes McKinney] Fix cpplint issues 0617c69 [Wes McKinney] Fix LD_LIBRARY_PATH, ARROW_HOME 090c78c [Wes McKinney] Build Arrow library stack specific to active Python version 10e4626 [Wes McKinney] Get Python test suite passing again cfb7f44 [Wes McKinney] Remove print statement c1e63dc [Wes McKinney] Scrubbing python/CMakeLists.txt b80b153 [Wes McKinney] Cleanup, build pandas-test within main test suite 7ef1f81 [Wes McKinney] Start moving python/src/pyarrow tp cpp/src/arrow/python Project: http://git-wip-us.apache.org/repos/asf/arrow/repo Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/3aac4ade Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/3aac4ade Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/3aac4ade Branch: refs/heads/master Commit: 3aac4adef11345f211e4c66467ff758cbc397e43 Parents: 6d4e862 Author: Wes McKinney Authored: Sun Mar 26 11:45:38 2017 -0400 Committer: Wes McKinney Committed: Sun Mar 26 11:45:38 2017 -0400 -- ci/travis_script_python.sh | 26 +- cpp/CMakeLists.txt | 115 +- cpp/cmake_modules/BuildUtils.cmake | 88 +- cpp/cmake_modules/FindNumPy.cmake| 100 ++ cpp/cmake_modules/FindPythonLibsNew.cmake| 241 +++ cpp/src/arrow/python/CMakeLists.txt | 93 + cpp/src/arrow/python/api.h | 27 + cpp/src/arrow/python/builtin_convert.cc | 527 ++ cpp/src/arrow/python/builtin_convert.h | 54 + cpp/src/arrow/python/common.cc | 68 + cpp/src/arrow/python/common.h| 139 ++ cpp/src/arrow/python/config.cc | 35 + cpp/src/arrow/python/config.h| 45 + cpp/src/arrow/python/do_import_numpy.h | 21 + cpp/src/arrow/python/helpers.cc | 55 + cpp/src/arrow/python/helpers.h | 35 + cpp/src/arrow/python/io.cc | 222 +++ cpp/src/arrow/python/io.h| 99 ++ cpp/src/arrow/python/numpy_interop.h | 60 + cpp/src/arrow/python/pandas-test.cc | 64 + cpp/src/arrow/python/pandas_convert.cc | 1936 + cpp/src/arrow/python/pandas_convert.h| 79 + cpp/src/arrow/python/type_traits.h | 213 +++ cpp/src/arrow/python/util/CMakeLists.txt | 39 + cpp/src/arrow/python/util/datetime.h | 42 + cpp/src/arrow/python/util/test_main.cc | 36 + python/CMakeLists.txt| 215 +-- python/cmake_modules/FindArrow.cmake |9 + python/cmake_modules/FindNumPy.cmake | 100 -- python/cmake_modules/FindPythonLibsNew.cmake | 241 --- python/pyarrow/config.pyx| 14 +- python/pyarrow/includes/pyarrow.pxd |6 +- python/setup.py | 11 +- python/src/pyarrow/CMakeLists.txt| 22 - python/src/pyarrow/adapters/builtin.cc | 527 -- python/src/pyarrow/adapters/builtin.h| 54 - python/src/pyarrow/adapters/pandas-test.cc | 64 - python/src/pyarrow/adapters/pandas.cc| 1936 - python/src/pyarrow/adapters/pandas.h | 79 - python/src/pyarrow/api.h | 26 - python/src/pyarrow/common.cc | 69 - python/src/pyarrow/common.h | 137 -- python/src/pyarrow/config.cc | 35 - python/src/pyarrow/config.h | 46 - python/src/pyarrow/do_import_numpy.h | 21 - python/src/pyarrow/helpers.cc| 55 - python/src/pyarrow/helpers.h | 35 - python/src/pyarrow/io.cc | 221 --- python/src/pyarrow/io.h | 99 -- python/src/pyarrow/numpy_interop.h | 60 - python/src/pyarrow/type_traits.h | 212 --- python/src/pyarrow/util/CMakeLists.txt | 39 - python/src/pyarrow/util/datetime.h | 42 - python/src/pyarrow/util/test_main.cc | 36 - 54 files changed, 4409 insertions(+), 4461 deletions(-) --
[3/5] arrow git commit: ARROW-341: [Python] Move pyarrow's C++ code to the main C++ source tree, install libarrow_python and headers
http://git-wip-us.apache.org/repos/asf/arrow/blob/3aac4ade/python/CMakeLists.txt -- diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index ef874e3..35a1a89 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -47,9 +47,6 @@ endif() # Top level cmake dir if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - option(PYARROW_BUILD_TESTS -"Build the PyArrow C++ googletest unit tests" -OFF) option(PYARROW_BUILD_PARQUET "Build the PyArrow Parquet integration" OFF) @@ -57,7 +54,7 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") "Build the PyArrow jemalloc integration" OFF) option(PYARROW_BUNDLE_ARROW_CPP -"Bundle the Arrow C++ libraries" +"Bundle the Arrow C++ libraries" OFF) endif() @@ -75,6 +72,8 @@ endif(CCACHE_FOUND) # Compiler flags +include(BuildUtils) +include(CompilerInfo) include(SetupCxxFlags) # Add common flags @@ -86,8 +85,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer") # Suppress Cython warnings set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable") -# Determine compiler version -include(CompilerInfo) if ("${COMPILER_FAMILY}" STREQUAL "clang") # Using Clang with ccache causes a bunch of spurious warnings that are @@ -216,115 +213,8 @@ include_directories(SYSTEM src) -# Testing - - -# Add a new test case, with or without an executable that should be built. -# -# REL_TEST_NAME is the name of the test. It may be a single component -# (e.g. monotime-test) or contain additional components (e.g. -# net/net_util-test). Either way, the last component must be a globally -# unique name. -# -# Arguments after the test name will be passed to set_tests_properties(). -function(ADD_PYARROW_TEST REL_TEST_NAME) - if(NO_TESTS) -return() - endif() - get_filename_component(TEST_NAME ${REL_TEST_NAME} NAME_WE) - - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${REL_TEST_NAME}.cc) -# This test has a corresponding .cc file, set it up as an executable. -set(TEST_PATH "${EXECUTABLE_OUTPUT_PATH}/${TEST_NAME}") -add_executable(${TEST_NAME} "${REL_TEST_NAME}.cc") -target_link_libraries(${TEST_NAME} ${PYARROW_TEST_LINK_LIBS}) - else() -# No executable, just invoke the test (probably a script) directly. -set(TEST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${REL_TEST_NAME}) - endif() - - add_test(${TEST_NAME} -${BUILD_SUPPORT_DIR}/run-test.sh ${TEST_PATH}) - if(ARGN) -set_tests_properties(${TEST_NAME} PROPERTIES ${ARGN}) - endif() -endfunction() - -# A wrapper for add_dependencies() that is compatible with NO_TESTS. -function(ADD_PYARROW_TEST_DEPENDENCIES REL_TEST_NAME) - if(NO_TESTS) -return() - endif() - get_filename_component(TEST_NAME ${REL_TEST_NAME} NAME_WE) - - add_dependencies(${TEST_NAME} ${ARGN}) -endfunction() - -enable_testing() - - # Dependencies -function(ADD_THIRDPARTY_LIB LIB_NAME) - set(options) - set(one_value_args SHARED_LIB STATIC_LIB) - set(multi_value_args DEPS) - cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) - if(ARG_UNPARSED_ARGUMENTS) -message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}") - endif() - - if(("${PYARROW_LINK}" STREQUAL "s" AND ARG_STATIC_LIB) OR (NOT ARG_SHARED_LIB)) -if(NOT ARG_STATIC_LIB) - message(FATAL_ERROR "No static or shared library provided for ${LIB_NAME}") -endif() -add_library(${LIB_NAME} STATIC IMPORTED) -set_target_properties(${LIB_NAME} - PROPERTIES IMPORTED_LOCATION "${ARG_STATIC_LIB}") -message(STATUS "Added static library dependency ${LIB_NAME}: ${ARG_STATIC_LIB}") - else() -add_library(${LIB_NAME} SHARED IMPORTED) -set_target_properties(${LIB_NAME} - PROPERTIES IMPORTED_LOCATION "${ARG_SHARED_LIB}") -message(STATUS "Added shared library dependency ${LIB_NAME}: ${ARG_SHARED_LIB}") - endif() - - if(ARG_DEPS) -set_target_properties(${LIB_NAME} - PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "${ARG_DEPS}") - endif() - - # Set up an "exported variant" for this thirdparty library (see "Visibility" - # above). It's the same as the real target, just with an "_exported" suffix. - # We prefer the static archive if it exists (as it's akin to an "internal" - # library), but we'll settle for the shared object if we must. - # - # A shared object exported variant will force any "leaf" library that - # transitively depends on it to also depend on it at runtime; this is - # desirable for some libraries (e.g. cyrus_sasl). - set(LIB_NAME_EXPORTED ${LIB_NAME}_exported) -
arrow git commit: ARROW-713: [C++] Fix cmake linking issue in new IPC benchmark
Repository: arrow Updated Branches: refs/heads/master 685ebf490 -> ab848f0ea ARROW-713: [C++] Fix cmake linking issue in new IPC benchmark Author: Jeff KnuppCloses #444 from jeffknupp/master and squashes the following commits: 37aa10f [Jeff Knupp] [C++] ARROW-713: Fix cmake linking issue in new IPC benchmark Project: http://git-wip-us.apache.org/repos/asf/arrow/repo Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/ab848f0e Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/ab848f0e Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/ab848f0e Branch: refs/heads/master Commit: ab848f0eab053eeea62d1cf0c0f285db6460da54 Parents: 685ebf4 Author: Jeff Knupp Authored: Sun Mar 26 09:19:44 2017 +0200 Committer: Uwe L. Korn Committed: Sun Mar 26 09:19:44 2017 +0200 -- cpp/src/arrow/ipc/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/arrow/blob/ab848f0e/cpp/src/arrow/ipc/CMakeLists.txt -- diff --git a/cpp/src/arrow/ipc/CMakeLists.txt b/cpp/src/arrow/ipc/CMakeLists.txt index d6ee930..030cba9 100644 --- a/cpp/src/arrow/ipc/CMakeLists.txt +++ b/cpp/src/arrow/ipc/CMakeLists.txt @@ -173,5 +173,5 @@ if (ARROW_BUILD_UTILITIES) endif() ADD_ARROW_BENCHMARK(ipc-read-write-benchmark) -ARROW_TEST_LINK_LIBRARIES(ipc-read-write-benchmark +ARROW_BENCHMARK_LINK_LIBRARIES(ipc-read-write-benchmark ${ARROW_IPC_TEST_LINK_LIBS})