Skip to content

Commit 4668426

Browse files
authored
Merge pull request #846 from ygj6/build
install depends via vcpkg on Windows
2 parents 9e0d87b + b4d28c3 commit 4668426

File tree

1 file changed

+20
-45
lines changed

1 file changed

+20
-45
lines changed

.github/workflows/gha.yml

Lines changed: 20 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -266,69 +266,44 @@ jobs:
266266
pattern: [0, 1, 2, 3]
267267
steps:
268268
- uses: actions/checkout@v1
269-
- name: Cache dependencies
270-
id: cache-depends
271-
uses: actions/cache@v1
269+
- name: Cache vcpkg
270+
id: cache-vcpkg
271+
uses: actions/cache@v1.0.3
272272
with:
273-
path: third_party
274-
key: ${{ runner.os }}-depends
273+
path: C:/vcpkg/installed/x64-windows
274+
key: ${{ runner.os }}-vcpkg
275275
- name: Build dependencies
276-
if: steps.cache-depends.outputs.cache-hit != 'true'
276+
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
277277
shell: powershell
278278
run: |
279-
$CUR=(Get-Location).Path
280-
281-
Invoke-WebRequest -Uri https://github.com/google/googletest/archive/release-1.7.0.zip -OutFile googletest-release-1.7.0.zip
282-
7z x googletest-release-1.7.0.zip
283-
cd googletest-release-1.7.0
284-
md build
285-
cd build
286-
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS="/D_VARIADIC_MAX=10 /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" ..
287-
cmake --build . --config Release
288-
New-Item -ItemType Directory -Path "$CUR\third_party\googletest\lib"
289-
Copy-Item "Release\*" -Destination "$CUR\third_party\googletest\lib"
290-
Copy-Item -Path "..\include" -Destination "$CUR\third_party\googletest" -Recurse
291-
cd ..
292-
cd ..
293-
294-
Invoke-WebRequest -Uri http://zlib.net/zlib-1.2.11.tar.gz -OutFile zlib-1.2.11.tar.gz
295-
7z x zlib-1.2.11.tar.gz
296-
7z x zlib-1.2.11.tar
297-
cd zlib-1.2.11
298-
md build
299-
cd build
300-
cmake -DCMAKE_INSTALL_PREFIX="$CUR\third_party\zlib" ..
301-
cmake --build . --config Release
302-
New-Item -ItemType Directory -Path "$CUR\third_party\zlib\lib"
303-
Copy-Item "Release\*" -Destination "$CUR\third_party\zlib\lib"
304-
Copy-Item "..\zlib.h" -Destination "$CUR\third_party\zlib"
305-
Copy-Item zconf.h -Destination "$CUR\third_party\zlib"
279+
vcpkg install gtest:x64-windows
280+
vcpkg install zlib:x64-windows
306281
- name: Build and test
307282
shell: powershell
308283
run: |
309284
if (${{ matrix.pattern }} -eq 0) {
310-
$CPP11="-DMSGPACK_CXX11=""OFF"""
311-
$BOOST="-DMSGPACK_BOOST=""OFF"""
285+
$CPP11="-DMSGPACK_CXX11=OFF"
286+
$BOOST="-DMSGPACK_BOOST=OFF"
312287
}
313288
if (${{ matrix.pattern }} -eq 1) {
314-
$CPP11="-DMSGPACK_CXX11=""OFF"""
315-
$BOOST="-DMSGPACK_BOOST=""ON"""
289+
$CPP11="-DMSGPACK_CXX11=OFF"
290+
$BOOST="-DMSGPACK_BOOST=ON"
316291
}
317292
if (${{ matrix.pattern }} -eq 2) {
318-
$CPP11="-DMSGPACK_CXX11=""ON"""
319-
$BOOST="-DMSGPACK_BOOST=""OFF"""
293+
$CPP11="-DMSGPACK_CXX11=ON"
294+
$BOOST="-DMSGPACK_BOOST=OFF"
320295
}
321296
if (${{ matrix.pattern }} -eq 3) {
322-
$CPP11="-DMSGPACK_CXX11=""ON"""
323-
$BOOST="-DMSGPACK_BOOST=""ON"""
297+
$CPP11="-DMSGPACK_CXX11=ON"
298+
$BOOST="-DMSGPACK_BOOST=ON"
324299
}
325300
326301
$CUR=(Get-Location).Path
327302
md build
328303
cd build
329-
echo $env:BOOST_ROOT
330-
$env:BOOST_ROOT="$env:Boost_ROOT"
331-
cmake -DBOOST_ROOT="$env:BOOST_ROOT" $CPP11 $BOOST $X3_PARSE -DGTEST_LIBRARY="$CUR\third_party\googletest\lib\gtest.lib" -DGTEST_MAIN_LIBRARY="$CUR\third_party\googletest\lib\gtest_main.lib" -DGTEST_INCLUDE_DIR="$CUR\third_party\googletest\include" -DZLIB_LIBRARY="$CUR\third_party\zlib\lib\zlib.lib" -DZLIB_INCLUDE_DIR="$CUR\third_party\zlib" -DCMAKE_CXX_FLAGS="/D_VARIADIC_MAX=10 /EHsc /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" ..
304+
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" $CPP11 $BOOST "-DCMAKE_CXX_FLAGS=/D_VARIADIC_MAX=10 /EHsc /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" ..
332305
cmake --build . --config Release
333-
$env:PATH="$env:PATH;$CUR\third_party\googletest\lib;$CUR\third_party\zlib\lib;$CUR\build\Release"
306+
$pathbak="$env:PATH"
307+
$env:PATH="C:\vcpkg\installed\x64-windows\bin;$CUR\build\Release;$pathbak"
334308
ctest -V
309+
$env:PATH=$pathbak

0 commit comments

Comments
 (0)