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

update makefile to support ios builds #276

Merged
merged 2 commits into from
Jul 10, 2023
Merged

update makefile to support ios builds #276

merged 2 commits into from
Jul 10, 2023

Conversation

tantaman
Copy link
Collaborator

@tantaman tantaman commented Jul 10, 2023

so I thought this would be really hard and have been avoiding it for months.

Turns out we just needed to:

  1. set the target triple
  2. build rust's std from source
  3. set the sysroot to the iPhoneOS.sdk

To use:

cr-sqlite> cd core
cr-sqlite/core> export IOS_TARGET=aarch64-apple-ios; make loadable

Now in dist you'll have a crsqlite.dylib for ios

ls -ltrh dist
total 37992
-rw-r--r--  1 tantaman  staff   8.3M Jul  7 21:52 sqlite3-extra.c
-rw-r--r--  1 tantaman  staff   5.1M Jul 10 10:59 libcrsql_bundle-loadable.a
-rwxr-xr-x  1 tantaman  staff   848K Jul 10 10:59 crsqlite.dylib

Caveat

This assumes that we can load dylib extensions into sqlite on iOS. @alanjhughes is investigating this. If we can't then we'll have to build this statically into sqlite which should largely be more of the same changes but for static targets in the Makefile.

core/Makefile Outdated
@@ -26,6 +26,12 @@ ifdef CONFIG_WINDOWS
LOADABLE_EXTENSION=dll
endif

ifdef BUILD_FOR_IOS
CI_MAYBE_TARGET=aarch64-apple-ios
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@alanjhughes - you should be able to swap this out to whatever iOS target you need to build for.

I'll make this more configurable so you can specify it from the command-line.
maybe something like EXPORT BUILD_FOR_IOS=your_desired_target

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant