File tree Expand file tree Collapse file tree 4 files changed +30
-12
lines changed
bundled/SQLite3MultipleCiphers Expand file tree Collapse file tree 4 files changed +30
-12
lines changed Original file line number Diff line number Diff line change @@ -19,14 +19,8 @@ tracing = "0.1.40"
19
19
tracing-subscriber = " 0.3.18"
20
20
http = " 1.1.0"
21
21
anyhow = " 1.0.86"
22
-
23
- [target .'cfg(not(any(target_os = "ios", target_os = "android")))' .dependencies ]
24
22
libsql = { path = " ../../libsql" , features = [" encryption" ] }
25
23
26
- # Disable encryption for ios and android targets
27
- [target .'cfg(any(target_os = "ios", target_os = "android"))' .dependencies ]
28
- libsql = { path = " ../../libsql" }
29
-
30
24
31
25
# The produced binaries are too large for mobiles
32
26
# 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 1
1
OS := $(shell uname)
2
2
CFLAGS := -Iinclude
3
3
LDFLAGS := -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
5
5
ARCHS_ANDROID = aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android
6
6
LIB = libsql_experimental.a
7
7
HEADER = libsql.h
@@ -40,11 +40,21 @@ $(ARCHS_ANDROID): %:
40
40
ios : $(XCFRAMEWORK )
41
41
42
42
$(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
46
56
rm -rf generated
47
57
mkdir -p generated/simulator_fat
48
58
rm -rf $@
49
59
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 @@ -485,6 +485,11 @@ fn build_multiple_ciphers(out_path: &Path) -> PathBuf {
485
485
build. compiler ( cxx) ;
486
486
config. init_cxx_cfg ( build) ;
487
487
}
488
+ let target = env:: var ( "TARGET" ) . unwrap ( ) ;
489
+
490
+ if target. ends_with ( "apple-ios" ) {
491
+ config. define ( "SQLITE3MC_OMIT_AES_HARDWARE_SUPPORT" , "ON" ) ;
492
+ }
488
493
489
494
if cfg ! ( feature = "wasmtime-bindings" ) {
490
495
config. define ( "LIBSQL_ENABLE_WASM_RUNTIME" , "1" ) ;
@@ -496,6 +501,14 @@ fn build_multiple_ciphers(out_path: &Path) -> PathBuf {
496
501
. define ( "SQLITE_ENABLE_SESSION" , "ON" ) ;
497
502
}
498
503
504
+ if let Ok ( abi) = env:: var ( "CARGO_NDK_ANDROID_TARGET" ) {
505
+ config. define ( "ANDROID_ABI" , abi) ;
506
+ }
507
+
508
+ if let Ok ( platform) = env:: var ( "ANDROID_PLATFORM" ) {
509
+ config. define ( "ANDROID_PLATFORM" , platform) ;
510
+ }
511
+
499
512
config. build ( )
500
513
}
501
514
Original file line number Diff line number Diff line change @@ -313,11 +313,12 @@ if (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT (
313
313
CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64"
314
314
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64"
315
315
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "arm"
316
+ OR CMAKE_ANDROID_ARCH_ABI STREQUAL "arm64-v8a"
317
+ OR CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a"
316
318
))
317
319
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2 -maes -Wno-error=incompatible-function-pointer-types" )
318
320
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2 -maes" )
319
321
endif ()
320
-
321
322
set (_LIB_DIFINITIONS
322
323
_LIB
323
324
)
You can’t perform that action at this time.
0 commit comments