File tree Expand file tree Collapse file tree
bundled/SQLite3MultipleCiphers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,14 +19,8 @@ tracing = "0.1.40"
1919tracing-subscriber = " 0.3.18"
2020http = " 1.1.0"
2121anyhow = " 1.0.86"
22-
23- [target .'cfg(not(any(target_os = "ios", target_os = "android")))' .dependencies ]
2422libsql = { path = " ../../libsql" , features = [" encryption" ] }
2523
26- # Disable encryption for ios and android targets
27- [target .'cfg(any(target_os = "ios", target_os = "android"))' .dependencies ]
28- libsql = { path = " ../../libsql" }
29-
3024
3125# The produced binaries are too large for mobiles
3226# When compiling for iOS or Android, you should turn on symbol stripping, lto and cut debug symbols
Original file line number Diff line number Diff line change 11OS := $(shell uname)
22CFLAGS := -Iinclude
33LDFLAGS := -lm
4- ARCHS_IOS = x86_64-apple-ios aarch64-apple-ios aarch64-apple-ios-sim
4+ ARCHS_IOS = aarch64-apple-ios aarch64-apple-ios-sim
55ARCHS_ANDROID = aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android
66LIB = libsql_experimental.a
77HEADER = libsql.h
@@ -40,11 +40,21 @@ $(ARCHS_ANDROID): %:
4040ios : $(XCFRAMEWORK )
4141
4242$(ARCHS_IOS ) : % :
43- cargo build --release --target $@
44-
45- $(XCFRAMEWORK ) : $(ARCHS_IOS )
43+ cargo build --release --target $@
44+
45+ x86_64-apple-ios :
46+ SDKROOT=$$(xcrun --sdk iphonesimulator --show-sdk-path ) \
47+ CFLAGS_x86_64_apple_ios=" -target x86_64-apple-ios-simulator" \
48+ CXXFLAGS_x86_64_apple_ios=" -target x86_64-apple-ios-simulator" \
49+ CC_x86_64_apple_ios=$$(xcrun --sdk iphonesimulator --find clang ) \
50+ CXX_x86_64_apple_ios=$$(xcrun --sdk iphonesimulator --find clang++ ) \
51+ CMAKE_SYSTEM_NAME=iOS \
52+ CMAKE_OSX_SYSROOT=$$(xcrun --sdk iphonesimulator --show-sdk-path ) \
53+ cargo build --release --target x86_64-apple-ios
54+
55+ $(XCFRAMEWORK ) : $(ARCHS_IOS ) x86_64-apple-ios
4656 rm -rf generated
4757 mkdir -p generated/simulator_fat
4858 rm -rf $@
4959 lipo -create $(wildcard ../../target/x86_64-apple-ios/release/$(LIB ) ) $(wildcard ../../target/aarch64-apple-ios-sim/release/$(LIB ) ) -output generated/simulator_fat/$(LIB )
50- xcodebuild -create-xcframework -library $(wildcard ../../target/aarch64-apple-ios/release/$(LIB ) ) -headers include -library generated/simulator_fat/$(LIB ) -headers include -output $@
60+ xcodebuild -create-xcframework -library $(wildcard ../../target/aarch64-apple-ios/release/$(LIB ) ) -headers include -library generated/simulator_fat/$(LIB ) -headers include -output $@
Original file line number Diff line number Diff line change @@ -481,6 +481,11 @@ fn build_multiple_ciphers(out_path: &Path) -> PathBuf {
481481 build. compiler ( cxx) ;
482482 config. init_cxx_cfg ( build) ;
483483 }
484+ let target = env:: var ( "TARGET" ) . unwrap ( ) ;
485+
486+ if target. ends_with ( "apple-ios" ) {
487+ config. define ( "SQLITE3MC_OMIT_AES_HARDWARE_SUPPORT" , "ON" ) ;
488+ }
484489
485490 if cfg ! ( feature = "wasmtime-bindings" ) {
486491 config. define ( "LIBSQL_ENABLE_WASM_RUNTIME" , "1" ) ;
@@ -492,6 +497,14 @@ fn build_multiple_ciphers(out_path: &Path) -> PathBuf {
492497 . define ( "SQLITE_ENABLE_SESSION" , "ON" ) ;
493498 }
494499
500+ if let Ok ( abi) = env:: var ( "CARGO_NDK_ANDROID_TARGET" ) {
501+ config. define ( "ANDROID_ABI" , abi) ;
502+ }
503+
504+ if let Ok ( platform) = env:: var ( "ANDROID_PLATFORM" ) {
505+ config. define ( "ANDROID_PLATFORM" , platform) ;
506+ }
507+
495508 config. build ( )
496509}
497510
Original file line number Diff line number Diff line change @@ -313,11 +313,12 @@ if (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT (
313313 CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64"
314314 OR CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64"
315315 OR CMAKE_SYSTEM_PROCESSOR STREQUAL "arm"
316+ OR CMAKE_ANDROID_ARCH_ABI STREQUAL "arm64-v8a"
317+ OR CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a"
316318 ))
317319 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2 -maes -Wno-error=incompatible-function-pointer-types" )
318320 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2 -maes" )
319321endif ()
320-
321322set (_LIB_DIFINITIONS
322323 _LIB
323324)
You can’t perform that action at this time.
0 commit comments