cpclib_runner/runner/assembler/
sjasmplus.rs

1use std::fmt::Display;
2
3use crate::delegated::{
4    ArchiveFormat, CompilableInformation, DownloadableInformation, ExecutableInformation,
5    GithubCompilableApplication, GithubInformation
6};
7
8pub const SJASMPLUS_CMD: &str = "sjasmplus";
9
10#[derive(Clone, Debug, PartialEq, Eq, Hash, Default)]
11pub enum SjasmplusVersion {
12    #[default]
13    V1_20_3
14}
15
16impl GithubCompilableApplication for SjasmplusVersion {}
17
18impl Display for SjasmplusVersion {
19    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20        write!(f, "sjasmplus {}", self.version_name())
21    }
22}
23
24impl GithubInformation for SjasmplusVersion {
25    fn version_name(&self) -> &'static str {
26        match self {
27            SjasmplusVersion::V1_20_3 => "v1.20.3"
28        }
29    }
30
31    fn project(&self) -> &'static str {
32        "sjasmplus"
33    }
34
35    fn owner(&self) -> &'static str {
36        "z00m128"
37    }
38
39    fn linux_key(&self) -> Option<&'static str> {
40        Some("sjasmplus-1.20.3-src.tar.xz")
41    }
42
43    fn windows_key(&self) -> Option<&'static str> {
44        Some("sjasmplus-1.20.3.win.zip")
45    }
46}
47
48impl ExecutableInformation for SjasmplusVersion {
49    fn target_os_folder(&self) -> &'static str {
50        "sjasmplus-1.20.3"
51    }
52
53    fn target_os_exec_fname(&self) -> &'static str {
54        #[cfg(target_os = "linux")]
55        return "sjasmplus";
56        #[cfg(target_os = "windows")]
57        return "sjasmplus.exe";
58    }
59}
60
61impl CompilableInformation for SjasmplusVersion {
62    fn target_os_commands(&self) -> Option<&'static [&'static [&'static str]]> {
63        if cfg!(target_os = "linux") {
64            Some(&[&["cmake", "sjasmplus-1.20.3"], &["make"]])
65        }
66        else {
67            None
68        }
69    }
70}
71
72impl DownloadableInformation for SjasmplusVersion {
73    fn target_os_archive_format(&self) -> ArchiveFormat {
74        #[cfg(target_os = "linux")]
75        return ArchiveFormat::TarXz;
76        #[cfg(target_os = "windows")]
77        return ArchiveFormat::Zip;
78    }
79}