1515// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616// See the License for the specific language governing permissions and
1717// limitations under the License.
18-
1918import PackageDescription
2019
21- let swiftSettings : [ SwiftSetting ] = [
20+ let librarySettings : [ SwiftSetting ] = [
2221 . enableExperimentalFeature( " StrictConcurrency " ) ,
23- . unsafeFlags( [ " -cross-module-optimization " ] , . when( configuration: . release) ) ,
2422]
2523
24+ let executableSettings : [ SwiftSetting ] =
25+ librarySettings +
26+ [ . unsafeFlags( [ " -cross-module-optimization " ] , . when( configuration: . release) ) ]
27+
2628let package = Package (
2729 name: " swift-homomorphic-encryption " ,
2830 products: [
@@ -46,7 +48,7 @@ let package = Package(
4648 dependencies: [
4749 . package ( url: " https://github.com/apple/swift-argument-parser.git " , from: " 1.2.0 " ) ,
4850 . package ( url: " https://github.com/apple/swift-crypto.git " , from: " 3.4.0 " ) ,
49- . package ( url: " https://github.com/swiftlang /swift-docc-plugin " , from: " 1.0.0 " ) ,
51+ . package ( url: " https://github.com/apple /swift-docc-plugin " , from: " 1.0.0 " ) ,
5052 . package ( url: " https://github.com/apple/swift-numerics " , from: " 1.0.0 " ) ,
5153 // Keep version in sync with README
5254 . package ( url: " https://github.com/apple/swift-protobuf " , from: " 1.27.0 " ) ,
@@ -68,47 +70,41 @@ let package = Package(
6870 . product( name: " _CryptoExtras " , package : " swift-crypto " ) ,
6971 " CUtil " ,
7072 ] ,
71- swiftSettings: swiftSettings + [
72- SwiftSetting . unsafeFlags ( [
73- " -Xllvm " ,
74- " -unroll-count=8 " ,
75- " -Xllvm " ,
76- " -unroll-threshold=64 " ,
77- ] ) ,
78- ] ) ,
73+ swiftSettings: librarySettings) ,
7974 . target(
8075 name: " HomomorphicEncryptionProtobuf " ,
8176 dependencies: [ " HomomorphicEncryption " ,
8277 . product( name: " SwiftProtobuf " , package : " swift-protobuf " ) ] ,
8378 exclude: [ " generated/README.md " ] ,
84- swiftSettings: swiftSettings ) ,
79+ swiftSettings: librarySettings ) ,
8580 . target(
8681 name: " PrivateInformationRetrieval " ,
8782 dependencies: [ " HomomorphicEncryption " ,
8883 . product( name: " Numerics " , package : " swift-numerics " ) ] ,
89- swiftSettings: swiftSettings ) ,
84+ swiftSettings: librarySettings ) ,
9085 . target(
9186 name: " PrivateInformationRetrievalProtobuf " ,
9287 dependencies: [ " PrivateInformationRetrieval " ,
9388 " HomomorphicEncryption " ,
9489 " HomomorphicEncryptionProtobuf " ,
9590 . product( name: " SwiftProtobuf " , package : " swift-protobuf " ) ] ,
9691 exclude: [ " generated/README.md " , " protobuf_module_mappings.txtpb " ] ,
97- swiftSettings: swiftSettings ) ,
92+ swiftSettings: librarySettings ) ,
9893 . target(
9994 name: " TestUtilities " ,
10095 dependencies: [
10196 " HomomorphicEncryption " ,
10297 . product( name: " Numerics " , package : " swift-numerics " ) ,
103- ] ) ,
98+ ] ,
99+ swiftSettings: librarySettings) ,
104100 . executableTarget(
105101 name: " PIRGenerateDatabase " ,
106102 dependencies: [
107103 . product( name: " ArgumentParser " , package : " swift-argument-parser " ) ,
108104 " HomomorphicEncryption " ,
109105 " PrivateInformationRetrievalProtobuf " ,
110106 ] ,
111- swiftSettings: swiftSettings ) ,
107+ swiftSettings: executableSettings ) ,
112108 . executableTarget(
113109 name: " PIRProcessDatabase " ,
114110 dependencies: [
@@ -118,51 +114,51 @@ let package = Package(
118114 " HomomorphicEncryption " ,
119115 . product( name: " Logging " , package : " swift-log " ) ,
120116 ] ,
121- swiftSettings: swiftSettings ) ,
117+ swiftSettings: executableSettings ) ,
122118 . executableTarget(
123119 name: " PIRShardDatabase " ,
124120 dependencies: [
125121 . product( name: " ArgumentParser " , package : " swift-argument-parser " ) ,
126122 " HomomorphicEncryption " ,
127123 " PrivateInformationRetrievalProtobuf " ,
128124 ] ,
129- swiftSettings: swiftSettings ) ,
125+ swiftSettings: executableSettings ) ,
130126 . testTarget(
131127 name: " HomomorphicEncryptionTests " ,
132128 dependencies: [
133129 " HomomorphicEncryption " , " TestUtilities " ,
134130 . product( name: " Numerics " , package : " swift-numerics " ) ,
135- ] ) ,
131+ ] , swiftSettings : executableSettings ) ,
136132 . testTarget(
137133 name: " HomomorphicEncryptionProtobufTests " ,
138134 dependencies: [
139135 " HomomorphicEncryption " ,
140136 " HomomorphicEncryptionProtobuf " ,
141137 " TestUtilities " ,
142- ] ) ,
138+ ] , swiftSettings : executableSettings ) ,
143139 . testTarget(
144140 name: " PrivateInformationRetrievalProtobufTests " ,
145141 dependencies: [
146142 " PrivateInformationRetrieval " ,
147143 " PrivateInformationRetrievalProtobuf " ,
148144 " TestUtilities " ,
149- ] ) ,
145+ ] , swiftSettings : executableSettings ) ,
150146 . testTarget(
151147 name: " PrivateInformationRetrievalTests " ,
152148 dependencies: [
153149 " PrivateInformationRetrieval " , " TestUtilities " ,
154150 . product( name: " Numerics " , package : " swift-numerics " ) ,
155- ] ) ,
151+ ] , swiftSettings : executableSettings ) ,
156152 . testTarget(
157153 name: " PIRGenerateDatabaseTests " ,
158154 dependencies: [ " PIRGenerateDatabase " ,
159155 " TestUtilities " ,
160- . product( name: " Numerics " , package : " swift-numerics " ) ] ) ,
156+ . product( name: " Numerics " , package : " swift-numerics " ) ] , swiftSettings : executableSettings ) ,
161157 . testTarget(
162158 name: " PIRProcessDatabaseTests " ,
163159 dependencies: [ " PIRProcessDatabase " ,
164160 " TestUtilities " ,
165- . product( name: " Numerics " , package : " swift-numerics " ) ] ) ,
161+ . product( name: " Numerics " , package : " swift-numerics " ) ] , swiftSettings : executableSettings ) ,
166162 ] )
167163
168164// MARK: - Benchmarks
@@ -178,7 +174,7 @@ package.targets += [
178174 " HomomorphicEncryption " ,
179175 ] ,
180176 path: " Benchmarks/PolyBenchmark " ,
181- swiftSettings: swiftSettings ,
177+ swiftSettings: executableSettings ,
182178 plugins: [
183179 . plugin( name: " BenchmarkPlugin " , package : " package-benchmark " ) ,
184180 ] ) ,
@@ -189,7 +185,7 @@ package.targets += [
189185 " HomomorphicEncryption " ,
190186 ] ,
191187 path: " Benchmarks/RlweBenchmark " ,
192- swiftSettings: swiftSettings ,
188+ swiftSettings: executableSettings ,
193189 plugins: [
194190 . plugin( name: " BenchmarkPlugin " , package : " package-benchmark " ) ,
195191 ] ) ,
@@ -203,13 +199,13 @@ package.targets += [
203199 " PrivateInformationRetrievalProtobuf " ,
204200 ] ,
205201 path: " Benchmarks/PrivateInformationRetrievalBenchmark " ,
206- swiftSettings: swiftSettings ,
202+ swiftSettings: executableSettings ,
207203 plugins: [
208204 . plugin( name: " BenchmarkPlugin " , package : " package-benchmark " ) ,
209205 ] ) ,
210206]
211207
212208// Set the minimum macOS version for the package
213209package . platforms = [
214- . macOS( . v14) , // Constrained by Swift 6 support for Xcode (https://developer.apple.com/support/xcode/)
210+ . macOS( . v14) , // Constrained by Swift 5.10 support for Xcode (https://developer.apple.com/support/xcode/)
215211]
0 commit comments