From d07ddbee40fe570bf018e28590157e9ea15876c6 Mon Sep 17 00:00:00 2001 From: fanvanzh Date: Thu, 23 May 2024 16:07:17 +0800 Subject: [PATCH] x64-windows-release --- .github/workflows/linux.yml | 4 ++-- .github/workflows/windows.yml | 28 ++++++++++++---------------- README.md | 6 +++--- build.rs | 8 ++++---- 4 files changed, 21 insertions(+), 25 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index f161585..c0164d3 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,4 +1,4 @@ -name: Linux +name: Ubuntu on: [push] jobs: @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install dependencies on Ubuntu if: runner.os == 'Linux' diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 1ea44c5..b387a43 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -6,29 +6,25 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@4 - name: Cache dependencies - uses: actions/cache@v2 # 使用actions/cache + uses: actions/cache@v4 + id: cache-vcpkg with: - path: ./vcpkg # 设置缓存目录路径 - key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/build.rs') }} # 设置缓存的key - restore-keys: | # 设置恢复缓存的key列表 + path: ./vcpkg + key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/build.rs') }} + restore-keys: | ${{ runner.os }}-vcpkg- - name: Install dependencies on Windows - if: runner.os == 'Windows' + if: steps.cache-vcpkg.outputs.cache-hit != 'true' run: | - if (-Not (Test-Path "./vcpkg")) { - git clone https://github.com/microsoft/vcpkg.git - ./vcpkg/bootstrap-vcpkg.bat - ./vcpkg/vcpkg install gdal:x64-windows - ./vcpkg/vcpkg install osg:x64-windows - tree ./vcpkg/installed /F /A - } - else { - Write-Host "vcpkg directory exists. Skipping installation." - } + git clone https://github.com/microsoft/vcpkg.git + ./vcpkg/bootstrap-vcpkg.bat + ./vcpkg/vcpkg install gdal:x64-windows-release + ./vcpkg/vcpkg install osg:x64-windows-release + tree ./vcpkg/installed /F /A - name: Build run: cargo build --verbose --release \ No newline at end of file diff --git a/README.md b/README.md index 0d1b48a..0865cbc 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ git clone https://github.com/fanvanzh/3dtiles cd 3dtiles git clone https://github.com/microsoft/vcpkg.git ./vcpkg/bootstrap-vcpkg.sh -./vcpkg/vcpkg install osg +./vcpkg/vcpkg install osg:x64-linux-release cargo build --release ``` ## Windows @@ -52,8 +52,8 @@ git clone https://github.com/fanvanzh/3dtiles cd 3dtiles git clone https://github.com/microsoft/vcpkg.git ./vcpkg/bootstrap-vcpkg.bat -./vcpkg/vcpkg install osg:x64-windows -./vcpkg/vcpkg install gdal:x64-windows +./vcpkg/vcpkg install osg:x64-windows-release +./vcpkg/vcpkg install gdal:x64-windows-release cargo build --release ``` # Usage diff --git a/build.rs b/build.rs index 37f3018..bc55f28 100644 --- a/build.rs +++ b/build.rs @@ -11,7 +11,7 @@ fn build_win_msvc() { .define("WIN32", None) .define("_WINDOWS", None) .include("./src") - .include("./vcpkg/installed/x64-windows/include") + .include("./vcpkg/installed/x64-windows-release/include") .file("./src/tileset.cpp") .file("./src/shp23dtile.cpp") .file("./src/osgb23dtile.cpp") @@ -19,7 +19,7 @@ fn build_win_msvc() { .file("./src/GeoTransform.cpp") .compile("_3dtile"); // ------------- - println!("cargo:rustc-link-search=native=./vcpkg/installed/x64-windows/lib"); + println!("cargo:rustc-link-search=native=./vcpkg/installed/x64-windows-release/lib"); // ------ GDAL library ------- println!("cargo:rustc-link-lib=gdal"); // ------ OSG library -------- @@ -36,7 +36,7 @@ fn build_linux_unkonw() { .flag("-std=c++11") .warnings(false) .include("./src") - .include("./vcpkg/installed/x64-linux/include") + .include("./vcpkg/installed/x64-linux-release/include") .file("./src/tileset.cpp") .file("./src/shp23dtile.cpp") .file("./src/osgb23dtile.cpp") @@ -45,7 +45,7 @@ fn build_linux_unkonw() { .compile("_3dtile"); // ------------- println!("cargo:rustc-link-search=native=/usr/lib/x86_64-linux-gnu"); - println!("cargo:rustc-link-search=native=./vcpkg/installed/x64-linux/lib"); + println!("cargo:rustc-link-search=native=./vcpkg/installed/x64-linux-release/lib"); // ------------- println!("cargo:rustc-link-lib=osg"); println!("cargo:rustc-link-lib=osgDB");