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
9 changes: 6 additions & 3 deletions ci/appveyor-cpp-build.bat
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,6 +28,9 @@ set PARQUET_TEST_DATA=%CD%\cpp\submodules\parquet-testing\data

set ARROW_DEBUG_MEMORY_POOL=trap

set CMAKE_BUILD_PARALLEL_LEVEL=%NUMBER_OF_PROCESSORS%
set CTEST_PARALLEL_LEVEL=%NUMBER_OF_PROCESSORS%

@rem
@rem In the configurations below we disable building the Arrow static library
@rem to save some time. Unfortunately this will still build the Parquet static
Expand All@@ -51,7 +54,7 @@ if "%JOB%" == "Build_Debug" (
.. || exit /B

cmake --build . --config Debug || exit /B
ctest --output-on-failure -j2 || exit /B
ctest --output-on-failure || exit /B
popd

@rem Finish Debug build successfully
Expand DownExpand Up@@ -121,13 +124,13 @@ cmake -G "%GENERATOR%" %CMAKE_ARGS% ^
-DPARQUET_BUILD_EXECUTABLES=ON ^
-DPARQUET_REQUIRE_ENCRYPTION=ON ^
.. || exit /B
cmake --build . --target install --config %CONFIGURATION% || exit /B
cmake --build . --target install --config Release || exit /B

@rem Needed so arrow-python-test.exe works
set OLD_PYTHONHOME=%PYTHONHOME%
set PYTHONHOME=%CONDA_PREFIX%

ctest --output-on-failure -j2 || exit /B
ctest --output-on-failure || exit /B

set PYTHONHOME=%OLD_PYTHONHOME%
popd
Expand Down
12 changes: 4 additions & 8 deletions ci/appveyor-cpp-setup.bat
Original file line numberDiff line numberDiff line change
Expand Up@@ -71,19 +71,13 @@ if "%JOB%" NEQ "Build_Debug" (
mamba create -n arrow -q -y -c conda-forge ^
--file=ci\conda_env_python.txt ^
%CONDA_PACKAGES% ^
"cmake=3.17" ^
"cmake" ^
"ninja" ^
"nomkl" ^
"pandas" ^
"fsspec" ^
"python=%PYTHON%" ^
|| exit /B

@rem On Windows, GTest is always bundled from source instead of using
@rem conda binaries, avoid any interference between the two versions.
if "%JOB%" == "Toolchain" (
mamba uninstall -n arrow -q -y -c conda-forge gtest || exit /B
)
)

@rem
Expand All@@ -96,6 +90,8 @@ if defined need_vcvarsall (
exit /B
)
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
set CC=cl.exe
set CXX=cl.exe
)

@rem
Expand DownExpand Up@@ -128,4 +124,4 @@ move tzdata %USERPROFILE%\Downloads\tzdata
@rem Also need Windows timezone mapping
curl https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xml ^
--output %USERPROFILE%\Downloads\tzdata\windowsZones.xml
@rem (Doc section: Download timezone database)
@rem (Doc section: Download timezone database)
2 changes: 1 addition & 1 deletion cpp/cmake_modules/BuildUtils.cmake
Original file line numberDiff line numberDiff line change
Expand Up@@ -382,7 +382,7 @@ function(ADD_ARROW_LIB LIB_NAME)
set(LIB_NAME_STATIC ${LIB_NAME})
endif()

if(ARROW_BUILD_STATIC AND WIN32)
if(WIN32)
target_compile_definitions(${LIB_NAME}_static PUBLIC ARROW_STATIC)
target_compile_definitions(${LIB_NAME}_static PUBLIC ARROW_FLIGHT_STATIC)
endif()
Expand Down
49 changes: 17 additions & 32 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line numberDiff line numberDiff line change
Expand Up@@ -1972,8 +1972,6 @@ macro(build_gtest)
-DCMAKE_MACOSX_RPATH=OFF)
set(GMOCK_INCLUDE_DIR "${GTEST_PREFIX}/include")

add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1)

if(MSVC AND NOT ARROW_USE_STATIC_CRT)
set(GTEST_CMAKE_ARGS ${GTEST_CMAKE_ARGS} -Dgtest_force_shared_crt=ON)
endif()
Expand DownExpand Up@@ -2031,6 +2029,8 @@ macro(build_gtest)
add_library(GTest::gtest SHARED IMPORTED)
set_target_properties(GTest::gtest
PROPERTIES ${_GTEST_IMPORTED_TYPE} "${GTEST_SHARED_LIB}"
INTERFACE_COMPILE_DEFINITIONS
"GTEST_LINKED_AS_SHARED_LIBRARY=1"
INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIR}")

add_library(GTest::gtest_main SHARED IMPORTED)
Expand All@@ -2041,6 +2041,8 @@ macro(build_gtest)
add_library(GTest::gmock SHARED IMPORTED)
set_target_properties(GTest::gmock
PROPERTIES ${_GTEST_IMPORTED_TYPE} "${GMOCK_SHARED_LIB}"
INTERFACE_COMPILE_DEFINITIONS
"GMOCK_LINKED_AS_SHARED_LIBRARY=1"
INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIR}")
add_dependencies(toolchain-tests googletest_ep)
add_dependencies(GTest::gtest googletest_ep)
Expand All@@ -2049,40 +2051,23 @@ macro(build_gtest)
endmacro()

if(ARROW_TESTING)
if(CMAKE_VERSION VERSION_LESS 3.23)
set(GTEST_USE_CONFIG TRUE)
else()
set(GTEST_USE_CONFIG FALSE)
endif()
# We can't find shred library version of GoogleTest on Windows with
# Conda's gtest package because it doesn't provide GTestConfig.cmake
# provided by GoogleTest and CMake's built-in FindGTtest.cmake
# doesn't support gtest_dll.dll. If we find static library version
# of GoogleTest and ARROW_BUILD_SHARED=ON/ARROW_BUILD_STATIC=OFF are
# specified, we need to build arrow_flight_testing as a static
# library. See cpp/src/arrow/flight/CMakeLists.txt for details.
resolve_dependency(GTest
REQUIRED_VERSION
1.10.0
USE_CONFIG
TRUE)

if(NOT GTEST_VENDORED)
# TODO(wesm): This logic does not work correctly with the MSVC static libraries
# built for the shared crt

# set(CMAKE_REQUIRED_LIBRARIES GTest::GTest GTest::Main GTest::GMock)
# CHECK_CXX_SOURCE_COMPILES("
# #include <gmock/gmock.h>
# #include <gtest/gtest.h>

# class A {
# public:
# int run() const { return 1; }
# };

# class B : public A {
# public:
# MOCK_CONST_METHOD0(run, int());
# };

# TEST(Base, Test) {
# B b;
# }" GTEST_COMPILES_WITHOUT_MACRO)
# if (NOT GTEST_COMPILES_WITHOUT_MACRO)
# message(STATUS "Setting GTEST_LINKED_AS_SHARED_LIBRARY=1 on GTest::GTest")
# add_compile_definitions("GTEST_LINKED_AS_SHARED_LIBRARY=1")
# endif()
# set(CMAKE_REQUIRED_LIBRARIES)
endif()
${GTEST_USE_CONFIG})
endif()

macro(build_benchmark)
Expand Down
14 changes: 0 additions & 14 deletions cpp/src/arrow/CMakeLists.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -754,20 +754,6 @@ endif()

if(ARROW_FLIGHT)
add_subdirectory(flight)

if(ARROW_WITH_UCX)
add_subdirectory(flight/transport/ucx)
endif()
endif()

if(ARROW_FLIGHT_SQL)
add_subdirectory(flight/sql)
endif()

if(ARROW_FLIGHT
AND ARROW_FLIGHT_SQL
AND ARROW_BUILD_INTEGRATION)
add_subdirectory(flight/integration_tests)
endif()

if(ARROW_HIVESERVER2)
Expand Down
100 changes: 75 additions & 25 deletions cpp/src/arrow/flight/CMakeLists.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,27 +25,52 @@ if(WIN32)
list(APPEND ARROW_FLIGHT_LINK_LIBS ws2_32.lib)
endif()

set(ARROW_FLIGHT_TEST_LINKAGE
"${ARROW_TEST_LINKAGE}"
PARENT_SCOPE)
set(ARROW_FLIGHT_TEST_LINKAGE "${ARROW_TEST_LINKAGE}")
if(Protobuf_USE_STATIC_LIBS)
message(STATUS "Linking Arrow Flight tests statically due to static Protobuf")
set(ARROW_FLIGHT_TEST_LINKAGE
"static"
PARENT_SCOPE)
set(ARROW_FLIGHT_TEST_LINKAGE "static")
endif()
if(NOT ARROW_GRPC_USE_SHARED)
message(STATUS "Linking Arrow Flight tests statically due to static gRPC")
set(ARROW_FLIGHT_TEST_LINKAGE
"static"
PARENT_SCOPE)
set(ARROW_FLIGHT_TEST_LINKAGE "static")
endif()
if(ARROW_TESTING)
if(WIN32)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully this can be removed next in @lidavidm 's PR.

# We need to use the same library type for arrow_flight_testing
# and Google Test because arrow_flight_testing has
# arrow::flight:FlightTest that inherits testing::Test. If
# arrow_flight_testing's library type and gtest's library type are
# different such as arrow_flight_testing is a shared library and
# gtest is a static library, link error is occurred.
get_target_property(GTEST_TYPE GTest::gtest TYPE)
if(GTEST_TYPE STREQUAL "SHARED_LIBRARY")
set(ARROW_FLIGHT_TESTING_BUILD_SHARED TRUE)
set(ARROW_FLIGHT_TESTING_BUILD_STATIC FALSE)
else()
set(ARROW_FLIGHT_TESTING_BUILD_SHARED FALSE)
set(ARROW_FLIGHT_TESTING_BUILD_STATIC TRUE)
message(STATUS "Linking Arrow Flight tests statically due to static GTest")
set(ARROW_FLIGHT_TEST_LINKAGE "static")
endif()
else()
set(ARROW_FLIGHT_TESTING_BUILD_SHARED ${ARROW_BUILD_SHARED})
set(ARROW_FLIGHT_TESTING_BUILD_STATIC ${ARROW_BUILD_STATIC})
endif()
endif()

set(ARROW_FLIGHT_TEST_INTERFACE_LIBS)
if(ARROW_FLIGHT_TEST_LINKAGE STREQUAL "static")
set(ARROW_FLIGHT_TEST_LINK_LIBS
arrow_flight_static arrow_flight_testing_static ${ARROW_FLIGHT_STATIC_LINK_LIBS}
${ARROW_TEST_LINK_LIBS})
if(ARROW_BUILD_STATIC)
set(ARROW_FLIGHT_TEST_LINK_LIBS arrow_flight_static)
else()
set(ARROW_FLIGHT_TEST_LINK_LIBS arrow_flight_shared)
endif()
if(ARROW_FLIGHT_TESTING_BUILD_STATIC)
list(APPEND ARROW_FLIGHT_TEST_LINK_LIBS arrow_flight_testing_static)
else()
list(APPEND ARROW_FLIGHT_TEST_LINK_LIBS arrow_flight_testing_shared)
endif()
list(APPEND ARROW_FLIGHT_TEST_LINK_LIBS ${ARROW_TEST_LINK_LIBS})
if(ARROW_CUDA)
list(APPEND ARROW_FLIGHT_TEST_INTERFACE_LIBS arrow_cuda_static)
list(APPEND ARROW_FLIGHT_TEST_LINK_LIBS arrow_cuda_static)
Expand All@@ -65,11 +90,7 @@ list(APPEND
Boost::system
GTest::gtest
GTest::gmock)

# Needed for Flight SQL and integration
set(ARROW_FLIGHT_TEST_LINK_LIBS
${ARROW_FLIGHT_TEST_LINK_LIBS}
PARENT_SCOPE)
list(APPEND ARROW_FLIGHT_TEST_LINK_LIBS gRPC::grpc++)

# TODO(wesm): Protobuf shared vs static linking

Expand DownExpand Up@@ -239,7 +260,30 @@ endforeach()

# Define arrow_flight_testing library
if(ARROW_TESTING)
if(ARROW_BUILD_SHARED AND ARROW_BUILD_STATIC)
set(ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS arrow_shared arrow_flight_shared)
set(ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS arrow_static arrow_flight_static)
elseif(ARROW_BUILD_SHARED)
set(ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS arrow_shared arrow_flight_shared)
set(ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS arrow_shared arrow_flight_shared)
else()
set(ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS arrow_static arrow_flight_static)
set(ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS arrow_static arrow_flight_static)
endif()
if(ARROW_TEST_LINKAGE STREQUAL "shared")
list(APPEND ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS arrow_testing_shared)
list(APPEND ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS arrow_testing_shared)
else()
list(APPEND ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS arrow_testing_static)
list(APPEND ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS arrow_testing_static)
endif()
list(APPEND ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS ${ARROW_FLIGHT_TEST_INTERFACE_LIBS})
list(APPEND ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS ${ARROW_FLIGHT_TEST_INTERFACE_LIBS})
add_arrow_lib(arrow_flight_testing
BUILD_SHARED
${ARROW_FLIGHT_TESTING_BUILD_SHARED}
BUILD_STATIC
${ARROW_FLIGHT_TESTING_BUILD_STATIC}
CMAKE_PACKAGE_NAME
ArrowFlightTesting
PKG_CONFIG_NAME
Expand All@@ -254,15 +298,9 @@ if(ARROW_TESTING)
flight_grpc_gen
arrow_dependencies
SHARED_LINK_LIBS
arrow_shared
arrow_flight_shared
arrow_testing_shared
${ARROW_FLIGHT_TEST_INTERFACE_LIBS}
${ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS}
STATIC_LINK_LIBS
arrow_static
arrow_flight_static
arrow_testing_static
${ARROW_FLIGHT_TEST_INTERFACE_LIBS}
${ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS}
PRIVATE_INCLUDES
"${Protobuf_INCLUDE_DIRS}")

Expand DownExpand Up@@ -328,3 +366,15 @@ if(ARROW_BUILD_BENCHMARKS)
endif()
endif()
endif(ARROW_BUILD_BENCHMARKS)

if(ARROW_WITH_UCX)
add_subdirectory(transport/ucx)
endif()

if(ARROW_FLIGHT_SQL)
add_subdirectory(sql)

if(ARROW_BUILD_INTEGRATION)
add_subdirectory(integration_tests)
endif()
endif()
25 changes: 12 additions & 13 deletions cpp/src/arrow/flight/integration_tests/CMakeLists.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,27 +17,26 @@

add_custom_target(arrow_flight_integration_tests)

if(ARROW_FLIGHT_TEST_LINKAGE STREQUAL "static")
set(ARROW_FLIGHT_TEST_LINK_LIBS
arrow_flight_static
arrow_flight_testing_static
arrow_flight_sql_static
${ARROW_FLIGHT_STATIC_LINK_LIBS}
${ARROW_FLIGHT_TEST_LINK_LIBS})
if(ARROW_FLIGHT_TEST_LINKAGE STREQUAL "static" AND ARROW_BUILD_STATIC)
set(ARROW_FLIGHT_INTEGRATION_TEST_LINK_LIBS arrow_flight_sql_static)
else()
set(ARROW_FLIGHT_TEST_LINK_LIBS arrow_flight_shared arrow_flight_testing_shared
arrow_flight_sql_shared ${ARROW_FLIGHT_TEST_LINK_LIBS})
set(ARROW_FLIGHT_INTEGRATION_TEST_LINK_LIBS arrow_flight_sql_shared)
endif()
list(APPEND
ARROW_FLIGHT_INTEGRATION_TEST_LINK_LIBS
${ARROW_FLIGHT_TEST_LINK_LIBS}
${GFLAGS_LIBRARIES}
GTest::gtest)

add_executable(flight-test-integration-server test_integration_server.cc
test_integration.cc)
target_link_libraries(flight-test-integration-server ${ARROW_FLIGHT_TEST_LINK_LIBS}
${GFLAGS_LIBRARIES} GTest::gtest)
target_link_libraries(flight-test-integration-server
${ARROW_FLIGHT_INTEGRATION_TEST_LINK_LIBS})

add_executable(flight-test-integration-client test_integration_client.cc
test_integration.cc)
target_link_libraries(flight-test-integration-client ${ARROW_FLIGHT_TEST_LINK_LIBS}
${GFLAGS_LIBRARIES} GTest::gtest)
target_link_libraries(flight-test-integration-client
${ARROW_FLIGHT_INTEGRATION_TEST_LINK_LIBS})

add_dependencies(arrow-integration flight-test-integration-client
flight-test-integration-server)
9 changes: 4 additions & 5 deletions cpp/src/arrow/flight/sql/CMakeLists.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -63,13 +63,12 @@ add_arrow_lib(arrow_flight_sql
PRIVATE_INCLUDES
"${Protobuf_INCLUDE_DIRS}")

if(ARROW_FLIGHT_TEST_LINKAGE STREQUAL "static")
set(ARROW_FLIGHT_SQL_TEST_LINK_LIBS arrow_flight_sql_static
${ARROW_FLIGHT_TEST_LINK_LIBS})
if(ARROW_FLIGHT_TEST_LINKAGE STREQUAL "static" AND ARROW_BUILD_STATIC)
set(ARROW_FLIGHT_SQL_TEST_LINK_LIBS arrow_flight_sql_static)
else()
set(ARROW_FLIGHT_SQL_TEST_LINK_LIBS arrow_flight_sql_shared
${ARROW_FLIGHT_TEST_LINK_LIBS})
set(ARROW_FLIGHT_SQL_TEST_LINK_LIBS arrow_flight_sql_shared)
endif()
list(APPEND ARROW_FLIGHT_SQL_TEST_LINK_LIBS ${ARROW_FLIGHT_TEST_LINK_LIBS})

# Build test server for unit tests
if(ARROW_BUILD_TESTS OR ARROW_BUILD_EXAMPLES)
Expand Down
4 changes: 0 additions & 4 deletions dev/release/verify-release-candidate.bat
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,10 +69,6 @@ call conda create --no-shortcuts -c conda-forge -f -q -y -p %_VERIFICATION_CONDA

call activate %_VERIFICATION_CONDA_ENV% || exit /B 1

@rem With MSVC we always bundle a more recent GTest which causes a link conflict
@rem for more context, see https://issues.apache.org/jira/browse/ARROW-15378
call conda remove -y gtest gmock || exit /B 1

set GENERATOR=Visual Studio 16 2019
set ARCHITECTURE=x64
set CONFIGURATION=release
Expand Down
Loading