GitXplorerGitXplorer
c

swift-win32

public
1131 stars
72 forks
24 issues

Commits

List of commits on branch main.
Unverified
45a9e4e83cef6ffeef0509c34452d648e88d8eb6

SwiftWin32: enable tab control in ComCtl32

ccompnerd committed a year ago
Unverified
0704e2e3c62c70f26d126fb5d8d17acbf9b12de8

Support: remove extension that is unused

ccompnerd committed a year ago
Unverified
a2d6ddf1015ec04132af4f20b98fcd8b8bebe172

SwiftWin32: further adopt static libraries on 5.7+

ccompnerd committed a year ago
Verified
e648af733a4f4933196ac7b7e4d1f0208e5dd13d

Update README.md

ccompnerd committed a year ago
Unverified
778e896d4ca0255378e3382fe3d3c5495a177348

SwiftWin32: silence warning on recent development compilers

ccompnerd committed a year ago
Verified
9275ac391f83d99d314a3859fda154d4bb38367c

docs: Update cmake section in readme with required env-vars

ttonka3000 committed a year ago

README

The README file for this repository.

Swift/Win32 - A Swift Application Framework for Windows

Swift/Win32 Screenshot

Swift/Win32 aims to provide a MVC model for writing applications on Windows. It provides Swift friendly wrapping of the Win32 APIs much like MFC did for C++.

Build Requirements

  • Swift 5.4 or newer
  • Windows SDK 10.0.107763 or newer
  • CMake 3.16 or newer

Building

This project requires Swift 5.4 or newer. You can use the the snapshot binaries from swift.org, download the nightly build from Azure, or build the Swift compiler from source.

Recommended (CMake)

The following example session shows how to build with CMake 3.16 or newer.

cmake -B build -D BUILD_SHARED_LIBS=YES -D CMAKE_BUILD_TYPE=Release -D CMAKE_Swift_FLAGS="-sdk %SDKROOT%" -G Ninja -S .
ninja -C build SwiftWin32 UICatalog

%CD%\build\bin\UICatalog.exe
Required Environment Variables

The CMake build will automatically perform the application manifest merging via the mt tool, which is part of the Visual Studio build tools. Ensure that you run the build under the x64 Native Tools Command Prompt for VS2019 (or the appropriate shell for the version of Visual Studio).

The Swift installer will also add environment variables, ensure that you have restarted the terminal emulator after installing the toolchain to pick up the required environment variables.

Swift Package Manager

Building this project with swift-package-manager is supported although CMake is recommended for ease. The Swift Package Manager based build is required for code completion via SourceKit-LSP. It also allows for the use of Swift/Win32 in other applications using SPM. In order to use SPM to build this project additional post-build steps are required to use the demo applications.

The following known limitations are known:

  1. It is not possible to deploy auxiliary files which are required for Swift/Win32 based applications to function to the correct location.
  2. It is not possible to build and run multiple demo projects as the auxiliary files collide.
swift build --product UICatalog
mt -nologo -manifest Examples\UICatalog\UICatalog.exe.manifest -outputresource:.build\x86_64-unknown-windows-msvc\debug\UICatalog.exe
copy Examples\UICatalog\Info.plist .build\x86_64-unknown-windows-msvc\debug\
.build\x86_64-unknown-windows-msvc\debug\UICatalog.exe

In order to get access to the manifest tool (mt), the build and testing should occur in a x64 Native Tools Command Prompt for VS2019

Testing

The current implementation is still under flux and many of the interfaces we expect to be present are not yet implemented. Because clearly indicating the missing surface makes it easier to focus on what needs to be accomplished, there are many instances of interfaces being declared but not implemented. Most of these sites will abort if they are reached. In order to enable testing for scenarios which may interct with these cases, a special condition has been added as ENABLE_TESTING to allow us to bypass the missing functionality.

You can run tests by adding that as a flag when invoking the SPM test command as:

swift test -Xswiftc -DENABLE_TESTING