Skip to content

Commit b6b4bbc

Browse files
committed
Only include dependencies when binary feature is enabled
This change vastly improves compile times when only `lib.rs` is compiled. However, it is a breaking change.
1 parent 6946452 commit b6b4bbc

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Cargo.toml

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ edition = "2018"
99
build = "build.rs"
1010

1111
[dependencies]
12-
xmas-elf = "0.6.2"
13-
x86_64 = "0.7.2"
14-
usize_conversions = "0.2.0"
15-
fixedvec = "0.2.3"
12+
xmas-elf = { version = "0.6.2", optional = true }
13+
x86_64 = { version = "0.7.2", optional = true }
14+
usize_conversions = { version = "0.2.0", optional = true }
15+
fixedvec = { version = "0.2.3", optional = true }
1616

1717
[dependencies.font8x8]
1818
version = "0.2.4"
@@ -25,6 +25,7 @@ llvm-tools = "0.1"
2525

2626
[features]
2727
default = []
28+
binary = ["xmas-elf", "x86_64", "usize_conversions", "fixedvec"]
2829
vga_320x200 = ["font8x8"]
2930
recursive_page_table = []
3031
map_physical_memory = []

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ As an example, you can build the bootloader with example kernel from the `exampl
3030
cd example-kernel
3131
cargo xbuild
3232
cd ..
33-
KERNEL=example-kernel/target/x86_64-example-kernel/debug/example-kernel cargo xbuild --release
33+
KERNEL=example-kernel/target/x86_64-example-kernel/debug/example-kernel cargo xbuild --release --features binary
3434
```
3535

36-
This results in a bootloader executable at `target/x86_64-bootloader.json/release/bootloader`. This executable is still an ELF file, which can't be run directly.
36+
The `binary` feature is required to enable the dependencies required for compiling the bootloader executable. The command results in a bootloader executable at `target/x86_64-bootloader.json/release/bootloader`. This executable is still an ELF file, which can't be run directly.
3737

3838
## Run
3939

0 commit comments

Comments
 (0)