Skip to content

Commit

Permalink
x64-windows-release
Browse files Browse the repository at this point in the history
  • Loading branch information
fanvanzh committed May 23, 2024
1 parent 79c0296 commit d07ddbe
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Linux
name: Ubuntu

on: [push]
jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install dependencies on Ubuntu
if: runner.os == 'Linux'
Expand Down
28 changes: 12 additions & 16 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ 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")
.file("./src/dxt_img.cpp")
.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 --------
Expand All @@ -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")
Expand All @@ -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");
Expand Down

0 comments on commit d07ddbe

Please sign in to comment.