Skip to content

Commit

Permalink
start exploring ios compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
tantaman committed Jul 10, 2023
1 parent 5b08de2 commit d276d09
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down
22 changes: 22 additions & 0 deletions notes.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit d276d09

Please sign in to comment.