Skip to content

Commit 88f0787

Browse files
authored
Merge pull request #10 from PureSwift/feature/dynamic-library
Add dynamic library support in Package.swift
2 parents 426d1cc + efd0d1d commit 88f0787

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

Package.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
// swift-tools-version: 6.1
22
import PackageDescription
3-
import Foundation
3+
import CompilerPluginSupport
4+
import class Foundation.ProcessInfo
5+
6+
// get environment variables
7+
let environment = ProcessInfo.processInfo.environment
8+
let dynamicLibrary = environment["SWIFT_BUILD_DYNAMIC_LIBRARY"] == "1"
9+
10+
// force building as dynamic library
11+
let libraryType: PackageDescription.Product.Library.LibraryType? = dynamicLibrary ? .dynamic : nil
412

513
let package = Package(
614
name: "CoreModel-SQLite",
@@ -13,6 +21,7 @@ let package = Package(
1321
products: [
1422
.library(
1523
name: "CoreModelSQLite",
24+
type: libraryType,
1625
targets: ["CoreModelSQLite"]
1726
)
1827
],

0 commit comments

Comments
 (0)