Skip to content

Commit

Permalink
[windows] use bin/deps-windows for Swift
Browse files Browse the repository at this point in the history
Set up include and lib paths for pickup
  • Loading branch information
nil4 committed Oct 23, 2024
1 parent 2880243 commit 5b25d00
Showing 1 changed file with 44 additions and 13 deletions.
57 changes: 44 additions & 13 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,41 @@

import PackageDescription

// swift-tools-version: 6.0

import PackageDescription

#if os(Windows)
let thisFilePath = #filePath
let depsWindowsPath = "\(thisFilePath)\\bin\\deps-windows"

let cSettings: [CSetting]? = [
.unsafeFlags([
"-I\(depsWindowsPath)\\include"
])
]
let linkerSettings: [LinkerSetting]? = [
.unsafeFlags([
"-L./\(depsWindowsPath)\\lib"
])
]

let libtommathTarget = Target.systemLibrary(name: "libtommath", path: "Sources/libtommath-win")
let libtomcryptTarget = Target.systemLibrary(name: "libtomcrypt", path: "Sources/libtomcrypt-win")
let zTarget = Target.systemLibrary(name: "Z", path: "Sources/Z-win")
#else
let cSettings: [CSetting]? = []
let linkerSettings: [LinkerSetting]? = []

let libtommathTarget = Target.target(name: "libtommath")
let libtomcryptTarget = Target.target(name: "libtomcrypt", cSettings: [
.unsafeFlags([ "-Wno-shorten-64-to-32" ])
])
let zTarget = Target.target(name: "Z", linkerSettings: [
.linkedLibrary("z")
])
#endif

let package = Package(
name: "RoyalVNCKit",

Expand Down Expand Up @@ -35,24 +70,20 @@ let package = Package(
dependencies: [
"RoyalVNCKitC",
"d3des",
"libtommath",
"libtomcrypt",
"Z"
.byName(name: libtommathTarget.name),
.byName(name: libtomcryptTarget.name),
.byName(name: zTarget.name)
],

swiftSettings: [ .swiftLanguageMode(.v5) ]
cSettings: cSettings,
swiftSettings: [ .swiftLanguageMode(.v5) ],
linkerSettings: linkerSettings
),

.target(name: "d3des"),
.target(name: "libtommath"),

.target(name: "libtomcrypt", cSettings: [
.unsafeFlags([ "-Wno-shorten-64-to-32" ])
]),

.target(name: "Z", linkerSettings: [
.linkedLibrary("z")
]),
libtommathTarget,
libtomcryptTarget,
zTarget,

.executableTarget(
name: "RoyalVNCKitDemo",
Expand Down

0 comments on commit 5b25d00

Please sign in to comment.