From d276d09186ad636c06be3188897ffd19db95ef80 Mon Sep 17 00:00:00 2001 From: Matt <1009003+tantaman@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:50:23 -0400 Subject: [PATCH] start exploring ios compilation --- core/Makefile | 9 +++++++++ notes.md | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/core/Makefile b/core/Makefile index fefa0aa00..8a887f255 100644 --- a/core/Makefile +++ b/core/Makefile @@ -26,6 +26,12 @@ ifdef CONFIG_WINDOWS LOADABLE_EXTENSION=dll endif +ifdef BUILD_FOR_IOS +CI_MAYBE_TARGET=aarch64-apple-ios +rs_build_flags = -Zbuild-std +sysroot_option = --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk +endif + prefix=./dist dbg_prefix=./dbg @@ -137,11 +143,14 @@ $(TARGET_LOADABLE): $(prefix) $(ext_files) $(rs_lib_loadable_cpy) $(CC) -O2 -I./src/ -I./src/sqlite \ $(LOADABLE_CFLAGS) \ $(C_TARGET) \ + $(sysroot_option) \ $(ext_files) $(rs_lib_loadable_cpy) -o $@ $(TARGET_DBG_LOADABLE): $(dbg_prefix) $(ext_files) $(rs_lib_dbg_loadable_cpy) $(CC) -g -I./src/ -I./src/sqlite \ $(LOADABLE_CFLAGS) \ + $(C_TARGET) \ + $(sysroot_option) \ $(ext_files) $(rs_lib_dbg_loadable_cpy) -o $@ # Build a SQLite CLI that pre-loads cr-sqlite. diff --git a/notes.md b/notes.md index 553dc5245..9149d532b 100644 --- a/notes.md +++ b/notes.md @@ -1,3 +1,25 @@ +# ios + +https://mozilla.github.io/firefox-browser-architecture/experiments/2017-09-06-rust-on-ios.html +cargo install cargo-lipo +^-- https://github.com/TimNN/cargo-lipo/issues/60 +https://www.reddit.com/r/rust/comments/12w9h4s/how_to_make_armv7appleios_target_by_myself/ + +``` +cargo build -Zbuild-std --target=aarch64-apple-ios --features static,omit_load_extension +``` + +``` +export CI_MAYBE_TARGET=aarch64-apple-ios +make loadable +clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot] +``` + +^- repeat for every ios arch? How to universal binary? + +https://stackoverflow.com/questions/823706/compiling-custom-sqlite-for-an-iphone-app +https://github.com/swiftlyfalling/SQLiteLib + # Prepared read - parse values and use correct types for binding