forked from fanvanzh/3dtiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
109 lines (103 loc) · 3.09 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
extern crate cc;
use std::fs;
use std::env;
use std::process::{Command, Stdio};
fn build_win_msvc() {
cc::Build::new()
.cpp(true)
.flag("-Zi")
.flag("-Gm")
.flag("-INCREMENTAL")
.warnings(false)
.define("WIN32", None)
.define("_WINDOWS",None)
.include("./src")
.include("./src/osg")
.file("./src/tileset.cpp")
.file("./src/shp23dtile.cpp")
.file("./src/osgb23dtile.cpp")
.file("./src/dxt_img.cpp")
.file("./src/make_gltf.cpp")
.compile("3dtile");
// -------------
println!("cargo:rustc-link-search=native=./lib");
// -------------
println!("cargo:rustc-link-lib=gdal_i");
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_win_gun() {
cc::Build::new()
.cpp(true)
.flag("-std=c++11")
.warnings(false)
.define("WIN32", None)
.include("./src")
.include("./src/osg")
.file("./src/tileset.cpp")
.file("./src/shp23dtile.cpp")
.file("./src/osgb23dtile.cpp")
.file("./src/dxt_img.cpp")
.file("./src/make_gltf.cpp")
.compile("3dtile");
// -------------
println!("cargo:rustc-link-search=native=./lib");
// -------------
println!("cargo:rustc-link-lib=gdal_i");
println!("cargo:rustc-link-lib=osg");
println!("cargo:rustc-link-lib=osgDB");
println!("cargo:rustc-link-lib=osgUtil");
println!("cargo:rustc-link-lib=OpenThreads");
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() {
cc::Build::new()
.cpp(true)
.flag("-std=c++11")
.warnings(false)
.include("./src")
.include("./src/osg")
.file("./src/tileset.cpp")
.file("./src/shp23dtile.cpp")
.file("./src/osgb23dtile.cpp")
.file("./src/dxt_img.cpp")
.file("./src/make_gltf.cpp")
.compile("3dtile");
// -------------
println!("cargo:rustc-link-search=native=./lib");
// -------------
println!("cargo:rustc-link-lib=gdal");
println!("cargo:rustc-link-lib=OpenThreads");
println!("cargo:rustc-link-lib=osg");
println!("cargo:rustc-link-lib=osgDB");
println!("cargo:rustc-link-lib=osgUtil");
}
fn main() {
use std::env;
match env::var("TARGET") {
Ok(val) => {
match val.as_str() {
"x86_64-pc-windows-gnu" => build_win_gun(),
"x86_64-unknown-linux-gnu" => build_linux_unkonw(),
"x86_64-pc-windows-msvc" => build_win_msvc(),
&_ => {}
}
}
_ => {}
}
}