Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ if(APPLE)
endif()
endif()

if(WIN32 AND NOT MINGW)
# This is used to handle builds using e.g. clang in an MSVC setting.
set(MSVC_TOOLCHAIN TRUE)
else()
set(MSVC_TOOLCHAIN FALSE)
endif()

find_package(ClangTools)
find_package(InferTools)
if("$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" STREQUAL "1" OR CLANG_TIDY_FOUND OR INFER_FOUND)
Expand Down Expand Up @@ -343,7 +350,7 @@ if(ARROW_PYTHON)
set(ARROW_JSON ON)
endif()

if(MSVC)
if(MSVC_TOOLCHAIN)
# ORC doesn't build on windows
set(ARROW_ORC OFF)
# Plasma using glog is not fully tested on windows.
Expand Down Expand Up @@ -741,7 +748,7 @@ add_dependencies(arrow_test_dependencies toolchain-tests)
if(ARROW_STATIC_LINK_LIBS)
add_dependencies(arrow_dependencies ${ARROW_STATIC_LINK_LIBS})
if(ARROW_ORC)
if(NOT MSVC)
if(NOT MSVC_TOOLCHAIN)
list(APPEND ARROW_STATIC_LINK_LIBS ${CMAKE_DL_LIBS})
list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${CMAKE_DL_LIBS})
endif()
Expand All @@ -755,7 +762,7 @@ if(((ARROW_FLIGHT OR ARROW_S3) AND (ARROW_BUILD_TESTS OR ARROW_BUILD_INTEGRATION
list(APPEND ARROW_TEST_LINK_LIBS ${BOOST_FILESYSTEM_LIBRARY} ${BOOST_SYSTEM_LIBRARY})
endif()

if(NOT MSVC)
if(NOT MSVC_TOOLCHAIN)
list(APPEND ARROW_LINK_LIBS ${CMAKE_DL_LIBS})
list(APPEND ARROW_SHARED_INSTALL_INTERFACE_LIBS ${CMAKE_DL_LIBS})
endif()
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake_modules/BuildUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ function(ADD_ARROW_LIB LIB_NAME)
target_include_directories(${LIB_NAME}_static PRIVATE ${ARG_PRIVATE_INCLUDES})
endif()

if(MSVC)
if(MSVC_TOOLCHAIN)
set(LIB_NAME_STATIC ${LIB_NAME}_static)
else()
set(LIB_NAME_STATIC ${LIB_NAME})
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
"Build with support for Unicode properties using the utf8proc library" ON)

#----------------------------------------------------------------------
if(MSVC)
if(MSVC_TOOLCHAIN)
set_option_category("MSVC")

define_option(MSVC_LINK_VERBOSE
Expand Down
13 changes: 10 additions & 3 deletions cpp/cmake_modules/FindArrow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ endif()
include(FindPkgConfig)
include(FindPackageHandleStandardArgs)

if(WIN32 AND NOT MINGW)
# This is used to handle builds using e.g. clang in an MSVC setting.
set(MSVC_TOOLCHAIN TRUE)
else()
set(MSVC_TOOLCHAIN FALSE)
endif()

set(ARROW_SEARCH_LIB_PATH_SUFFIXES)
if(CMAKE_LIBRARY_ARCHITECTURE)
list(APPEND ARROW_SEARCH_LIB_PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
Expand All @@ -61,7 +68,7 @@ if(CMAKE_BUILD_TYPE)
endif()

if(NOT DEFINED ARROW_MSVC_STATIC_LIB_SUFFIX)
if(MSVC)
if(MSVC_TOOLCHAIN)
set(ARROW_MSVC_STATIC_LIB_SUFFIX "_static")
else()
set(ARROW_MSVC_STATIC_LIB_SUFFIX "")
Expand Down Expand Up @@ -147,7 +154,7 @@ macro(arrow_find_package_home)
set(include_dir "${${prefix}_include_dir}")
set(${prefix}_INCLUDE_DIR "${include_dir}" PARENT_SCOPE)

if(MSVC)
if(MSVC_TOOLCHAIN)
set(CMAKE_SHARED_LIBRARY_SUFFIXES_ORIGINAL ${CMAKE_FIND_LIBRARY_SUFFIXES})
# .dll isn't found by find_library with MSVC because .dll isn't included in
# CMAKE_FIND_LIBRARY_SUFFIXES.
Expand All @@ -158,7 +165,7 @@ macro(arrow_find_package_home)
PATHS "${home}"
PATH_SUFFIXES ${ARROW_SEARCH_LIB_PATH_SUFFIXES}
NO_DEFAULT_PATH)
if(MSVC)
if(MSVC_TOOLCHAIN)
set(CMAKE_SHARED_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_ORIGINAL})
endif()
set(shared_lib "${${prefix}_shared_lib}")
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake_modules/FindBoostAlt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ endif()

if(Boost_FOUND)
set(BoostAlt_FOUND ON)
if(MSVC)
if(MSVC_TOOLCHAIN)
# disable autolinking in boost
add_definitions(-DBOOST_ALL_NO_LIB)
if(ARROW_BOOST_USE_SHARED)
Expand Down
4 changes: 2 additions & 2 deletions cpp/cmake_modules/FindGTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ if(NOT DEFINED GTEST_MSVC_SEARCH)
endif()

set(_gtest_libpath_suffixes lib)
if(MSVC)
if(MSVC_TOOLCHAIN)
if(GTEST_MSVC_SEARCH STREQUAL "MD")
list(APPEND _gtest_libpath_suffixes
msvc/gtest-md/Debug
Expand All @@ -198,7 +198,7 @@ find_path(GTEST_INCLUDE_DIR gtest/gtest.h
)
mark_as_advanced(GTEST_INCLUDE_DIR)

if(MSVC AND GTEST_MSVC_SEARCH STREQUAL "MD")
if(MSVC_TOOLCHAIN AND GTEST_MSVC_SEARCH STREQUAL "MD")
# The provided /MD project files for Google Test add -md suffixes to the
# library names.
__gtest_find_library(GTEST_LIBRARY gtest-md gtest)
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake_modules/FindLz4.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

if(MSVC AND NOT DEFINED LZ4_MSVC_LIB_PREFIX)
if(MSVC_TOOLCHAIN AND NOT DEFINED LZ4_MSVC_LIB_PREFIX)
set(LZ4_MSVC_LIB_PREFIX "lib")
endif()
set(LZ4_LIB_NAME_BASE "${LZ4_MSVC_LIB_PREFIX}lz4")
Expand Down
4 changes: 2 additions & 2 deletions cpp/cmake_modules/FindThrift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function(EXTRACT_THRIFT_VERSION)
endif()
endfunction(EXTRACT_THRIFT_VERSION)

if(MSVC AND NOT DEFINED THRIFT_MSVC_LIB_SUFFIX)
if(MSVC_TOOLCHAIN AND NOT DEFINED THRIFT_MSVC_LIB_SUFFIX)
if(NOT ARROW_THRIFT_USE_SHARED)
if(ARROW_USE_STATIC_CRT)
set(THRIFT_MSVC_LIB_SUFFIX "mt")
Expand Down Expand Up @@ -133,7 +133,7 @@ if(Thrift_FOUND OR THRIFT_FOUND)
set_target_properties(thrift::thrift
PROPERTIES IMPORTED_LOCATION "${THRIFT_LIB}"
INTERFACE_INCLUDE_DIRECTORIES "${THRIFT_INCLUDE_DIR}")
if(WIN32 AND NOT MSVC)
if(WIN32 AND NOT MSVC_TOOLCHAIN)
# We don't need this for Visual C++ because Thrift uses
# "#pragma comment(lib, "Ws2_32.lib")" in
# thrift/windows/config.h for Visual C++.
Expand Down
4 changes: 2 additions & 2 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ endif()
set(EP_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}}")
set(EP_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}}")

if(NOT MSVC)
if(NOT MSVC_TOOLCHAIN)
# Set -fPIC on all external projects
set(EP_CXX_FLAGS "${EP_CXX_FLAGS} -fPIC")
set(EP_C_FLAGS "${EP_C_FLAGS} -fPIC")
Expand Down Expand Up @@ -1348,7 +1348,7 @@ if(ARROW_WITH_PROTOBUF)
endif()
resolve_dependency(Protobuf REQUIRED_VERSION ${ARROW_PROTOBUF_REQUIRED_VERSION})

if(ARROW_PROTOBUF_USE_SHARED AND MSVC)
if(ARROW_PROTOBUF_USE_SHARED AND MSVC_TOOLCHAIN)
add_definitions(-DPROTOBUF_USE_DLLS)
endif()

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ if(ARROW_ORC)
list(APPEND ARROW_SRCS adapters/orc/adapter.cc adapters/orc/adapter_util.cc)
endif()

if(NOT APPLE AND NOT MSVC)
if(NOT APPLE AND NOT MSVC_TOOLCHAIN)
# Localize thirdparty symbols using a linker version script. This hides them
# from the client application. The OS X linker does not support the
# version-script option.
Expand Down
22 changes: 11 additions & 11 deletions cpp/src/arrow/python/type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ struct npy_traits<NPY_FLOAT32> {
using TypeClass = FloatType;
using BuilderClass = FloatBuilder;

static constexpr float na_sentinel = NAN;
static constexpr float na_sentinel = std::numeric_limits<float>::quiet_NaN();

static constexpr bool supports_nulls = true;

Expand All @@ -118,7 +118,7 @@ struct npy_traits<NPY_FLOAT64> {
using TypeClass = DoubleType;
using BuilderClass = DoubleBuilder;

static constexpr double na_sentinel = NAN;
static constexpr double na_sentinel = std::numeric_limits<double>::quiet_NaN();

static constexpr bool supports_nulls = true;

Expand Down Expand Up @@ -178,13 +178,13 @@ struct arrow_traits<Type::BOOL> {
typedef typename npy_traits<NPY_BOOL>::value_type T;
};

#define INT_DECL(TYPE) \
template <> \
struct arrow_traits<Type::TYPE> { \
static constexpr int npy_type = NPY_##TYPE; \
static constexpr bool supports_nulls = false; \
static constexpr double na_value = NAN; \
typedef typename npy_traits<NPY_##TYPE>::value_type T; \
#define INT_DECL(TYPE) \
template <> \
struct arrow_traits<Type::TYPE> { \
static constexpr int npy_type = NPY_##TYPE; \
static constexpr bool supports_nulls = false; \
static constexpr double na_value = std::numeric_limits<double>::quiet_NaN(); \
typedef typename npy_traits<NPY_##TYPE>::value_type T; \
};

INT_DECL(INT8);
Expand All @@ -208,15 +208,15 @@ template <>
struct arrow_traits<Type::FLOAT> {
static constexpr int npy_type = NPY_FLOAT32;
static constexpr bool supports_nulls = true;
static constexpr float na_value = NAN;
static constexpr float na_value = std::numeric_limits<float>::quiet_NaN();
typedef typename npy_traits<NPY_FLOAT32>::value_type T;
};

template <>
struct arrow_traits<Type::DOUBLE> {
static constexpr int npy_type = NPY_FLOAT64;
static constexpr bool supports_nulls = true;
static constexpr double na_value = NAN;
static constexpr double na_value = std::numeric_limits<double>::quiet_NaN();
typedef typename npy_traits<NPY_FLOAT64>::value_type T;
};

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/gandiva/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ endif()
# set(GANDIVA_SHARED_LINK_FLAGS "${GANDIVA_SHARED_LINK_FLAGS} /EXPORT:${SYMBOL}")
# endforeach()
# endif()
if(NOT APPLE AND NOT MSVC)
if(NOT APPLE AND NOT MSVC_TOOLCHAIN)
# Localize thirdparty symbols using a linker version script. This hides them
# from the client application. The OS X linker does not support the
# version-script option.
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/parquet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ if(NOT PARQUET_MINIMAL_DEPENDENCY)

endif(NOT PARQUET_MINIMAL_DEPENDENCY)

if(NOT APPLE AND NOT MSVC)
if(NOT APPLE AND NOT MSVC_TOOLCHAIN)
# Localize thirdparty symbols using a linker version script. This hides them
# from the client application. The OS X linker does not support the
# version-script option.
Expand Down
14 changes: 11 additions & 3 deletions cpp/src/parquet/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,17 @@ class ParquetStatusException : public ParquetException {
// This class exists for the purpose of detecting an invalid or corrupted file.
class ParquetInvalidOrCorruptedFileException : public ParquetStatusException {
public:
template <typename... Args>
explicit ParquetInvalidOrCorruptedFileException(Args&&... args)
: ParquetStatusException(::arrow::Status::Invalid(std::forward<Args>(args)...)) {}
ParquetInvalidOrCorruptedFileException(const ParquetInvalidOrCorruptedFileException&) =
default;

template <typename Arg,
typename std::enable_if<
!std::is_base_of<ParquetInvalidOrCorruptedFileException, Arg>::value,
int>::type = 0,
typename... Args>
explicit ParquetInvalidOrCorruptedFileException(Arg arg, Args&&... args)
: ParquetStatusException(::arrow::Status::Invalid(std::forward<Arg>(arg),
std::forward<Args>(args)...)) {}
};

template <typename StatusReturnBlock>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/plasma/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ if(ARROW_CUDA)
add_definitions(-DPLASMA_CUDA)
endif()

if(NOT APPLE AND NOT MSVC)
if(NOT APPLE AND NOT MSVC_TOOLCHAIN)
# Localize thirdparty symbols using a linker version script. This hides them
# from the client application. The OS X linker does not support the
# version-script option.
Expand Down