@@ -16,6 +16,12 @@ void main() async {
1616        for  (final  sqlite3mc in  [false , true ])
1717          _compileLinux (compiler, abi, sqlite3mc)
1818    ], eagerError:  true );
19+   } else  if  (Platform .isMacOS) {
20+     await  Future .wait ([
21+       for  (final  (triple, name) in  _appleAbis)
22+         for  (final  sqlite3mc in  [false , true ])
23+           _compileApple (triple, name, sqlite3mc)
24+     ], eagerError:  true );
1925  }
2026}
2127
@@ -48,6 +54,31 @@ Future<void> _compileLinux(
4854  }
4955}
5056
57+ Future <void > _compileApple (
58+     String  triple, String  prefix, bool  sqlite3Ciphers) async  {
59+   final  args =  [
60+     '-target' ,
61+     triple,
62+     '-shared' ,
63+     '-O3' ,
64+     ...defines,
65+     sqlite3Ciphers
66+         ?  'sqlite3-src/sqlite3mc/sqlite3mc_amalgamation.c' 
67+         :  'sqlite3-src/sqlite3/sqlite3.c' ,
68+     '-I' ,
69+     sqlite3Ciphers ?  'sqlite3-src/sqlite3mc/'  :  'sqlite3-src/sqlite3' ,
70+     '-o' ,
71+     'out/$prefix -sqlite3${sqlite3Ciphers  ? 'mc'  : '' }.dylib' ,
72+   ];
73+ 
74+   print ('Running clang ${args .join (' ' )}' );
75+   final  result =  await  Process .run ('clang' , args);
76+ 
77+   if  (result.exitCode !=  0 ) {
78+     throw  'Compiling for $triple  (ciphers: $sqlite3Ciphers ) failed: ${result .stdout }\n  ${result .stderr }' ;
79+   }
80+ }
81+ 
5182const  _linuxAbis =  [
5283  ('x86_64-linux-gnu-gcc' , 'x64' ),
5384  ('i686-linux-gnu-gcc' , 'x86' ),
@@ -56,6 +87,14 @@ const _linuxAbis = [
5687  ('riscv64-linux-gnu-gcc' , 'riscv64gc' ),
5788];
5889
90+ const  _appleAbis =  [
91+   ('aarch64-apple-macos' , 'macos-aarch64' ),
92+   ('x86_64-apple-macos' , 'macos-x64' ),
93+   ('x86_64-apple-ios13.0-simulator' , 'ios-sim-x64' ),
94+   ('arm64-apple-ios13.0-simulator' , 'ios-sim-aarch64' ),
95+   ('arm64-apple-ios13.0' , 'ios-aarch64' ),
96+ ];
97+ 
5998// Keep in sync with sqlite3/lib/src/hook/description.dart 
6099const  _defaultDefines =  ''' 
61100  SQLITE_ENABLE_DBSTAT_VTAB 
0 commit comments