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

fix(api/wamr): Build wamr on iOS #5184

Merged
merged 4 commits into from
Oct 29, 2024
Merged
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
23 changes: 22 additions & 1 deletion lib/api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,35 @@ fn main() {
.define("WAMR_DISABLE_HW_BOUND_CHECK", "1")
.define("WAMR_BUILD_TARGET", target_arch);

if cfg!(target_os = "windows") {
if target_os == "windows" {
dst.define("CMAKE_CXX_COMPILER", "cl.exe");
dst.define("CMAKE_C_COMPILER", "cl.exe");
dst.define("CMAKE_LINKER_TYPE", "MSVC");
dst.define("WAMR_BUILD_PLATFORM", "windows");
dst.define("WAMR_BUILD_LIBC_UVWASI", "0");
}

if target_os == "ios" {
// XXX: Hacky
//
// Compiling wamr targeting `aarch64-apple-ios` results in
//
// ```
// clang: error: unsupported option '-mfloat-abi=' for target 'aarch64-apple-ios'
// ```
// So, here, we simply remove that setting.
//
// See: https://github.com/bytecodealliance/wasm-micro-runtime/pull/3889
let mut lines = vec![];
let cmake_file_path = wamr_platform_dir.join("CMakeLists.txt");
for line in std::fs::read_to_string(&cmake_file_path).unwrap().lines() {
if !line.contains("-mfloat-abi=hard") {
lines.push(line.to_string())
}
}
std::fs::write(cmake_file_path, lines.join("\n")).unwrap();
}

let dst = dst.build();

// Check output of `cargo build --verbose`, should see something like:
Expand Down
Loading