Skip to content

Commit 13299d2

Browse files
committed
Factor into a -sys crate and build libui ourselves
1 parent 1ed47da commit 13299d2

File tree

23 files changed

+1065
-280
lines changed

23 files changed

+1065
-280
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "ui-sys/libui"]
2+
path = ui-sys/libui
3+
url = https://github.com/andlabs/libui
File renamed without changes.
File renamed without changes.

ui/README.md renamed to README.md

File renamed without changes.

ui-sys/Cargo.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "ui-sys"
3+
version = "0.1.0"
4+
authors = ["Patrick Walton <[email protected]>"]
5+
build = "build.rs"
6+
license = "MIT/Apache 2.0"
7+
description = "Native bindings to the minimalist, cross-platform, widget set `libui`"
8+
9+
[dependencies]
10+
libc = "0.2"
11+
12+
[build-dependencies]
13+
make-cmd = "0.1"
14+

ui-sys/build.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
extern crate make_cmd;
2+
3+
use std::env;
4+
use std::path::Path;
5+
use std::process::Command;
6+
7+
fn main() {
8+
if !Path::new("libui/.git").exists() {
9+
Command::new("git").args(&["submodule", "update", "--init"]).status().unwrap();
10+
}
11+
12+
let out_dir = env::var("OUT_DIR").unwrap();
13+
let outdir_argument = format!("OUTDIR={}", out_dir);
14+
let objdir_argument = format!("OBJDIR={}/obj", out_dir);
15+
make_cmd::gnu_make().args(&["-C", "libui", &*outdir_argument, &*objdir_argument])
16+
.status()
17+
.unwrap();
18+
19+
println!("cargo:rustc-link-lib=dylib=ui");
20+
println!("cargo:rustc-link-search=native={}", out_dir);
21+
}
22+

ui-sys/libui

Submodule libui added at 156c358
File renamed without changes.

0 commit comments

Comments
 (0)