playdate_build_utils/
compile.rs1pub const GCC_ARGS_LIB: &[&str] = &["-nostartfiles",
9 "-mthumb",
10 "-mcpu=cortex-m7",
11 "-mfloat-abi=hard",
12 "-mfpu=fpv5-sp-d16",
13 "-D__FPU_USED=1",
14 "-Wl,--cref,--gc-sections,--no-warn-mismatch,--emit-relocs",
15 "-fno-exceptions",
16 "-mword-relocations",
17 "-fno-common",
18 "--entry",
19 "eventHandlerShim"];
20
21
22pub const RUSTFLAGS_LIB_HOST: &[&str] = &["-Ctarget-cpu=native"];
23pub const RUSTFLAGS_LIB_PLAYDATE: &[&str] = &["-Ctarget-cpu=cortex-m7",
24 "-Ctarget-feature=-fp64",
25 "-Clink-args=--emit-relocs",
26 "-Crelocation-model=pic",
27 "-Csoft-float=no",
28 "-Clink-arg=--cref",
29 "-Clink-arg=--gc-sections"];
30pub const RUSTFLAGS_BIN_PLAYDATE: &[&str] = &["-Ctarget-cpu=cortex-m7",
36 "-Ctarget-feature=-fp64",
37 "-Clink-args=--emit-relocs",
38 "-Crelocation-model=pic",
39 "-Csoft-float=no",
40 "-Clink-arg=--cref",
41 "-Clink-arg=--gc-sections",
42 "-Clink-arg=--entry=eventHandlerShim"];
43
44pub const PDX_BIN_NAME_ELF: &str = "pdex.elf";
46pub const PDX_BIN_NAME_BIN: &str = "pdex.bin";
48pub const PDX_BIN_NAME_STEM: &str = "pdex";
50pub const PDX_PKG_EXT: &str = "pdx";
52pub const PDX_PKG_MANIFEST_FILENAME: &str = "pdxinfo";
54
55
56pub const fn dylib_suffix_for_host() -> &'static str {
57 if cfg!(target_os = "macos") {
58 "dylib"
59 } else if cfg!(unix) {
60 "so"
61 } else if cfg!(windows) {
62 "dll"
63 } else {
64 panic!("platform not supported");
65 #[cfg(all(not(unix), not(windows)))]
66 {
67 compile_error!("platform not supported")
68 }
69 }
70}
71
72pub const fn dylib_suffix_for_host_opt() -> Option<&'static str> {
73 if cfg!(target_os = "macos") {
74 Some("dylib")
75 } else if cfg!(unix) {
76 Some("so")
77 } else if cfg!(windows) {
78 Some("dll")
79 } else {
80 None
81 }
82}
83
84pub fn dylib_suffix_for_opt(target_family: &str, target_os: &str) -> Option<&'static str> {
85 match target_family {
86 "unix" if target_os == "macos" => Some("dylib"),
87 "unix" => Some("so"),
88 "windows" => Some("dll"),
89 _ => None,
90 }
91}
92
93pub const fn static_lib_suffix() -> &'static str { "a" }
94
95
96pub const LINK_MAP_BIN_PATH: &str = concat!(file!(), "/../", "layout.x");
100
101pub const LINK_MAP_BIN_SRC: &str = include_str!("layout.x");