Skip to content

Commit

Permalink
vcpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
fanvanzh committed May 22, 2024
1 parent d3962d6 commit f800971
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ jobs:
if: runner.os == 'Windows'
run: |
if (-Not (Test-Path "./vcpkg")) {
git clone https://github.com/Microsoft/vcpkg.git
git clone https://github.com/microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.bat
./vcpkg/vcpkg integrate install
./vcpkg/vcpkg install osg
./vcpkg/vcpkg install gdal
./vcpkg/vcpkg install osg:x64-windows
./vcpkg/vcpkg install gdal:x64-windows
}
else {
Write-Host "vcpkg directory exists. Skipping installation."
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Introduction

[![glTF status](https://img.shields.io/badge/glTF-2%2E0-green.svg?style=flat)](https://github.com/KhronosGroup/glTF)
[![Action status](https://github.com/fanvanzh/3dtiles/actions/workflows/rust.yml/badge.svg)](https://github.com/fanvanzh/3dtiles/actions/workflows/rust.yml)
[![Action status](https://github.com/fanvanzh/3dtiles/actions/workflows/build.yml/badge.svg)](https://github.com/fanvanzh/3dtiles/actions/workflows/build.yml)

Tools for 3D-Tiles convertion.

Expand Down Expand Up @@ -38,11 +38,19 @@ cargo build --release
```
## Centos
```
yum install -y gdal-devel cargo g++
git clone https://github.com/microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh
./vcpkg/vcpkg install osg
cargo build --release
```
## Windows
```
git clone https://github.com/microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.bat
./vcpkg/vcpkg install osg:x64-windows
./vcpkg/vcpkg install gdal:x64-windows
cargo build --release
```
# Usage

Expand Down
18 changes: 4 additions & 14 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,22 @@ fn build_win_msvc() {
.define("WIN32", None)
.define("_WINDOWS", None)
.include("./src")
.include("./vcpkg/installed/x64-windows/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=./lib");
println!("cargo:rustc-link-search=native=./vcpkg/installed/x64-windows/lib");
// -------------
println!("cargo:rustc-link-lib=gdal_i");
println!("cargo:rustc-link-lib=OpenThreads");
println!("cargo:rustc-link-lib=osg");
println!("cargo:rustc-link-lib=osgDB");
println!("cargo:rustc-link-lib=osgUtil");
println!("cargo:rustc-link-lib=osgViewer");

Command::new("cmd")
.args(&[
"/C",
"xcopy",
r#".\bin"#,
&format!(r#".\target\{}"#, env::var("PROFILE").unwrap()),
"/y",
"/e",
])
.stdout(Stdio::inherit())
.output()
.unwrap();
}

fn build_linux_unkonw() {
Expand All @@ -49,6 +37,7 @@ fn build_linux_unkonw() {
.flag("-std=c++11")
.warnings(false)
.include("./src")
.include("./vcpkg/installed/x64-linux/include")
.file("./src/tileset.cpp")
.file("./src/shp23dtile.cpp")
.file("./src/osgb23dtile.cpp")
Expand All @@ -57,6 +46,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-lib=OpenThreads");
println!("cargo:rustc-link-lib=osg");
Expand Down

0 comments on commit f800971

Please sign in to comment.