Skip to content

Commit 892b1d6

Browse files
authored
Fixed compilation when on_gba is disabled (#202)
1 parent 7cd5dd2 commit 892b1d6

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

.github/workflows/ci-builds.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- { toolchain: nightly }
1414
steps:
1515
- uses: actions/checkout@v2
16-
16+
1717
- name: Install Apt Dependencies
1818
run: sudo apt-get update && sudo apt-get install binutils-arm-none-eabi
1919

@@ -32,3 +32,10 @@ jobs:
3232
toolchain: ${{ matrix.rust.toolchain }}
3333
command: build
3434
args: --examples
35+
36+
- name: Check compilation succeeds when not on the GBA (check to prevent complaints about missing things)
37+
uses: actions-rs/cargo@v1
38+
with:
39+
toolchain: ${{ matrix.rust.toolchain }}
40+
command: check
41+
args: --no-default-features

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
//! break any of these assumptions, if you do that some or all of the code
8888
//! provided by this crate may become unsound.
8989
90+
#[cfg(feature = "on_gba")]
9091
use prelude::{GbaCell, IrqFn};
9192

9293
mod macros;
@@ -118,6 +119,7 @@ pub mod video;
118119

119120
/// The function pointer that the assembly runtime calls when an interrupt
120121
/// occurs.
122+
#[cfg(feature = "on_gba")]
121123
pub static RUST_IRQ_HANDLER: GbaCell<Option<IrqFn>> = GbaCell::new(None);
122124

123125
/// Wraps a value to be aligned to a minimum of 4.

src/video/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ impl TextEntry {
326326
}
327327

328328
#[inline]
329+
#[cfg(feature = "on_gba")]
329330
pub fn video3_clear_to(c: Color) {
330331
let u = u32::from(c.0) << 16 | u32::from(c.0);
331332
unsafe {
@@ -350,6 +351,7 @@ impl Video3Bitmap {
350351
}
351352

352353
#[inline]
354+
#[cfg(feature = "on_gba")]
353355
pub fn video3_set_bitmap(bitmap: &Video3Bitmap) {
354356
let p = VIDEO3_VRAM.as_usize() as *mut _;
355357
unsafe {
@@ -365,6 +367,7 @@ pub struct Video4Indexmap(pub [u8; 240 * 160]);
365367
/// ## Panics
366368
/// Only frames 0 and 1 exist, if `frame` is 2 or more this will panic.
367369
#[inline]
370+
#[cfg(feature = "on_gba")]
368371
pub fn video4_set_indexmap(indexes: &Video4Indexmap, frame: usize) {
369372
let p = VIDEO4_VRAM.get_frame(usize::from(frame)).unwrap().as_usize()
370373
as *mut [u32; 8];

0 commit comments

Comments
 (0)