Skip to content

Commit

Permalink
support windows compile
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull committed Oct 22, 2024
1 parent d5549de commit 6840af7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
35 changes: 21 additions & 14 deletions .github/workflows/cpp_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
export GCC='gcc-10'
export CXX='g++-10'
bash cpp/tools/install_depends.sh -o ubuntu
mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../
mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ || cat *.log || cat /Users/runner/work/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/libhdfs3/config-x64-osx-dbg-err.log
make -j3
- name: Build for macos
if: runner.os == 'macOS'
Expand Down Expand Up @@ -101,36 +101,38 @@ jobs:
with:
path: |
deps/
c:/vcpkg
!c:/vcpkg/.git
!c:/vcpkg/buildtrees
!c:/vcpkg/packages
!c:/vcpkg/downloads
${{ env.VCPKG_ROOT }}
${{ env.VCPKG_ROOT }}/.git
${{ env.VCPKG_ROOT }}/buildtrees
${{ env.VCPKG_ROOT }}/packages
${{ env.VCPKG_ROOT }}/downloads
key: build-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
restore-keys: |
build-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
build-${{ matrix.os }}-${{ github.base_ref }}-
build-${{ matrix.os }}-
- name: Add MSbuild to PATH
if: runner.os == 'Windows'
uses: microsoft/[email protected]
- name: Build for windows
if: runner.os == 'Windows'
run: |
mkdir -p cpp/build && cd cpp/build && cmake -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_SDK=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake ../
cmake --build . --parallel 3
mkdir -p cpp/build && cd cpp/build && cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_SDK=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake .. && MSBuild /version && MSBuild wedpr-component.sln /p:Configuration=Release /p:Platform=x64 || cat *.log
- name: Build for linux
if: runner.os == 'Linux'
run: |
sudo apt install -y lcov ccache wget libgmp-dev python3-dev
export GCC='gcc-10'
export CXX='g++-10'
bash cpp/tools/install_depends.sh -o ubuntu
mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=ON -DBUILD_SDK=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../
mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=ON -DBUILD_SDK=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ || cat *.log
make -j3
- name: Build for macos
if: runner.os == 'macOS'
run: |
brew install lcov
bash cpp/tools/install_depends.sh -o macos
mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=OFF -DBUILD_SDK=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../
mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=OFF -DBUILD_SDK=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ || cat *.log
make -j3
- name: Test
if: runner.os == 'macOS'
Expand All @@ -148,9 +150,10 @@ jobs:
- uses: actions/upload-artifact@v4
if: runner.os == 'Windows'
with:
name: libppc-crypto-sdk-jni.dylib
name: libppc-crypto-sdk-jni.dll
path: D:\a\WeDPR-Component\cpp\wedpr-component-sdk\bindings\java\src\main\resources\META-INF\native\Release\ppc-crypto-sdk-jni.dll


build_centos:
name: build_centos full node
runs-on: ${{ matrix.os }}
Expand All @@ -164,13 +167,17 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 5
- uses: actions/setup-node@v4
with:
node-version: 16
cache: 'npm'
- uses: actions/cache@v2
id: deps_cache
with:
path: |
deps/
/home/runner/.ccache
/Users/runner/.ccache/
deps/
key: centos-notest-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
restore-keys: |
centos-notest-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
Expand Down Expand Up @@ -203,8 +210,8 @@ jobs:
. /opt/rh/llvm-toolset-7/enable
mkdir -p cpp/build
cd cpp/build
cmake3 -DCMAKE_BUILD_TYPE=Release -DTESTS=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../
cmake3 --build . --parallel 3
cmake3 -DCMAKE_BUILD_TYPE=Release -DTESTS=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ || cat *.log
cmake3 --build . --parallel 3 || cat *.log
- name: Test
run: |
export OMP_NUM_THREADS=1
Expand Down
8 changes: 7 additions & 1 deletion cpp/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
{
"name": "bcos-utilities",
"version>=": "1.0.0"
}
},
"zlib"
],
"builtin-baseline": "51b14cd4e1230dd51c11ffeff6f7d53c61cc5297",
"overrides": [
Expand Down Expand Up @@ -55,6 +56,11 @@
{
"name": "grpc",
"version": "1.51.1#1"
},
{
"name": "zlib",
"version": "1.2.12",
"port-version": 1
}
],
"features": {
Expand Down

0 comments on commit 6840af7

Please sign in to comment.