Use cargo as a build system instead of makefiles
This commit is contained in:
parent
e3c86e0e37
commit
c05f984698
5
.gitignore
vendored
5
.gitignore
vendored
@ -1 +1,6 @@
|
|||||||
bin/
|
bin/
|
||||||
|
|
||||||
|
|
||||||
|
# Added by cargo
|
||||||
|
|
||||||
|
/target
|
||||||
|
7
Cargo.lock
generated
Normal file
7
Cargo.lock
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "test-raylib-rust"
|
||||||
|
version = "0.1.0"
|
13
Cargo.toml
Normal file
13
Cargo.toml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[package]
|
||||||
|
name = "test-raylib-rust"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
build = "build.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "rect"
|
||||||
|
path = "src/rect.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "bounce"
|
||||||
|
path = "src/bounce.rs"
|
10
Makefile
10
Makefile
@ -1,10 +0,0 @@
|
|||||||
.PHONY: all
|
|
||||||
|
|
||||||
all: rect bounce
|
|
||||||
|
|
||||||
rect: rect.rs
|
|
||||||
rustc -L./raylib/ -lraylib $< -o bin/$@
|
|
||||||
|
|
||||||
bounce: bounce.rs
|
|
||||||
rustc -L./raylib/ -lraylib $< -o bin/$@
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
|||||||
# Rust and raylib playground
|
# Rust and raylib playground
|
||||||
|
|
||||||
A sample project to play with rust, raylib, and rust/c interoperability
|
A sample project to play with rust, raylib, and rust/c interoperability
|
||||||
|
|
||||||
|
## How to run
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ cargo run --bin rect
|
||||||
|
```
|
||||||
|
8
build.rs
Normal file
8
build.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fn main() {
|
||||||
|
// https://doc.rust-lang.org/cargo/reference/build-scripts.html
|
||||||
|
// cargo-equivalent to running rustc -L./raylib/ -lraylib test.rs -o bin/test
|
||||||
|
// to link against the libraylib.a static library
|
||||||
|
println!("cargo:rustc-link-search=./raylib");
|
||||||
|
println!("cargo:rustc-link-lib=static=raylib");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user