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.lockfile and therust-toolchainfile in your localservo-embeddingproject. - Copy the
cargo.lockfile and therust-toolchainfile from theServo repositoryand paste them into your localservo-embeddingproject
-
Clone this project
-
In
Cargo.tomlfile, under [dependencies] delete thesimpleservoline(L9) and add:libservo = {git = "https://github.com/servo/servo", rev="XXXXXXX", features = ["media-gstreamer"]}Note: you will need to get the latest
revfrom servo repository -
Delete the
cargo.lockfile and therust-toolchainfile in your localservo-embeddingproject. -
Copy the
cargo.lockfile and therust-toolchainfile from theServo repositoryand paste them into your localservo-embeddingproject -
Replace the code in
main.rsfile with following:extern crate servo; fn main() { // do something }
To build:
cargo build --release
To run:
cargo run --release