-
Notifications
You must be signed in to change notification settings - Fork 594
/
build.rs
67 lines (64 loc) · 2.11 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
extern crate cc;
use std::env;
fn build_win_msvc() {
cc::Build::new()
.cpp(true)
.flag("-Zi")
.flag("-INCREMENTAL")
.flag("-bigobj")
.warnings(false)
.define("WIN32", None)
.define("_WINDOWS", None)
.include("./src")
.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-release/lib");
// ------ GDAL library -------
println!("cargo:rustc-link-lib=gdal");
// ------ OSG library --------
println!("cargo:rustc-link-lib=osg");
println!("cargo:rustc-link-lib=osgDB");
println!("cargo:rustc-link-lib=osgUtil");
println!("cargo:rustc-link-lib=osgViewer");
println!("cargo:rustc-link-lib=OpenThreads");
}
fn build_linux_unkonw() {
cc::Build::new()
.cpp(true)
.flag("-std=c++11")
.warnings(false)
.include("./src")
.include("./vcpkg/installed/x64-linux-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=/usr/lib/x86_64-linux-gnu");
println!("cargo:rustc-link-search=native=./vcpkg/installed/x64-linux-release/lib");
// -------------
println!("cargo:rustc-link-lib=osg");
println!("cargo:rustc-link-lib=osgDB");
println!("cargo:rustc-link-lib=osgUtil");
println!("cargo:rustc-link-lib=OpenThreads");
// gdal library
println!("cargo:rustc-link-lib=gdal");
}
fn main() {
match env::var("TARGET") {
Ok(val) => match val.as_str() {
"x86_64-unknown-linux-gnu" => build_linux_unkonw(),
"x86_64-pc-windows-msvc" => build_win_msvc(),
&_ => {}
},
_ => {}
}
}