Skip to content

Commit

Permalink
ARROW-17433: [CI][C++] Use Visual Studio 2019 on AppVeyor (apache#13903)
Browse files Browse the repository at this point in the history
We can use /external:I for Boost to suppress warnings from Boost
with Visual Studio 2019 or later.


Lead-authored-by: Sutou Kouhei <[email protected]>
Co-authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
  • Loading branch information
kou and pitrou authored Aug 25, 2022
1 parent 04d2403 commit 897c186
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 105 deletions.
33 changes: 11 additions & 22 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# under the License.

# Operating system (build VM template)
os: Visual Studio 2017
os: Visual Studio 2019

only_commits:
# Skip commits not related to Python or C++
Expand All @@ -36,35 +36,24 @@ matrix:

environment:
global:
# Make these variables visible in all jobs and build steps
MSVC_DEFAULT_OPTIONS: ON
APPVEYOR_SAVE_CACHE_ON_ERROR: true
MSVC_DEFAULT_OPTIONS: ON

# Change the clcache dir to reset caches everywhere when a setting
# is changed incompatibly (e.g. CLCACHE_COMPRESS).
CLCACHE_DIR: C:\Users\Appveyor\clcache1
CLCACHE_SERVER: 1
CLCACHE_COMPRESS: 1
CLCACHE_COMPRESSLEVEL: 6
ARROW_BUILD_FLIGHT: "OFF"
ARROW_BUILD_FLIGHT_SQL: "OFF"
ARROW_BUILD_GANDIVA: "OFF"
ARROW_LLVM_VERSION: "7.0.*"
ARROW_S3: "OFF"
PYTHON: "3.8"
ARCH: "64"

matrix:
# NOTE: clcache seems to work best with Ninja and worst with msbuild
# (as generated by cmake)
- JOB: "Toolchain"
GENERATOR: Ninja
ARROW_GCS: "ON"
ARROW_S3: "ON"
ARROW_BUILD_FLIGHT: "ON"
ARROW_BUILD_FLIGHT_SQL: "ON"
ARROW_BUILD_GANDIVA: "ON"
- JOB: "Build_Debug"
GENERATOR: Ninja
ARCH: "64"
ARROW_BUILD_FLIGHT: "ON"
ARROW_BUILD_FLIGHT_SQL: "ON"
ARROW_BUILD_GANDIVA: "ON"
ARROW_GCS: "ON"
ARROW_S3: "ON"
GENERATOR: Ninja
PYTHON: "3.8"

before_build:
- call ci\appveyor-cpp-setup.bat
Expand Down
41 changes: 2 additions & 39 deletions ci/appveyor-cpp-build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -31,51 +31,13 @@ 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
@rem library because of PARQUET-1420 (Thrift-generated symbols not exported in DLL).
@rem
if "%JOB%" == "Build_Debug" (
mkdir cpp\build-debug
pushd cpp\build-debug

cmake -G "%GENERATOR%" ^
-DARROW_BOOST_USE_SHARED=OFF ^
-DARROW_BUILD_EXAMPLES=ON ^
-DARROW_BUILD_STATIC=OFF ^
-DARROW_BUILD_TESTS=ON ^
-DARROW_CXXFLAGS="/MP" ^
-DARROW_ENABLE_TIMING_TESTS=OFF ^
-DARROW_USE_PRECOMPILED_HEADERS=OFF ^
-DARROW_VERBOSE_THIRDPARTY_BUILD=OFF ^
-DCMAKE_BUILD_TYPE="Debug" ^
-DCMAKE_UNITY_BUILD=ON ^
.. || exit /B

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

@rem Finish Debug build successfully
exit /B 0
)

call activate arrow

@rem Use Boost from Anaconda
set BOOST_ROOT=%CONDA_PREFIX%\Library
set BOOST_LIBRARYDIR=%CONDA_PREFIX%\Library\lib

@rem The "main" C++ build script for Windows CI
@rem (i.e. for usual configurations)

if "%JOB%" == "Toolchain" (
set CMAKE_ARGS=-DARROW_DEPENDENCY_SOURCE=CONDA -DARROW_WITH_BZ2=ON
) else (
@rem We're in a conda environment but don't want to use it for the dependencies
set CMAKE_ARGS=-DARROW_DEPENDENCY_SOURCE=AUTO
)
set CMAKE_ARGS=-DARROW_DEPENDENCY_SOURCE=CONDA -DARROW_WITH_BZ2=ON

@rem Enable warnings-as-errors
set ARROW_CXXFLAGS=/WX /MP
Expand Down Expand Up @@ -119,6 +81,7 @@ cmake -G "%GENERATOR%" %CMAKE_ARGS% ^
-DCMAKE_BUILD_TYPE="Release" ^
-DCMAKE_CXX_COMPILER=clcache ^
-DCMAKE_CXX_FLAGS_RELEASE="/MD /Od /UNDEBUG" ^
-DCMAKE_CXX_STANDARD=17 ^
-DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
-DCMAKE_UNITY_BUILD=ON ^
-DCMAKE_VERBOSE_MAKEFILE=OFF ^
Expand Down
54 changes: 21 additions & 33 deletions ci/appveyor-cpp-setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

@echo on

set "PATH=C:\Miniconda37-x64;C:\Miniconda37-x64\Scripts;C:\Miniconda37-x64\Library\bin;%PATH%"
set BOOST_ROOT=C:\Libraries\boost_1_67_0
set BOOST_LIBRARYDIR=C:\Libraries\boost_1_67_0\lib64-msvc-14.0
set "PATH=C:\Miniconda38-x64;C:\Miniconda38-x64\Scripts;C:\Miniconda38-x64\Library\bin;%PATH%"

@rem
@rem Avoid picking up AppVeyor-installed OpenSSL (linker errors with gRPC)
Expand All @@ -31,6 +29,8 @@ rd /s /q C:\OpenSSL-v11-Win32
rd /s /q C:\OpenSSL-v11-Win64
rd /s /q C:\OpenSSL-v111-Win32
rd /s /q C:\OpenSSL-v111-Win64
rd /s /q C:\OpenSSL-v30-Win32
rd /s /q C:\OpenSSL-v30-Win64

@rem
@rem Configure miniconda
Expand All @@ -52,47 +52,35 @@ conda install -q -y -c conda-forge mamba python=3.9 || exit /B
mamba update -q -y -c conda-forge --all || exit /B

@rem
@rem Create conda environment for Build and Toolchain jobs
@rem Create conda environment
@rem
@rem Avoid Boost 1.70 because of https://github.com/boostorg/process/issues/85

set CONDA_PACKAGES=

if "%ARROW_BUILD_GANDIVA%" == "ON" (
@rem Install llvmdev in the toolchain if building gandiva.dll
set CONDA_PACKAGES=%CONDA_PACKAGES% --file=ci\conda_env_gandiva_win.txt
)
if "%JOB%" == "Toolchain" (
@rem Install pre-built "toolchain" packages for faster builds
set CONDA_PACKAGES=%CONDA_PACKAGES% --file=ci\conda_env_cpp.txt
)
if "%JOB%" NEQ "Build_Debug" (
@rem Arrow conda environment is only required for the Build and Toolchain jobs
mamba create -n arrow -q -y -c conda-forge ^
--file=ci\conda_env_python.txt ^
%CONDA_PACKAGES% ^
"cmake" ^
"ninja" ^
"nomkl" ^
"pandas" ^
"fsspec" ^
"python=%PYTHON%" ^
|| exit /B
)
@rem Install pre-built "toolchain" packages for faster builds
set CONDA_PACKAGES=%CONDA_PACKAGES% --file=ci\conda_env_cpp.txt
@rem Arrow conda environment
mamba create -n arrow -q -y -c conda-forge ^
--file=ci\conda_env_python.txt ^
%CONDA_PACKAGES% ^
"cmake" ^
"ninja" ^
"nomkl" ^
"pandas" ^
"fsspec" ^
"python=%PYTHON%" ^
|| exit /B

@rem
@rem Configure compiler
@rem
if "%GENERATOR%"=="Ninja" set need_vcvarsall=1
if defined need_vcvarsall (
if "%APPVEYOR_BUILD_WORKER_IMAGE%" NEQ "Visual Studio 2017" (
@rem ARROW-14070 Visual Studio 2015 no longer supported
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
)
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
set CC=cl.exe
set CXX=cl.exe

@rem
@rem Use clcache for faster builds
Expand All @@ -109,7 +97,7 @@ powershell.exe -Command "Start-Process clcache-server" || exit /B
@rem Download Minio somewhere on PATH, for unit tests
@rem
if "%ARROW_S3%" == "ON" (
appveyor DownloadFile https://dl.min.io/server/minio/release/windows-amd64/archive/minio.RELEASE.2022-05-26T05-48-41Z -FileName C:\Windows\Minio.exe || exit /B
appveyor DownloadFile https://dl.min.io/server/minio/release/windows-amd64/archive/minio.RELEASE.2022-05-26T05-48-41Z -FileName C:\Windows\Minio.exe || exit /B
)


Expand Down
5 changes: 2 additions & 3 deletions ci/conda_env_gandiva_win.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
# specific language governing permissions and limitations
# under the License.

# llvmdev=9 or later require Visual Studio 2017
clangdev=8
llvmdev=8
clangdev
llvmdev
7 changes: 3 additions & 4 deletions cpp/src/gandiva/gdv_function_stubs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -754,14 +754,13 @@ GANDIVA_EXPORT
gdv_timestamp from_utc_timezone_timestamp(gdv_int64 context,
gdv_timestamp time_miliseconds,
const char* timezone, gdv_int32 length) {
using arrow_vendored::date::make_zoned;
using arrow_vendored::date::sys_time;
using arrow_vendored::date::zoned_time;
using std::chrono::milliseconds;

sys_time<milliseconds> tp{milliseconds{time_miliseconds}};
const auto utc_tz = make_zoned(std::string("Etc/UTC"), tp);
const sys_time<milliseconds> tp{milliseconds{time_miliseconds}};
try {
const auto local_tz = make_zoned(std::string(timezone, length), utc_tz);
const zoned_time<milliseconds> local_tz{std::string(timezone, length), tp};
gdv_timestamp offset = local_tz.get_time_zone()->get_info(tp).offset.count() * 1000;
return time_miliseconds + static_cast<gdv_timestamp>(offset);
} catch (...) {
Expand Down
12 changes: 8 additions & 4 deletions cpp/src/gandiva/precompiled/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ set(PRECOMPILED_SRCS
../../arrow/util/basic_decimal.cc)

if(MSVC)
# clang pretends to be a particular version of MSVC. 191[0-9] is
# Visual Studio 2017, and the standard library uses C++14 features,
# so we have to use that -std version to get the IR compilation to work
if(MSVC_VERSION MATCHES "^191[0-9]$")
# clang pretends to be a particular version of MSVC. Thestandard
# library uses C++14 features, so we have to use that -std version
# to get the IR compilation to work.
# See https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
# for MSVC_VERSION and Visual Studio version.
if(MSVC_VERSION LESS 1930)
set(FMS_COMPATIBILITY 19.20)
elseif(MSVC_VERSION LESS 1920)
set(FMS_COMPATIBILITY 19.10)
else()
message(FATAL_ERROR "Unsupported MSVC_VERSION=${MSVC_VERSION}")
Expand Down

0 comments on commit 897c186

Please sign in to comment.