Skip to content

Commit 098cd6b

Browse files
mwtoewskbevers
authored andcommitted
AppVeyor: use Ninja generator, cache vcpkg [skip travis]
1 parent a551cab commit 098cd6b

File tree

2 files changed

+68
-17
lines changed

2 files changed

+68
-17
lines changed

appveyor.yml

+24-17
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,46 @@ environment:
77

88
# VS 2015
99
- platform: x86
10-
VS_VERSION: Visual Studio 14
1110
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
1211
BUILD_SHARED_LIBS: OFF
1312

1413
# VS 2017
1514
- platform: x64
16-
VS_VERSION: Visual Studio 15
1715
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
1816
BUILD_SHARED_LIBS: ON
1917

2018
shallow_clone: true
2119

20+
cache:
21+
- C:\Tools\vcpkg\installed\ -> appveyor.yml
22+
2223
build_script:
23-
- echo build_script
24-
- git clone https://github.com/microsoft/vcpkg
25-
- cd vcpkg
26-
- bootstrap-vcpkg.bat
27-
- set PATH=%CD%;%PATH%
28-
- cd ..
29-
- vcpkg install sqlite3[core,tool]:"%platform%"-windows
30-
- vcpkg install tiff:"%platform%"-windows
31-
- vcpkg install curl:"%platform%"-windows
32-
- if "%platform%" == "x64" SET VS_FULL=%VS_VERSION% Win64
33-
- if "%platform%" == "x86" SET VS_FULL=%VS_VERSION%
34-
- echo "%VS_FULL%"
24+
- set VCPKG_INSTALLED=C:\Tools\vcpkg\installed\%platform%-windows
25+
# If cached directory does not exist, update vcpkg and install dependencies
26+
- if not exist %VCPKG_INSTALLED%\bin (
27+
cd "C:\Tools\vcpkg" &
28+
git pull > nul &
29+
.\bootstrap-vcpkg.bat -disableMetrics &
30+
vcpkg install sqlite3[core,tool]:"%platform%"-windows &
31+
vcpkg install tiff:"%platform%"-windows &
32+
vcpkg install curl:"%platform%"-windows &
33+
cd %APPVEYOR_BUILD_FOLDER%
34+
)
35+
- dir %VCPKG_INSTALLED%\bin
36+
- set PATH=%VCPKG_INSTALLED%\bin;%PATH%
37+
# See https://www.appveyor.com/docs/lang/cpp/
38+
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if %platform%==x86
39+
(call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86)
40+
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017"
41+
(call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" %platform% )
3542
#
3643
- set PROJ_BUILD=%APPVEYOR_BUILD_FOLDER%\build
3744
- mkdir %PROJ_BUILD%
3845
- cd %PROJ_BUILD%
3946
- set PROJ_DIR=%APPVEYOR_BUILD_FOLDER%\proj_dir
40-
- cmake -G "%VS_FULL%" .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS="%BUILD_SHARED_LIBS%" -DCMAKE_C_FLAGS="/WX" -DCMAKE_CXX_FLAGS="/WX" -DCMAKE_TOOLCHAIN_FILE=C:/projects/proj/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX="%PROJ_DIR%"
41-
- cmake --build . --config Release --target install
42-
- copy c:\projects\proj\vcpkg\installed\"%platform%"-windows\bin\*.dll %PROJ_DIR%\bin
47+
- cmake -GNinja .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS="%BUILD_SHARED_LIBS%" -DCMAKE_C_FLAGS="/WX" -DCMAKE_CXX_FLAGS="/WX" -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX="%PROJ_DIR%"
48+
- ninja -v
49+
- ninja install
4350
- dir %PROJ_DIR%\bin
4451

4552
test_script:

test/postinstall/test_cmake.bat

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@echo off
2+
:: Post-install tests with CMake
3+
::
4+
:: First required argument is the installed prefix, which
5+
:: is used to set CMAKE_PREFIX_PATH
6+
7+
echo Running post-install tests with CMake
8+
9+
set CMAKE_PREFIX_PATH=%1
10+
if not defined CMAKE_PREFIX_PATH (
11+
echo First positional argument CMAKE_PREFIX_PATH required
12+
exit /B 1
13+
)
14+
15+
echo CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%
16+
17+
cd %~dp0
18+
19+
cd testappprojinfo
20+
del /f /q build 2> nul
21+
22+
:: Check CMake project name PROJ
23+
md build
24+
cd build
25+
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ^
26+
-DCMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH% ^
27+
-DUSE_PROJ_NAME=PROJ .. || exit /B 2
28+
ninja -v || exit /B 3
29+
ctest -VV || exit /B 4
30+
cd ..
31+
del /f /q build
32+
33+
:: Check legacy CMake project name PROJ4
34+
md build
35+
cd build
36+
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ^
37+
-DCMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH% ^
38+
-DUSE_PROJ_NAME=PROJ4 .. || exit /B 2
39+
ninja -v || exit /B 3
40+
ctest -VV || exit /B 4
41+
cd ..
42+
del /f /q build
43+
44+
cd ..

0 commit comments

Comments
 (0)