Skip to content
Open
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
2 changes: 0 additions & 2 deletions examples/mobc/.cargo/config.toml

This file was deleted.

10 changes: 8 additions & 2 deletions examples/mobc/boom-tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export JRSONNET_VERSION="v0.5.0-pre96-test"

curl -L --proto '=https' --tlsv1.2 -sSf "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/${BINSTALL_VERSION}/install-from-binstall-release.sh" | env BINSTALL_VERSION=${BINSTALL_VERSION} CARGO_HOME=$(pwd) bash

./bin/cargo-binstall --root . tmtc-c2a --version 1.1.1 --no-confirm
./bin/cargo-binstall --root . tmtc-c2a --version 1.2.0 --no-confirm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これは更新忘れ。Renovate で更新するようにした気がしていたけど、動いてないな。そっちのデバッグのためにも別 PR でやりたいかも。


./bin/cargo-binstall --root . tlmcmddb-cli --version 2.6.1 --no-confirm
./bin/cargo-binstall --root . kble --version 0.4.2 --no-confirm
Expand All @@ -17,7 +17,13 @@ curl -L --proto '=https' --tlsv1.2 -sSf "https://raw.githubusercontent.com/cargo
arch=$(uname -m)
if [ "$arch" = "x86_64" ]; then
arch="amd64"
elif [ "$arch" = "arm64" ]; then
arch="aarch64"
fi
os=$(uname -s | tr -s '[:upper:]' '[:lower:]')
curl -L "https://github.com/CertainLach/jrsonnet/releases/download/${JRSONNET_VERSION}/jrsonnet-linux-${arch}" -o ./bin/jrsonnet
if [ "$os" = "darwin" ]; then
curl -L "https://github.com/CertainLach/jrsonnet/releases/download/${JRSONNET_VERSION}/jrsonnet-darwin-${arch}" -o ./bin/jrsonnet
else
curl -L "https://github.com/CertainLach/jrsonnet/releases/download/${JRSONNET_VERSION}/jrsonnet-linux-${arch}" -o ./bin/jrsonnet
fi
chmod +x ./bin/jrsonnet
16 changes: 15 additions & 1 deletion examples/mobc/build.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
fn main() {
// Auto-detect target architecture and set appropriate build flags
let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_else(|_| "x86_64".to_string());
let build_for_32bit = match target_arch.as_str() {
"i686" | "i586" | "arm" => "ON",
_ => "OFF",
};
Comment on lines +3 to +7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust target から BUILD_FOR_32BIT 生やすのかなり妥当だ


// Build C2A & link
let mut c2a_cmake = cmake::Config::new(".");

// Use system default compiler for macOS
if cfg!(target_os = "macos") {
c2a_cmake.define("CMAKE_C_COMPILER", "clang");
c2a_cmake.define("CMAKE_CXX_COMPILER", "clang++");
}
Comment on lines +12 to +16
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これは悩ましい。SILS としてのビルドなら動けばいいぐらいなのでそんなに困らない気もしつつ、Apple clang は gcc とも clang ともビミョ~~~に違うので、デフォルトの選択肢として使いたい気はあまりしない。


let libc2a = c2a_cmake
.very_verbose(true)
.define("C2A_BUILD_FOR_32BIT", "OFF")
.define("C2A_BUILD_FOR_32BIT", build_for_32bit)
.define("C2A_BUILD_AS_C99", "ON")
.define("C2A_BUILD_FOR_SILS", "ON")
.define("C2A_USE_SCI_COM_WINGS", "OFF")
Expand Down
2 changes: 1 addition & 1 deletion examples/mobc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packageManager": "[email protected]",
"scripts": {
"build:tlmcmddb": "tlmcmddb-cli bundle --pretty tlm-cmd-db/TLM_DB/calced_data tlm-cmd-db/CMD_DB tlmcmddb.json",
"run:c2a": "cargo run",
"run:c2a": "cargo run --target $(rustc -vV | grep host | cut -d' ' -f2)",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm run run:c2a で target を指定するようにする + .cargo/config.toml で指定しない、のは、cargo run を基本的に npm 経由でしかしないのであれば妥当なんですが、現状はあんまりそうなってないのでちょっと違うかなあとなっています。ここらへんは実機・SILS両方にビルドしないといけない実際の C2A user プロジェクトでも毎回悩むところなんですが、ある程度のやり方は見えてきてはいるので、c2a-core をそれに合わせるのがよいだろうな。(なので、このパッチを入れる、というよりはちょっと違うことになりそう)

"run:gaia": "tmtc-c2a --satconfig satconfig.json --tlmcmddb tlmcmddb.json",
"run:kble": "bash -c 'while :; do kble -s <(jrsonnet spaghetti.jsonnet); sleep 1; done'",
"run-all": "run-p run:*",
Expand Down
Loading