Skip to content

Apache DataFusion SQL Query Engine

ARROW-1220: [C++] Cmake script errors out if lib is not found under *…

Max Risuhin615a863d3d0c
diff --git a/appveyor.yml b/appveyor.yml
index f3ce5a5443..c58e1dab7d 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -20,22 +20,31 @@ os: Visual Studio 2015
environment:
matrix:
- - GENERATOR: NMake Makefiles
+ - JOB: "Cmake_Script_Tests"
+ GENERATOR: NMake Makefiles
PYTHON: "3.5"
ARCH: "64"
CONFIGURATION: "Release"
- - GENERATOR: Visual Studio 14 2015 Win64
+ - JOB: "Build"
+ GENERATOR: NMake Makefiles
+ PYTHON: "3.5"
+ ARCH: "64"
+ CONFIGURATION: "Release"
+ - JOB: "Build_Debug"
+ GENERATOR: Visual Studio 14 2015 Win64
PYTHON: "3.5"
ARCH: "64"
CONFIGURATION: "Debug"
- - GENERATOR: Visual Studio 14 2015 Win64
+ - JOB: "Build"
+ GENERATOR: Visual Studio 14 2015 Win64
PYTHON: "3.5"
ARCH: "64"
CONFIGURATION: "Release"
- - GENERATOR: Visual Studio 14 2015 Win64
+ - JOB: "Toolchain"
+ GENERATOR: Visual Studio 14 2015 Win64
PYTHON: "3.5"
ARCH: "64"
- CONFIGURATION: "Toolchain"
+ CONFIGURATION: "Release"
MSVC_DEFAULT_OPTIONS: ON
BOOST_ROOT: C:\Libraries\boost_1_63_0
@@ -49,4 +58,5 @@ init:
build_script:
- git config core.symlinks true
- git reset --hard
- - call ci\msvc-build.bat
+ - if "%JOB%"=="Cmake_Script_Tests" call ci\test-cmake-build-script.bat
+ - if NOT "%JOB%"=="Cmake_Script_Tests" call ci\msvc-build.bat
diff --git a/ci/msvc-build.bat b/ci/msvc-build.bat
index c84d12d97d..be5fd7b35f 100644
--- a/ci/msvc-build.bat
+++ b/ci/msvc-build.bat
@@ -17,13 +17,13 @@
@echo on
-if "%CONFIGURATION%" == "Debug" (
+if "%JOB%" == "Build_Debug" (
mkdir cpp\build-debug
pushd cpp\build-debug
cmake -G "%GENERATOR%" ^
-DARROW_BOOST_USE_SHARED=OFF ^
- -DCMAKE_BUILD_TYPE=Debug ^
+ -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
-DARROW_CXXFLAGS="/MP" ^
.. || exit /B
@@ -39,7 +39,7 @@ conda update --yes --quiet conda
conda create -n arrow -q -y python=%PYTHON% ^
six pytest setuptools numpy pandas cython
-if "%CONFIGURATION%" == "Toolchain" (
+if "%JOB%" == "Toolchain" (
conda install -n arrow -q -y -c conda-forge ^
flatbuffers rapidjson cmake git boost-cpp ^
thrift-cpp snappy zlib brotli gflags lz4-c zstd
@@ -47,7 +47,7 @@ if "%CONFIGURATION%" == "Toolchain" (
call activate arrow
-if "%CONFIGURATION%" == "Toolchain" (
+if "%JOB%" == "Toolchain" (
set ARROW_BUILD_TOOLCHAIN=%CONDA_PREFIX%\Library
)
@@ -61,11 +61,11 @@ pushd cpp\build
cmake -G "%GENERATOR%" ^
-DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
-DARROW_BOOST_USE_SHARED=OFF ^
- -DCMAKE_BUILD_TYPE=Release ^
+ -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
-DARROW_CXXFLAGS="/WX /MP" ^
-DARROW_PYTHON=ON ^
.. || exit /B
-cmake --build . --target INSTALL --config Release || exit /B
+cmake --build . --target INSTALL --config %CONFIGURATION% || exit /B
@rem Needed so python-test.exe works
set PYTHONPATH=%CONDA_PREFIX%\Lib;%CONDA_PREFIX%\Lib\site-packages;%CONDA_PREFIX%\python35.zip;%CONDA_PREFIX%\DLLs;%CONDA_PREFIX%;%PYTHONPATH%
@@ -83,11 +83,11 @@ set PARQUET_BUILD_TOOLCHAIN=%CONDA_PREFIX%\Library
set PARQUET_HOME=%CONDA_PREFIX%\Library
cmake -G "%GENERATOR%" ^
-DCMAKE_INSTALL_PREFIX=%PARQUET_HOME% ^
- -DCMAKE_BUILD_TYPE=Release ^
+ -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
-DPARQUET_BOOST_USE_SHARED=OFF ^
-DPARQUET_ZLIB_VENDORED=off ^
-DPARQUET_BUILD_TESTS=off .. || exit /B
-cmake --build . --target INSTALL --config Release || exit /B
+cmake --build . --target INSTALL --config %CONFIGURATION% || exit /B
popd
@rem Build and import pyarrow
diff --git a/ci/test-cmake-build-script.bat b/ci/test-cmake-build-script.bat
new file mode 100644
index 0000000000..e37a811773
--- /dev/null
+++ b/ci/test-cmake-build-script.bat
@@ -0,0 +1,113 @@
+@rem Licensed to the Apache Software Foundation (ASF) under one
+@rem or more contributor license agreements. See the NOTICE file
+@rem distributed with this work for additional information
+@rem regarding copyright ownership. The ASF licenses this file
+@rem to you under the Apache License, Version 2.0 (the
+@rem "License"); you may not use this file except in compliance
+@rem with the License. You may obtain a copy of the License at
+@rem
+@rem http://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing,
+@rem software distributed under the License is distributed on an
+@rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@rem KIND, either express or implied. See the License for the
+@rem specific language governing permissions and limitations
+@rem under the License.
+
+@echo on
+
+conda update --yes --quiet conda
+conda create -n arrow-cmake-script-tests -q -y
+conda install -n arrow-cmake-script-tests -q -y -c conda-forge ^
+cmake git boost-cpp
+call activate arrow-cmake-script-tests
+
+mkdir cpp\build-cmake-test
+pushd cpp\build-cmake-test
+
+echo Test cmake script errors out on flatbuffers missed
+set FLATBUFFERS_HOME=WrongPath
+
+cmake -G "%GENERATOR%" ^
+ -DARROW_BOOST_USE_SHARED=OFF ^
+ -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+ -DARROW_CXXFLAGS="/MP" ^
+ .. >nul 2>error.txt
+
+FINDSTR /M /C:"Could not find the Flatbuffers library" error.txt || exit /B
+set FLATBUFFERS_HOME=
+
+echo Test cmake script errors out on gflags missed
+set GFLAGS_HOME=WrongPath
+
+cmake -G "%GENERATOR%" ^
+ -DARROW_BOOST_USE_SHARED=OFF ^
+ -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+ -DARROW_CXXFLAGS="/MP" ^
+ .. >nul 2>error.txt
+
+FINDSTR /M /C:"No static or shared library provided for gflags" error.txt || exit /B
+set GFLAGS_HOME=
+
+echo Test cmake script errors out on snappy missed
+set SNAPPY_HOME=WrongPath
+
+cmake -G "%GENERATOR%" ^
+ -DARROW_BOOST_USE_SHARED=OFF ^
+ -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+ -DARROW_CXXFLAGS="/MP" ^
+ .. >nul 2>error.txt
+
+FINDSTR /M /C:"Could not find the Snappy library" error.txt || exit /B
+set SNAPPY_HOME=
+
+echo Test cmake script errors out on zlib missed
+set ZLIB_HOME=WrongPath
+
+cmake -G "%GENERATOR%" ^
+ -DARROW_BOOST_USE_SHARED=OFF ^
+ -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+ -DARROW_CXXFLAGS="/MP" ^
+ .. >nul 2>error.txt
+
+FINDSTR /M /C:"Could not find the ZLIB library" error.txt || exit /B
+set ZLIB_HOME=
+
+echo Test cmake script errors out on brotli missed
+set BROTLI_HOME=WrongPath
+
+cmake -G "%GENERATOR%" ^
+ -DARROW_BOOST_USE_SHARED=OFF ^
+ -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+ -DARROW_CXXFLAGS="/MP" ^
+ .. >nul 2>error.txt
+
+FINDSTR /M /C:"Could not find the Brotli library" error.txt || exit /B
+set BROTLI_HOME=
+
+echo Test cmake script errors out on lz4 missed
+set LZ4_HOME=WrongPath
+
+cmake -G "%GENERATOR%" ^
+ -DARROW_BOOST_USE_SHARED=OFF ^
+ -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+ -DARROW_CXXFLAGS="/MP" ^
+ .. >nul 2>error.txt
+
+FINDSTR /M /C:"No static or shared library provided for lz4_static" error.txt || exit /B
+set LZ4_HOME=
+
+echo Test cmake script errors out on zstd missed
+set ZSTD_HOME=WrongPath
+
+cmake -G "%GENERATOR%" ^
+ -DARROW_BOOST_USE_SHARED=OFF ^
+ -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
+ -DARROW_CXXFLAGS="/MP" ^
+ .. >nul 2>error.txt
+
+FINDSTR /M /C:"Could NOT find ZSTD" error.txt || exit /B
+set ZSTD_HOME=
+
+popd