@@ -27,6 +27,22 @@ let executableSettings: [SwiftSetting] =
2727
2828let benchmarkSettings : [ SwiftSetting ] = [ . unsafeFlags( [ " -cross-module-optimization " ] , . when( configuration: . release) ) ]
2929
30+ let enableFlags = " SWIFT_HOMOMORPHIC_ENCRYPTION_MODULAR_ARITHMETIC_EXTRA_SWIFT_FLAGS "
31+ func shouldEnableFlags( ) -> Bool {
32+ if let flag = ProcessInfo . processInfo. environment [ enableFlags] , flag != " 0 " , flag != " false " {
33+ return true
34+ }
35+ return false
36+ }
37+
38+ var flags : [ SwiftSetting ] = [ ]
39+ let enableFlagsBool = shouldEnableFlags ( )
40+ if enableFlagsBool {
41+ print ( " Building with additional flags. To disable, unset \( enableFlags) in your environment. " )
42+ let flagsAsString = ( ProcessInfo . processInfo. environment [ enableFlags] ?? " " ) as String
43+ flags += [ . unsafeFlags( flagsAsString. components ( separatedBy: " , " ) ) ]
44+ }
45+
3046let package = Package (
3147 name: " swift-homomorphic-encryption " ,
3248 products: [
@@ -60,6 +76,7 @@ let package = Package(
6076 dependencies: [
6177 . package ( url: " https://github.com/apple/swift-algorithms " , from: " 1.2.0 " ) ,
6278 . package ( url: " https://github.com/apple/swift-argument-parser.git " , from: " 1.2.0 " ) ,
79+ . package ( url: " https://github.com/apple/swift-async-algorithms.git " , from: " 1.0.2 " ) ,
6380 . package ( url: " https://github.com/apple/swift-crypto.git " , from: " 3.10.0 " ) ,
6481 . package ( url: " https://github.com/apple/swift-log.git " , from: " 1.0.0 " ) ,
6582 . package ( url: " https://github.com/apple/swift-numerics " , from: " 1.0.0 " ) ,
@@ -71,7 +88,7 @@ let package = Package(
7188 . target(
7289 name: " ModularArithmetic " ,
7390 dependencies: [ ] ,
74- swiftSettings: librarySettings) ,
91+ swiftSettings: librarySettings + flags ) ,
7592 . target(
7693 name: " CUtil " ,
7794 dependencies: [ ] ,
@@ -100,12 +117,14 @@ let package = Package(
100117 . target(
101118 name: " PrivateInformationRetrieval " ,
102119 dependencies: [ " HomomorphicEncryption " ,
120+ . product( name: " AsyncAlgorithms " , package : " swift-async-algorithms " ) ,
103121 . product( name: " Numerics " , package : " swift-numerics " ) ] ,
104122 swiftSettings: librarySettings) ,
105123 . target(
106124 name: " PrivateNearestNeighborSearch " ,
107125 dependencies: [
108126 . product( name: " Algorithms " , package : " swift-algorithms " ) ,
127+ . product( name: " AsyncAlgorithms " , package : " swift-async-algorithms " ) ,
109128 " HomomorphicEncryption " ,
110129 " _HomomorphicEncryptionExtras " ,
111130 ] ,
0 commit comments