Skip to content

Commit 897920a

Browse files
committed
Add environment variable to force building as dynamic library
1 parent 025e3bc commit 897920a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Package.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
// swift-tools-version:6.0
22
import PackageDescription
33
import CompilerPluginSupport
4+
import class Foundation.ProcessInfo
5+
6+
// force building as dynamic library
7+
let dynamicLibrary = ProcessInfo.processInfo.environment["SWIFT_BUILD_DYNAMIC_LIBRARY"] != nil
8+
let libraryType: PackageDescription.Product.Library.LibraryType? = dynamicLibrary ? .dynamic : nil
49

510
let package = Package(
611
name: "CoreModel",
@@ -13,12 +18,14 @@ let package = Package(
1318
products: [
1419
.library(
1520
name: "CoreModel",
21+
type: libraryType,
1622
targets: [
1723
"CoreModel"
1824
]
1925
),
2026
.library(
2127
name: "CoreDataModel",
28+
type: libraryType,
2229
targets: [
2330
"CoreDataModel"
2431
]

0 commit comments

Comments
 (0)