-
Notifications
You must be signed in to change notification settings - Fork 3
fix(examples/mobc): Enable cross-platform builds with auto-target detection #446
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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)", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| "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:*", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これは更新忘れ。Renovate で更新するようにした気がしていたけど、動いてないな。そっちのデバッグのためにも別 PR でやりたいかも。