GitXplorerGitXplorer
c

swift-win32-application

public
21 stars
2 forks
0 issues

Commits

List of commits on branch main.
Unverified
cfca70ad3609ac1a26edbcc209a515ad2a1a790b

changed SPM dependency declaration to work w/ Swift 5.4

hh4cky committed 4 years ago
Unverified
d3e5306b207fd6c7cec92a629f4074d31475fe7c

build: improve GUI application handling for Swift 5.4

ccompnerd committed 4 years ago
Unverified
ac42bea4ebd8b4277ab8edd45c844f5cc126050e

build: add special handling for executable targets on Windows

ccompnerd committed 4 years ago
Unverified
68d25eb49ba990cdb63e44d14357c71b59eca12c

Initial commit

ccompnerd committed 4 years ago

README

The README file for this repository.

Windows Empty Swift Application Template

This provides a template project to build a Swift application on Windows using Swift/Win32.

Build Requirements

  • Swift 5.4 or newer
  • Windows SDK 10.0.10773 or newer
  • Swift/Win32 development

Building

The project can be built using Swift Package Manager's build command. Additionaly, the application needs to have a manifest integrated into the binary. This requires additional operations which cannot be automated with Swift Package Manager currently. Additionally, some files need to be deployed manually as they need to be placed in a specific layout.

Currently, the LLVM manifest tool (llvm-mt) is unable to perform the operation and thus this must be done with the MSVC toolset.

swift build
mt -nologo -manifest Sources\Application\Application.exe.manifest -outputresource:.build\x86_64-unknown-windows-msvc\debug\Application.exe
copy Sources\Application\Info.plist .build\x86_64-unknown-windows-msvc\debug\

Testing

The project uses XCTest to add unit tests. You can run the unit test suite using Swift Package Manager's test command.

swift test

Debugging

In order to debug the package, there are two options. In order to debug with LLDB, which is required for debugging Swift code, the linker needs to preserve the debug information. This is accomplished by passing an additional flag during the build.

swift build -Xlinker -debug:dwarf

When trying to debug the interactions with the system, it is convenient to use the Windows tooling for debugging (e.g. WinDBG). In such a case, the debug information needs to be emitted for Windows. This requires passing additonal flags to Swift Package Manager.

swift build -Xswiftc -g -Xswiftc -debug-info-format=codeview -Xlinker -debug