From 414d049f86ed905d0f3c34a77044fec0d706205d Mon Sep 17 00:00:00 2001 From: cyjseagull Date: Tue, 22 Oct 2024 20:43:06 +0800 Subject: [PATCH] update vcpkg (#40) --- .github/workflows/workflow.yml | 36 +++++++++++++++++++++++++++++----- CMakeLists.txt | 8 +++++--- vcpkg | 2 +- vcpkg-configuration.json | 4 ++-- 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 868f2c9..eafcbd0 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -26,6 +26,10 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 5 + - name: Prepare vcpkg + if: runner.os != 'Windows' + uses: friendlyanon/setup-vcpkg@v1 + with: { committish: 51b14cd4e1230dd51c11ffeff6f7d53c61cc5297 } - uses: actions/cache@v2 id: cache with: @@ -33,6 +37,12 @@ jobs: /home/runner/vcpkg /Users/runner/vcpkg/ ccache + deps/ + c:/vcpkg + !c:/vcpkg/.git + !c:/vcpkg/buildtrees + !c:/vcpkg/packages + !c:/vcpkg/downloads key: vcpkg-clang-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} restore-keys: | vcpkg-clang-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} @@ -49,11 +59,12 @@ jobs: run: export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) && CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake . -DTESTS=ON - name: configure if: runner.os == 'Linux' - run: CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake . -DTESTS=ON + run: CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake . -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake -DTESTS=ON - name: compile run: make -j2 - name: run test run: CTEST_OUTPUT_ON_FAILURE=TRUE make test ARGS="--output-on-failure" + build_with_gcc: name: build_with_gcc runs-on: ${{ matrix.os }} @@ -64,10 +75,23 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 5 + - name: Prepare vcpkg + if: runner.os != 'Windows' + uses: friendlyanon/setup-vcpkg@v1 + with: { committish: 51b14cd4e1230dd51c11ffeff6f7d53c61cc5297 } - uses: actions/cache@v2 id: cache with: - path: /home/runner/vcpkg + path: | + /home/runner/vcpkg + /Users/runner/vcpkg/ + ccache + deps/ + c:/vcpkg + !c:/vcpkg/.git + !c:/vcpkg/buildtrees + !c:/vcpkg/packages + !c:/vcpkg/downloads key: vcpkg-gcc-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} restore-keys: | vcpkg-gcc-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} @@ -85,7 +109,7 @@ jobs: - name: install Ubuntu dependencies run: sudo apt install -y git curl build-essential cmake ccache lcov - name: configure - run: cmake . -DTESTS=ON -DCOVERAGE=ON -DDEBUG=on + run: cmake . -DTESTS=ON -DCOVERAGE=ON -DDEBUG=on -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake - name: compile run: make -j2 - name: run test @@ -97,6 +121,7 @@ jobs: with: file: ./coverage.info name: bcos-utilities coverage + build_with_centos: name: build_with_centos runs-on: ubuntu-latest @@ -131,6 +156,7 @@ jobs: cmake3 . -DTESTS=ON make -j2 CTEST_OUTPUT_ON_FAILURE=TRUE make test ARGS="--output-on-failure" + build_with_windows: name: build_with_windows runs-on: ${{ matrix.os }} @@ -138,7 +164,7 @@ jobs: matrix: os: [windows-2019] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 5 - uses: actions/cache@v2 @@ -163,7 +189,7 @@ jobs: uses: microsoft/setup-msbuild@v1.1 - name: configure if: runner.os == 'Windows' - run: mkdir -p build && cd build && cmake -G "Visual Studio 16 2019" -A x64 ../ + run: mkdir -p build && cd build && cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake ../ - name: compile run: cd build && MSBuild /version && MSBuild bcos-utilities.sln /p:Configuration=Release /p:Platform=x64 diff --git a/CMakeLists.txt b/CMakeLists.txt index 73c8acd..0a1eb9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,9 +30,11 @@ include(Options) configure_project() # vcpkg init -find_package(Git REQUIRED) -execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) -set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") +if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) + find_package(Git REQUIRED) + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") +endif() project(bcos-utilities VERSION "1.0.0") diff --git a/vcpkg b/vcpkg index 0719a71..51b14cd 160000 --- a/vcpkg +++ b/vcpkg @@ -1 +1 @@ -Subproject commit 0719a71389654b88d827501d88e37e58ea8cbd70 +Subproject commit 51b14cd4e1230dd51c11ffeff6f7d53c61cc5297 diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index 4ef7375..9e5f00f 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -3,7 +3,7 @@ { "kind": "git", "repository": "https://github.com/FISCO-BCOS/registry", - "baseline": "3765dfb347d9fc820cfad9005b2f87d0755895ec", + "baseline": "b483a0287c6ee7017983942af540e3ee672b0994", "packages": [ "tbb", "boost-beast", @@ -11,4 +11,4 @@ ] } ] - } \ No newline at end of file + }