Skip to content

Commit

Permalink
更新 vcpkg使用方式;
Browse files Browse the repository at this point in the history
  • Loading branch information
RealChuan committed Apr 15, 2024
1 parent acd42c3 commit 185196b
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 88 deletions.
34 changes: 16 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,14 @@ jobs:
- "Release"
generators:
- "Ninja"
vcpkg_libs:
- glog breakpad benchmark gtest openssl[tools] curl[openssl,brotli,c-ares,http2,tool]

steps:
- name: Restore windows vcpkg
if: startsWith(matrix.os, 'windows')
uses: actions/cache/restore@v3
with:
path: C:\vcpkg\installed
key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}
- name: Restore macos or ubuntu vcpkg
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
uses: actions/cache/restore@v3
with:
path: /usr/local/share/vcpkg/installed
key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}

- name: Install dependencies on windows
if: startsWith(matrix.os, 'windows')
run: |
choco install ninja
ninja --version
cmake --version
vcpkg install ${{ matrix.vcpkg_libs }} --triplet x64-windows
- name: Install dependencies on macos
if: startsWith(matrix.os, 'macos')
shell: bash
Expand All @@ -70,7 +54,6 @@ jobs:
ninja --version
cmake --version
clang --version
vcpkg install ${{ matrix.vcpkg_libs }} --triplet x64-osx
- name: Install dependencies on ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
Expand All @@ -79,12 +62,27 @@ jobs:
ninja --version
cmake --version
gcc --version
vcpkg install ${{ matrix.vcpkg_libs }} --triplet x64-linux
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Update vcpkg manifest baseline
shell: bash
run: |
vcpkg x-update-baseline
- name: Cache vcpkg
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/build/vcpkg_installed
key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-vcpkg-installed-${{ matrix.os }}-
${{ runner.os }}-vcpkg-installed-
${{ runner.os }}-
save-always: true

- name: Enable Developer Command Prompt
if: startsWith(matrix.os, 'windows')
uses: ilammy/[email protected]
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/clean_cache.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: Cleanup caches by a branch
on:
# 每周一 0 点触发
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 12.x
node-version: 20.x
# ISO Langusge Codes: https://cloud.google.com/translate/docs/languages
- name: Adding README - English
uses: dephraiim/translate-readme@main
Expand Down
65 changes: 0 additions & 65 deletions .github/workflows/toolchain.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif()

# 设定工程名
project(
Cpp-Example
Cpp-Examples
VERSION 0.1
LANGUAGES C CXX)

Expand Down
29 changes: 29 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "cpp-examples",
"version": "0.0.1",
"description": "manifest",
"dependencies": [
"glog",
"breakpad",
"benchmark",
"gtest",
{
"name": "openssl",
"features": [
"tools"
]
},
{
"name": "curl",
"features": [
"openssl",
"brotli",
"c-ares",
"http2",
"tool"
]
}
],
"builtin-baseline": "3c76dc55f8bd2b7f4824bcd860055094bfbbb9ea"
}

0 comments on commit 185196b

Please sign in to comment.