Skip to content

Commit

Permalink
Use platform conditions for SQLite3 syslib
Browse files Browse the repository at this point in the history
Instead of conditionals, which won't work in
cross compiles.
  • Loading branch information
helje5 committed Jun 18, 2024
1 parent f0de445 commit 96beff8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ CONFIGURATION=debug
DOCKER=/usr/local/bin/docker

# docker config (5.6.1 seems the first w/ aarch64)
SWIFT_BUILD_IMAGE="swift:5.6.2-focal"
#SWIFT_BUILD_IMAGE="swift:5.6.2-focal"
#SWIFT_BUILD_IMAGE=swift:5.9.0-focal
SWIFT_BUILD_IMAGE=swift:5.10.1-noble
DOCKER_BUILD_DIR=".docker$(SWIFT_BUILD_DIR)"
SWIFT_DOCKER_BUILD_DIR="$(DOCKER_BUILD_DIR)/aarch64-unknown-linux/$(CONFIGURATION)"
DOCKER_BUILD_PRODUCT="$(DOCKER_BUILD_DIR)/$(TOOL_NAME)"
Expand Down
37 changes: 20 additions & 17 deletions [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,32 @@ var package = Package(
],

targets: [
.systemLibrary(name: "SQLite3",
path: "Sources/SQLite3-Linux",
providers: [ .apt(["libsqlite3-dev"]) ]),

// A small library used to fetch schema information from SQLite3 databases.
.target(name: "SQLite3Schema", exclude: [ "README.md" ]),
.target(name: "SQLite3Schema",
dependencies: [
.target(name: "SQLite3",
condition: .when(platforms: [
.linux, .android, .windows, .openbsd
])),
],
exclude: [ "README.md" ]),

// Lighter is a shared lib providing common protocols used by Enlighter
// generated models and such.
// Note that Lighter isn't that useful w/o code generation (i.e. as a
// standalone lib).
.target(name: "Lighter", swiftSettings: settings),
.target(name: "Lighter",
dependencies: [
.target(name: "SQLite3",
condition: .when(platforms: [
.linux, .android, .windows, .openbsd
])),
],
swiftSettings: settings),


// MARK: - Plugin Support
Expand Down Expand Up @@ -124,18 +142,3 @@ var package = Package(
dependencies: [ "LighterGeneration" ])
]
)

#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
package.products += [ .library(name: "SQLite3", targets: [ "SQLite3" ]) ]
package.targets += [
.systemLibrary(name: "SQLite3",
path: "Sources/SQLite3-Linux",
providers: [ .apt(["libsqlite3-dev"]) ])
]
package.targets
.first(where: { $0.name == "SQLite3Schema" })?
.dependencies.append("SQLite3")
package.targets
.first(where: { $0.name == "Lighter" })?
.dependencies.append("SQLite3")
#endif // not-Darwin

0 comments on commit 96beff8

Please sign in to comment.