This repository showcases the basic setup for compiling servo as dependency in another rust project.
- Option 1: Using
libsimpleservo
- Option 2: Using
libservo
To use libsimpleservo
, the following steps assumes that you already have Servo project
built locally. If not, please check out the Servo repository for instructions on how to set it up locally.
- Clone this project
- Delete the
cargo.lock
file and therust-toolchain
file in your localservo-embedding
project. - Copy the
cargo.lock
file and therust-toolchain
file from theServo repository
and paste them into your localservo-embedding
project
-
Clone this project
-
In
Cargo.toml
file, under [dependencies] delete thesimpleservo
line(L9) and add:libservo = {git = "https://github.com/servo/servo", rev="XXXXXXX", features = ["media-gstreamer"]}
Note: you will need to get the latest
rev
from servo repository -
Delete the
cargo.lock
file and therust-toolchain
file in your localservo-embedding
project. -
Copy the
cargo.lock
file and therust-toolchain
file from theServo repository
and paste them into your localservo-embedding
project -
Replace the code in
main.rs
file with following:extern crate servo; fn main() { // do something }
To build:
cargo build --release
To run:
cargo run --release