-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.rs
40 lines (38 loc) · 1.88 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
extern crate embed_resource;
use std::env;
use std::path::PathBuf;
fn main() {
let target = env::var("TARGET").unwrap();
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
if target.contains("android") {
// Build for Android
println!("cargo:rustc-link-search={}", out_dir.join("lib").display());
println!("cargo:rustc-link-lib=static=SDL2");
println!("cargo:rustc-link-lib=static=SDL2main");
println!("cargo:rustc-link-lib=dylib=GLESv1_CM");
println!("cargo:rustc-link-lib=dylib=GLESv2");
println!("cargo:rustc-link-lib=dylib=log");
} else if target.contains("apple-ios") {
// Build for iOS
println!("cargo:rustc-link-search={}", out_dir.join("lib").display());
println!("cargo:rustc-link-lib=framework=OpenGLES");
println!("cargo:rustc-link-lib=framework=AudioToolbox");
println!("cargo:rustc-link-lib=framework=CoreAudio");
println!("cargo:rustc-link-lib=framework=CoreGraphics");
println!("cargo:rustc-link-lib=framework=CoreMotion");
println!("cargo:rustc-link-lib=framework=Foundation");
println!("cargo:rustc-link-lib=framework=GameController");
println!("cargo:rustc-link-lib=framework=Metal");
println!("cargo:rustc-link-lib=framework=QuartzCore");
println!("cargo:rustc-link-lib=framework=UIKit");
} else if target.contains("windows") {
// Windows specific configuration
println!("cargo:rustc-link-search=native={}", out_dir.display());
println!("cargo:rustc-link-lib=dylib=SDL2");
embed_resource::compile("config/app.rc", embed_resource::NONE);
} else if target.contains("darwin") {
// macOS specific configuration
println!("cargo:rustc-link-search=native={}", out_dir.display());
println!("cargo:rustc-link-lib=framework=SDL2");
}
}