Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

Commit

Permalink
Add dox feature to fix docs.rs compilation issue in dependent crates
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Larralde committed Sep 12, 2018
1 parent 7211a6e commit aa318dc
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.


## [Unreleased]
### Added
- `dox` feature to disable linking to `vitasdk` stubs during compilation (use in `docs.rs`)


### Fixed

- Links in `CHANGELOG.md` file.
Expand Down
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ keywords = ["ps-vita", "psp2"]
categories = ["no-std", "external-ffi-bindings", "os", "hardware-support"]
exclude = ["ci/travis/setup.sh", "Makefile.toml"]

[package.metadata.docs.rs]
features = ["dox"]

[lib]
name = "psp2_sys"
path = "src/lib.rs"
Expand All @@ -21,3 +24,5 @@ maintenance = { status = "actively-developed" }
[features]
default = []
unsafe = []
dox = []

5 changes: 4 additions & 1 deletion src/dialog/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ pub struct SceCommonDialogParam {
pub magic: SceUInt32,
}

#[link(name = "SceCommonDialog_stub", kind = "static")]
#[cfg_attr(
not(feature = "dox"),
link(name = "SceCommonDialog_stub", kind = "static")
)]
extern "C" {
pub fn sceCommonDialogSetConfigParam(configParam: *const SceCommonDialogConfigParam) -> i32;
pub fn sceCommonDialogUpdate(updateParam: *const SceCommonDialogUpdateParam) -> i32;
Expand Down
5 changes: 4 additions & 1 deletion src/dialog/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ pub struct SceMsgDialogResult {
// param->sdkVersion = 0x03150021;
// }

#[link(name = "SceCommonDialog_stub", kind = "static")]
#[cfg_attr(
not(feature = "dox"),
link(name = "SceCommonDialog_stub", kind = "static")
)]
extern "C" {
pub fn sceMsgDialogInit(param: *const SceMsgDialogParam) -> i32;
pub fn sceMsgDialogGetStatus() -> SceCommonDialogStatus;
Expand Down
5 changes: 4 additions & 1 deletion src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ pub struct SceDisplayFrameBuf {
pub height: u32, // framebuffer height
}

#[link(kind = "static", name = "SceDisplay_stub")]
#[cfg_attr(
not(feature = "dox"),
link(kind = "static", name = "SceDisplay_stub")
)]
extern "C" {
pub fn sceDisplaySetFrameBuf(
pParam: *const SceDisplayFrameBuf,
Expand Down
5 changes: 4 additions & 1 deletion src/io/devctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ pub struct SceIoDevInfo {
pub unk: *mut ::void,
}

#[link(kind = "static", name = "SceLibKernel_stub")]
#[cfg_attr(
not(feature = "dox"),
link(kind = "static", name = "SceLibKernel_stub")
)]
extern "C" {
pub fn sceIoDevctl(
dev: *const u8,
Expand Down
5 changes: 4 additions & 1 deletion src/io/dirent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ pub struct SceIoDirent {
pub dummy: i32,
}

#[link(kind = "static", name = "SceLibKernel_stub")]
#[cfg_attr(
not(feature = "dox"),
link(kind = "static", name = "SceLibKernel_stub")
)]
extern "C" {
pub fn sceIoDopen(dirname: *const u8) -> SceUID;
pub fn sceIoDread(fd: SceUID, dir: *mut SceIoDirent) -> i32;
Expand Down
5 changes: 4 additions & 1 deletion src/io/fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ pub enum SceIoDevType {
SCE_DEV_TYPE_MOUNTPT = 0x40, // Mount point
}

#[link(kind = "static", name = "SceIofilemgr_stub")]
#[cfg_attr(
not(feature = "dox"),
link(kind = "static", name = "SceIofilemgr_stub")
)]
extern "C" {
pub fn sceIoOpen(file: *const u8, flags: i32, mode: SceIoMode) -> SceUID;
pub fn sceIoOpenAsync(file: *const u8, flags: i32, mode: SceIoMode) -> SceUID;
Expand Down
5 changes: 4 additions & 1 deletion src/io/stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ pub struct SceIoStat {
pub st_private: [u32; 6], // Device-specific data
}

#[link(kind = "static", name = "SceLibKernel_stub")]
#[cfg_attr(
not(feature = "dox"),
link(kind = "static", name = "SceLibKernel_stub")
)]
extern "C" {
pub fn sceIoMkdir(dir: *const u8, mode: SceMode) -> i32;
pub fn sceIoRmdir(path: *const u8) -> i32;
Expand Down
5 changes: 4 additions & 1 deletion src/kernel/clib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use types::SceSize;

#[link(kind = "static", name = "SceLibKernel_stub")]
#[cfg_attr(
not(feature = "dox"),
link(kind = "static", name = "SceLibKernel_stub")
)]
extern "C" {

pub type va_list;
Expand Down

0 comments on commit aa318dc

Please sign in to comment.