Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux support #36

Merged
merged 8 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
matrix:
os:
- macos-latest
# - ubuntu-latest
- ubuntu-latest
# - windows-latest
sdk:
- latest
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
matrix:
os:
- macos-latest
# - ubuntu-latest
- ubuntu-latest
# - windows-latest
sdk:
- latest
Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "playdate-sys"
version = "0.1.4"
version = "0.1.5"
edition = "2021"
build = "src/build.rs"

Expand Down
3 changes: 2 additions & 1 deletion api/sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ pub mod misc {

#[doc(hidden)]
#[no_mangle]
#[cfg(target_os = "windows")]
// it not needed on MacOS
#[cfg(not(target_os = "macos"))]
// TODO: Somehow link with proper impl: https://stackoverflow.com/q/76439798/829264
pub extern "C" fn _sbrk() {}
};
Expand Down
2 changes: 1 addition & 1 deletion cargo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-playdate"
version = "0.1.2"
version = "0.1.3"
edition = "2021"

readme = "README.md"
Expand Down
16 changes: 11 additions & 5 deletions cargo/tests/build/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ fn dev_lib_debug() -> Result<()> {
}


fn dylib_name() -> String {
const DYLIB_EXT: &str = dylib_suffix_for_host();
"pdex.".to_owned() + DYLIB_EXT
}


#[test]
/// target: default host
fn sim_host_release() -> Result<()> {
Expand All @@ -112,7 +118,7 @@ fn sim_host_release() -> Result<()> {
let cargo_target_fullname = format!("{cargo_package_name}-{LIB_NAME}");
let artifact = export_dir.join("playdate")
.join(cargo_target_fullname)
.join(PathBuf::from("build/pdex.dylib"));
.join(PathBuf::from("build/").join(dylib_name()));
test_artifact_sim(&artifact, false)
}

Expand All @@ -131,7 +137,7 @@ fn sim_host_debug() -> Result<()> {
let cargo_target_fullname = format!("{cargo_package_name}-{LIB_NAME}");
let artifact = export_dir.join("playdate")
.join(cargo_target_fullname)
.join(PathBuf::from("build/pdex.dylib"));
.join(PathBuf::from("build/").join(dylib_name()));
test_artifact_sim(&artifact, false)
}

Expand All @@ -152,7 +158,7 @@ fn sim_host_release_exp() -> Result<()> {
let cargo_target_fullname = format!("{cargo_package_name}-{LIB_NAME}");
let artifact = export_dir.join("playdate")
.join(cargo_target_fullname)
.join(PathBuf::from("build/pdex.dylib"));
.join(PathBuf::from("build/").join(dylib_name()));
test_artifact_sim(&artifact, false)
}

Expand All @@ -171,7 +177,7 @@ fn dev_sim_release_exp() -> Result<()> {
.map(OsStr::new);
let expectations = [
("pdex.elf", dev_target, true),
("pdex.dylib", &host_target, false),
(&dylib_name(), &host_target, false),
];

for path in simple_crates()? {
Expand Down Expand Up @@ -283,7 +289,7 @@ mod examples {

let expectations = [
("pdex.elf", dev_target, true),
("pdex.dylib", &host_target, false),
(&dylib_name(), &host_target, false),
];

for path in simple_crates()? {
Expand Down
3 changes: 2 additions & 1 deletion cargo/tests/crates/simple/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ extern crate game;
use game::eventHandlerShim;

#[used]
pub static EVENT_HANDLER_SHIM: extern "C" fn(*const pd::ffi::PlaydateAPI, pd::ffi::PDSystemEvent, u32) -> i32 = eventHandlerShim;
pub static EVENT_HANDLER_SHIM: extern "C" fn(*const pd::ffi::PlaydateAPI, pd::ffi::PDSystemEvent, u32) -> i32 =
eventHandlerShim;