Code Monkey home page Code Monkey logo

swift-win32's Introduction

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

swift-win32's People

Contributors

compnerd avatar efalloon avatar egorzhdan avatar farzonl avatar gungravekoga avatar naughtyottsel avatar relgit avatar rjpilgrim avatar samisuteria avatar svanimpe avatar tomaszpieczykolan avatar tonka3000 avatar toulouse avatar yostane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swift-win32's Issues

Window doesn't Open

After compilation of UICatalog no windows opens but in the console it just prints this

2022-05-30T12:32:19+0530 error org.compnerd.swift-win32 : [SwiftWin32] InitCommo
nControlsEx: Win32 Error 0 - The operation completed successfully.

Change `Button` to owner drawn class

Convert the Button implementation to use an owner drawn button. This should allow for changing the button to include an image and title simultaneously. Additionally, it would allow for embedding a Label and ImageView members which can then be made available to the user to control the button more thoroughly.

Unrecognised architecture on host system: ARM64

While building the project with cmake, I get an unexpected error that I can only assume has something to do with my laptop CPU architecture. Currently, I'm running a Parallels VM of Windows 11 on a M1 Max MacBook Pro.

As such, I could not find the ARM64 CPU type listed under .\cmake\Modules\SwiftSupport.cmake. Is this something that can be altered to support Apple Silicon Macs (running a VM)?

The error occurred while running the suggested session line:
cmake -B build -D BUILD_SHARED_LIBS=YES -D CMAKE_BUILD_TYPE=Release -D CMAKE_Swift_FLAGS="-sdk %SDKROOT%" -G Ninja -S .

This was the output at the end:

CMake Error at cmake/Modules/SwiftSupport.cmake:41 (message):
  Unrecognized architecture on host system: ARM64
Call Stack (most recent call first):
  cmake/Modules/SwiftSupport.cmake:80 (get_swift_host_arch)
  Packages/swift-collections/Sources/Collections/CMakeLists.txt:18 (_install_target)


-- Configuring incomplete, errors occurred!
See also "C:/dev/swift/sandbox/swift-win32/build/CMakeFiles/CMakeOutput.log".
See also "C:/dev/swift/sandbox/swift-win32/build/CMakeFiles/CMakeError.log".

Please also see the CMakeError.log file attached.
CMakeError.log

Failure with WinSDK

Hello,

Thank you for your awesome work,

I have a failure when i try to use ninja -C build SwiftWin32 UICatalog

ninja: Entering directory `build'
FAILED: bin/SwiftCOM.dll Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/COMBase.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Shell.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Extensions/COMTypes+Extensions.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Extensions/String+Extensions.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Extensions/WinSDK+Extensions.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Implementation/Human/IFileOperationProgressSink.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IBindCtx.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IEnumMoniker.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IEnumString.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IEnumUnknown.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IErrorLog.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IFileOperation.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IMalloc.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IMoniker.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IObjectWithPropertyKey.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IOperationsProgressDialog.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IPersist.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IPersistStream.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IPropertyBag2.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IPropertyChange.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IPropertyChangeArray.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IRunningObjectTable.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IShellItem.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IStream.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmap.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapClipper.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapCodecInfo.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapDecoder.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapDecoderInfo.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapEncoder.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapEncoderInfo.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapFlipRotator.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapFrameDecode.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapFrameEncode.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapLock.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapScaler.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapSource.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICColorContext.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICColorTransform.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICComponentInfo.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICFastMetadataEncoder.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICFormatConverter.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICImagingFactory.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICMetadataQueryReader.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICMetadataQueryWriter.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICPalette.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICStream.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/ITypeComp.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/ITypeInfo.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/ITypeLib.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/IUnknown.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Support/Error.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Support/RawTyped.swift.obj swift/SwiftCOM.swiftmodule lib/SwiftCOM.lib
cmd.exe /C "cd . && C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe -output-file-map Sources\CMakeFiles\SwiftCOM.dir\Release\output-file-map.json -incremental -j 8 -emit-library -o bin\SwiftCOM.dll -module-name SwiftCOM -module-link-name SwiftCOM -emit-module -emit-module-path swift\SwiftCOM.swiftmodule -emit-dependencies -DSwiftCOM_EXPORTS -sdk %SDKROOT% -O -libc MD  @CMakeFiles\SwiftCOM.rsp    -Xlinker -implib:lib\SwiftCOM.lib  && cd ."
../Packages/SwiftCOM/Sources/SwiftCOM/COMBase.swift:8:8: error: cannot load underlying module for 'WinSDK'
import WinSDK
       ^
../Packages/SwiftCOM/Sources/SwiftCOM/COMBase.swift:8:8: error: cannot load underlying module for 'WinSDK'
import WinSDK
       ^
../Packages/SwiftCOM/Sources/SwiftCOM/COMBase.swift:8:8: error: cannot load underlying module for 'WinSDK'
import WinSDK
       ^
../Packages/SwiftCOM/Sources/SwiftCOM/COMBase.swift:8:8: error: cannot load underlying module for 'WinSDK'
import WinSDK
       ^
../Packages/SwiftCOM/Sources/SwiftCOM/COMBase.swift:8:8: error: cannot load underlying module for 'WinSDK'
import WinSDK
       ^
../Packages/SwiftCOM/Sources/SwiftCOM/COMBase.swift:8:8: error: cannot load underlying module for 'WinSDK'
import WinSDK
       ^
../Packages/SwiftCOM/Sources/SwiftCOM/COMBase.swift:8:8: error: cannot load underlying module for 'WinSDK'
import WinSDK
       ^
../Packages/SwiftCOM/Sources/SwiftCOM/COMBase.swift:8:8: error: cannot load underlying module for 'WinSDK'
import WinSDK
       ^
ninja: build stopped: subcommand failed.

can you help me please to esolve this issue ?

Thanks

Add keyboard shortcut to enable changing the application orientation

This is useful for having a single application that can work across various Windows devices. In particular, on Surface devices, it is possible for the orientation to change. It would be convenient to have the ability to change the application orientation on desktop devices.

Update UICatalog to prevent console host

#576 reported that the implementation failed to set the correct subsystem for the UI applications resulting in the console host being displayed. Guidance was provided on how to handle this, and that should be applied to the UICatalog demo application.

[Help] unable to invoke subcommand

After i installed i wanted to create my first package like this:

swift package init --type=executable
but i receive the following error. I installed VS with all the needed dependencies.
Any ideas?
error: unable to invoke subcommand: C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-package ()

Greets Jerome

Windows builds are broken

If you go here:

https://dev.azure.com/compnerd/swift-build/_dashboards/dashboard/96ff9e56-df29-4472-acb1-911a4264b3e5

3 options are available for the SDK:

  • Swift SDK for Windows
  • Swift SDK for Windows (VS2017) - by Facebook
  • Swift SDK for Windows (VS2019) - by Facebook

but those pipelines have no successful builds, and the pipelines have even been
deleted. Also I see these:

  • Swift 5.2 Toolchain for Windows x64 (VS2017)
  • Toolchain for Windows x64 (VS2017)
  • Toolchain for Windows x64 (VS2019)

but I tried downloading one and stopped at 700 MB. What is going on? Even
Haskell is not that big.

Not a problem just a question

Hi, I have recently started using Swift on Windows but the fact is that there is absolutely no library for things like http and windows sockets and I was wondering how did you make to import WinSDK into Swift. Iโ€™m currently looking into the code but I canโ€™t find it if you could help me a little bit I am not really familiar with CMake that could explain it but just if you could redirect me to a file it would be really helpful.

Many classes cannot be overwritten

First of all, thank you for making this project! I think it's awesome that we are getting closer to being able to write proper Windows apps in Swift.

I was playing around with this framework and I noticed that I wasn't able to override the ViewController class. I can see that it is marked as public and not open. Is this intentional? Many other classes are also public.

Thanks!

Update Calculator demo to avoid console window

#576 pointed out the fact that we failed to handle the subsystem properly for applications resulting in the console host being displayed for GUI applications. The issue was resolved with guidance on how to resolve the issue. However, we should update the calculator demo to apply the changes.

error: use of unresolved identifier 'DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2'

I'm getting this error after running the following commands:

cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release . -D CMAKE_Swift_FLAGS="-sdk %SDK% -I %SDK%/usr/lib/swift -L %SDK%/usr/lib/swift/%OS%"
ninja -C build SwiftWin32 HelloSwift

I've run curl -sL "https://raw.githubusercontent.com/apple/swift/master/stdlib/public/Platform/winsdk.modulemap" -o "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap" in an administrator Developer prompt and it made no difference.

Is there a different/newer/older modulemap I need to clone?

no such module 'SwiftWin32'

I'm using Windows 10 through Parallels virtual machine in macOS BigSur in Mac. I've installed the December 14, 2020 toolchain snapshot from swift.org! I've set all the things as in swift getting started! The REPL is not working! The example projects are building, but not able to create .exe file due to the below error!

C:\Users\kumarmuthaiah\Documents\Projects>ninja -C build Calculator
ninja: Entering directory `build'
[1/1] Linking Swift executable Calculator\Calculator.exe
FAILED: Calculator/Calculator.exe Calculator/CMakeFiles/Calculator.dir/Calculator.swift.obj Calculator/Calculator.swiftmodule
cmd.exe /C "cd . && C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe -output-file-map Calculator\CMakeFiles\Calculator.dir\Release\output-file-map.json -incremental -j 2 -emit-executable -o Calculator\Calculator.exe -emit-dependencies -sdk C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk -O -libc MD -parse-as-library -sdk C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk -O -libc MD ..\Calculator\Calculator.swift -lSwiftWin32.lib -lSwiftWin32.lib && cmd.exe /C "cd /D C:\Users\kumarmuthaiah\Documents\Projects\build\Calculator && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E copy_if_different C:/Users/kumarmuthaiah/Documents/Projects/Calculator/Calculator.exe.manifest C:/Users/kumarmuthaiah/Documents/Projects/build/Calculator""
..\Calculator\Calculator.swift:8:8: error: no such module 'SwiftWin32'
import SwiftWin32
^
ninja: build stopped: subcommand failed.

error: cannot find type 'BarButtonItem' in scope; examples don't compile

C:\Users\Ilya Bagleybter\Desktop\swift-win32\Sources\SwiftWin32\View Controllers\ViewController.swift:1151:46: error: cannot find type 'BarButtonItem' in scope open func setToolbarItems(_ toolbarItems: [BarButtonItem]?, animated: Bool) { ^~~~~~~~~~~~~ error: fatalError ninja: build stopped: subcommand failed.

since it doesn't appear to be implemented removing any mentions of ViewController.swift fixes it

No UICatalog.exe

When I build the UICatalog with swift build -Xswiftc -use-ld=lld --target UICatalog, there is no UICatalog.exe anywhere in the .build directory.

I don't see any errors during the compilation process. There's just no executable to be found.

.exe

Hello, is it possible now to make an exe file that will store all the necessary libraries in itself?
And what is the likelihood that the builded swift-application will run on old builds of Windows 10?

Thank you.

Use Swift/WinRT to expose the WinRT interfaces

Rather than creating a full set of C APIs for gaining access to the WinRT types, it should now be possible to create a stub library to import the WinRT interfaces and use Swift/COM to expose IInspectable and then build atop that the interfaces that are needed.

Handle text scaling for HiDPI environments/DPI changes

Although views currently scale according to the DPI settings for the monitor, the text currently does not. The TraitCollection type has the necessary information which needs to be wired through to FontMetrics, FontDescriptor, and Font. The Window type conforms to TraitEnvironment and will send the traitCollectionDidChange(_:) which allows the responder chain to react and re-size fonts on views conforming to ContentSizeCategoryAdjusting.

Remove `View.win32.window.style`

The window style view is being cached, but it is unlikely to be valuable enough to do so. This value is easily accessed via the GWL_STYLE and GWL_EXSTYLE properties. We can always add in caching later if it proves to be a performance bottleneck.

View's `frame` setter has different scaling from `frame` init argument

I've configured 200% scaling in Windows settings, and some components in UICatalog now look misplaced:

Screen Shot 2020-12-12 at 19 11 13

The image view, and the table view cells look unexpectedly. Frame for these components is set via frame property, while for the others frame initializer argument is used.

Looks like the coordinates & dimensions for these components should have been multiplied by 2.
Perhaps View.frame.didSet should perform scaling differently?

Examples don't run with SPM

  1. git clone https://github.com/compnerd/swift-win32
  2. cd swift-win32
  3. swift build --product Calculator
  4. cd .build\x86_64-unknown-windows-msvc\debug
  5. Calculator.exe

Expected result: see calculator sample
Actual result: I can see error log in console, and app isn't shuting down until I press Ctrl+C:

2021-07-12T12:01:37+0300 error org.compnerd.swift-win32 : [SwiftWin32] InitCommonControlsEx: Win32 Error 0 - The operation completed successfully.

Microsoft Windows [Version 10.0.19042.1083]

compnerd.org Swift version 5.4.2 (swift-5.4.2-RELEASE)
Target: x86_64-unknown-windows-msvc

Build error: cannot find type 'WICPixelFormatGUID' in scope

I'm trying to build the project with a clean installation of the latest Swift release from https://swift.org/download/, but the build encounters the following error:

$ ninja -C build SwiftWin32 UICatalog
ninja: Entering directory `build'
[1/3] Linking Swift shared library bin\SwiftCOM.dll
FAILED: bin/SwiftCOM.dll Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/COMBase.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Shell.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Extensions/COMTypes+Extensions.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Extensions/String+Extensions.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Extensions/WinSDK+Extensions.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Implementation/Human/IFileOperationProgressSink.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IBindCtx.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IEnumMoniker.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IEnumString.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IEnumUnknown.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IErrorLog.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IFileOperation.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IMalloc.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IMoniker.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IObjectWithPropertyKey.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IOperationsProgressDialog.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IPersist.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IPersistStream.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IPropertyBag2.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IPropertyChange.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IPropertyChangeArray.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IRunningObjectTable.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IShellItem.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IStream.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmap.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapClipper.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapCodecInfo.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapDecoder.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapDecoderInfo.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapEncoder.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapEncoderInfo.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapFlipRotator.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapFrameDecode.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapFrameEncode.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapLock.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapScaler.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICBitmapSource.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICColorContext.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICColorTransform.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICComponentInfo.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICFastMetadataEncoder.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICFormatConverter.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICImagingFactory.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICMetadataQueryReader.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICMetadataQueryWriter.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICPalette.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/Human/IWICStream.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/ITypeComp.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/ITypeInfo.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/ITypeLib.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Interfaces/IUnknown.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Support/Error.swift.obj Sources/CMakeFiles/SwiftCOM.dir/__/Packages/SwiftCOM/Sources/SwiftCOM/Support/RawTyped.swift.obj swift/SwiftCOM.swiftmodule lib/SwiftCOM.lib
cmd.exe /C "cd . && C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe -output-file-map Sources\CMakeFiles\SwiftCOM.dir\Release\output-file-map.json -incremental -j 16 -emit-library -o bin\SwiftCOM.dll -module-name SwiftCOM -module-link-name SwiftCOM -emit-module -emit-module-path swift\SwiftCOM.swiftmodule -emit-dependencies -DSwiftCOM_EXPORTS -sdk C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk -O -libc MD  @CMakeFiles\SwiftCOM.rsp    -Xlinker -implib:lib\SwiftCOM.lib  && cd ."
Active code page: 65001
../Packages/SwiftCOM/Sources/SwiftCOM/Extensions/WinSDK+Extensions.swift:18:56: error: cannot find type 'WICPixelFormatGUID' in scope
public typealias REFWICPixelFormatGUID = UnsafePointer<WICPixelFormatGUID>
                                                       ^~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.

Output of swift -version is

compnerd.org Swift version 5.3.2 (swift-5.3.2-RELEASE)
Target: x86_64-unknown-windows-msvc

Wire up `Stepper` to `TableView` in UICatalog

We can make the stepper control the number of entries in the TableView for now. This would allow for testing the reloadData in TableView more easily. This could be then used to exercise the path identified as being incorrect in #444.

Views and Controls: support actions on `Label`

Hello,

I have a need for clickable Labels in my application. I have pasted the implementation I added below to support this, but my need for this does sort of reveal a weakness in the extendibility of the Views in the library. Should there be a way to distinguish between a nonclickable and a clickable label? Specifically, I needed to add the SS_NOTIFY style to the Static Control to make it clickable, but since "style" is a type variable, there is no way to pass the style as a new parameter. As such, I am forced to create basically a new class to support a clickable Label which doesn't seem ideal.

Is there some way to make the style property on Views parameterizable?

Clickable Label Implementation (additions stolen mostly from existing Button implementation):

import WinSDK

private let SwiftLabelProc: SUBCLASSPROC = { (hWnd, uMsg, wParam, lParam, uIdSubclass, dwRefData) in
  let button: ClickableLabel? = unsafeBitCast(dwRefData, to: AnyObject.self) as? ClickableLabel

  switch uMsg {
  case UINT(WM_LBUTTONUP):
    button?.sendActions(for: .primaryActionTriggered)
  default:
    break
  }

  return DefSubclassProc(hWnd, uMsg, wParam, lParam)
}

public class ClickableLabel: Control {
  private static let `class`: WindowClass = WindowClass(named: WC_STATIC)
  private static let style: WindowStyle = (base: WS_TABSTOP | DWORD(SS_NOTIFY), extended: 0)

  public override var font: Font! {
    get { return super.font }
    set(value) { super.font = value }
  }

  @_Win32WindowText
  public var text: String?

  public init(frame: Rect) {
    super.init(frame: frame, class: ClickableLabel.class, style: ClickableLabel.style)
    _ = SetWindowSubclass(hWnd, SwiftLabelProc, UINT_PTR(1),
    /                     unsafeBitCast(self as AnyObject, to: DWORD_PTR.self))
  }

  // ContentSizeCategoryAdjusting
  public var adjustsFontForContentSizeCategory = false

  // TraitEnvironment
  override public func traitCollectionDidChange(_ previousTraitCollection: TraitCollection?) {
    super.traitCollectionDidChange(previousTraitCollection)
    guard self.adjustsFontForContentSizeCategory else { return }
    self.font = FontMetrics.default.scaledFont(for: self.font,
                                               compatibleWith: traitCollection)
  }
}

extension ClickableLabel: ContentSizeCategoryAdjusting {
}

Could not download the nightly build from Azure?

Hello dev:

I just want to build this project with swift-build, but the toolchain download from the swift.org that not support swift-build.

So i want to download the toolchain from Azue to try it again, but can not download. Thanks.

Can't compile example

I have done and installed everything as in getting started on swift.org.
But when I try to execute make command (copied from Readme) I have this error

The C compiler

    "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx86/x86/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/Dmytro/Downloads/swift-win32-main/swift-win32-main/Examples/UICatalog/build/CMakeFiles/CMakeTmp

What I'm doing wrong?

CMake Error: CMake can not determine linker language for target: UICatalog

Hello. I have build error with your example app (UICatalog).

I have installed all components (Swift and VS) from [https://swift.org/getting-started/#installing-swift](Installing swift)
I have installed CMake and ninja from official sites.

Here is my ERROR.
Have you any ideas what I am doing wrong?

Screenshot 2020-09-27 at 01 55 13

How do you actually use this when you compile with swiftc?

I feel like I should know this, but how do you actually use this? I have built it using cmake as instructed in the readme, but I get errors when using ninja.

Once it is built, how would I actually include it as a dependency when building using swiftc? With SPM it's simple enough, but what about with swiftc, and more specifically, swiftc on windows. This might be a really basic question, but I would appreciate any point in the right direction, blog posts, etc.

View: add support for setting `bounds` and `transform`

These fields are currently being used for the handling of point conversion between views. This prevents the regular testing flow in the package. Adding support to set the values would prevent the need for ENABLE_TESTING.

Command prompt is shown when you launch <appName>.exe

Hi,

As per request from @compnerd I'am moving the discussion about the issue described here, original link: How can I get rid of the command promt window presented with my SwiftWin32 app? to here.

Summary (for those don't wanting to visit Swift Forums): Every time when i manually launch .exe it is presented above Command Prompt window - which i don't whant there :)

Versions of installed software:

  • VS Community 16.10.0
  • Windows SDK 10.0.19041.0
  • MSVCv142 - vs 2019 c++ x64/x86 build tools (Latest)
  • Swift 5.4.1

If you think any other information will help, ask away

Regards,
h4cky

P.S: Interesting thing which I just saw and remembered.
after checking out swift-win32-application as my template on first swift build it shows the following error:
'Application' D:\Developer\sw32a\swift-win32-application: error: product dependency 'SwiftWin32' in package 'swift-win32' not found
which i solve in the following way in Package.swift:

  1. adding name: "SwiftWin32" on .package in root dependencies array
dependencies: [
    .package(name: "SwiftWin32", url: "https://github.com/compnerd/swift-win32.git",
             .branch("main")),
  ],
  1. and changing the dependecies array on my .executableTarget
      dependencies: [
        "SwiftWin32"
        // .product(name: "SwiftWin32", package: "swift-win32"),
      ],

current swift build output:
build.log

stack overflow on repeated async function invocation

I am trying to use swift-win32 to log into a window. Using the UICatalog example I added the following logger (so access to the TextView instance is regulated):

public actor GUILogger {

    private let textView: TextView

    public init(textView: TextView) {
        self.textView = textView
    }

    public func log(_ message: String) async {
        textView.text = (textView.text ?? "") + "\n" + message
    }

}

When I add the following after the call window.makeKeyAndVisible() the messages are written into the text view and the window stays open, so it is working fine:

    Task {
          let logger = GUILogger(textView: textview)

          await logger.log("test message 1")
          await logger.log("test message 2")
          await logger.log("test message 3")
    }

But when I use the following code, the window closes when logging:

    Task {
          let logger = GUILogger(textView: textview)

          await [
              "test message 1",
              "test message 2",
              "test message 3",
          ]
              .forEachAsync { message in
                  await logger.log(message)
              }

    }

The definition of forEachAsync is:

public extension Sequence {

    func forEachAsync(
            _ operation: (Element) async -> Void
    ) async {
        for element in self {
            await operation(element)
        }
    }

}

What could be the cause?

UICatalog resources structure not populated by CMake build

I have just installed the latest Visual Studio, the latest versions of the required components, and the latest Swift for Windows. Following the build instructions for CMake

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

seems to build correctly, but running

%CD%\build\bin\UICatalog.exe

just prints

Good morning!

and then exits.

However, building with

swift build --product UICatalog
copy Examples\UICatalog\UICatalog.exe.manifest .build\x86_64-unknown-windows-msvc\debug\
copy Examples\UICatalog\Info.plist .build\x86_64-unknown-windows-msvc\debug\

succeeds, and then running

%CD%\.build\x86_64-unknown-windows-msvc\debug\UICatalog.exe

works as expected (although swift run UICatalog results in error: Error Domain=NSCocoaErrorDomain Code=256 "(null)").

If I am missing some needed information, let me know and I will provide it.

Labels appear cropped if display scaling is enabled

If I enable 200% scaling in the Windows display settings, labels produced by Swift/Win32 appear cropped in half.

Normally scaling is handled by View.frame.didSet:

ScaleClient(rect: &client, for: GetDpiForWindow(self.hWnd),

However, the Label component creates a WC_STATIC subcomponent with a non-scaled frame:

Extract typography and color information from `Font` and `Color`

The information is vended by the appropriate types, however, the typography and color information is more about the interface style and should be extracted from the classes themselves. More importantly, this is needed to sink the typography information into FontDescriptor.

WinSDK Build Error

I didn't want to pile on in the CMake error issue but I tried building the swift-win32 repo with 5.3 and just now with the dev release from 9/22 and both give the same error.

cmake seems to work

C:\Users\username\source\repos\swift-win32>cmake -B build -D BUILD_SHARED_LIBS=YES -D CMAKE_BUILD_TYPE=Release -D CMAKE_Swift_FLAGS="%SWIFTFLAGS%" -G Ninja -S .
-- The C compiler identification is MSVC 19.27.29112.0
-- The CXX compiler identification is MSVC 19.27.29112.0
-- The Swift compiler identification is Apple 5.3
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working Swift compiler: C:/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
-- Check for working Swift compiler: C:/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe - works
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/username/source/repos/swift-win32/build

ninja seems to fail

ninja: Entering directory `build'
[1/2] Linking Swift shared library bin\SwiftWin32.dll
FAILED: bin/SwiftWin32.dll Sources/CMakeFiles/SwiftWin32.dir/Application/_TriviallyConstructible.swift.obj Sources/CMakeFiles/SwiftWin32.dir/Application/Application.swift.obj Sources/CMakeFiles/SwiftWin32.dir/Application/ApplicationDelegate.swift.obj Sources/CMakeFiles/SwiftWin32.dir/Application/ApplicationMain.swift.obj Sources/CMakeFiles/SwiftWin32.dir/Application/Information.swift.obj Sources/CMakeFiles/SwiftWin32.dir/Application/LaunchKeyOptions.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/AlertAction.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/AlertController.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/AnimationCurve.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/Button.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/Color.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/ContentContainer.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/Control.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/DatePicker.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/Device.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/EdgeInsets.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/Font.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/Label.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/ProgressView.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/Responder.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/Scene.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/SceneConfiguration.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/SceneDelegate.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/SceneSession.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/SceneSizeRestrictions.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/Screen.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/Slider.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/Stepper.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/Switch.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/TextField.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/TextInputTraits.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/TextView.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/TraitCollection.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/TraitEnvironment.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/View.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/ViewController.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/ViewControllerTransitionCoordinator.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/ViewControllerTransitionCoordinatorContext.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/Window.swift.obj Sources/CMakeFiles/SwiftWin32.dir/UI/WindowScene.swift.obj Sources/CMakeFiles/SwiftWin32.dir/CG/AffineTransform.swift.obj Sources/CMakeFiles/SwiftWin32.dir/CG/Point.swift.obj Sources/CMakeFiles/SwiftWin32.dir/CG/Rect.swift.obj Sources/CMakeFiles/SwiftWin32.dir/CG/Size.swift.obj Sources/CMakeFiles/SwiftWin32.dir/Support/BatteryMonitor.swift.obj Sources/CMakeFiles/SwiftWin32.dir/Support/Error.swift.obj Sources/CMakeFiles/SwiftWin32.dir/Support/Logging.swift.obj Sources/CMakeFiles/SwiftWin32.dir/Support/Rect+UIExtensions.swift.obj Sources/CMakeFiles/SwiftWin32.dir/Support/PropertyWrappers.swift.obj Sources/CMakeFiles/SwiftWin32.dir/Support/String+UIExtensions.swift.obj Sources/CMakeFiles/SwiftWin32.dir/Support/WindowClass.swift.obj Sources/CMakeFiles/SwiftWin32.dir/Support/WindowsHandle.swift.obj Sources/CMakeFiles/SwiftWin32.dir/Support/WinSDK+Extensions.swift.obj swift/SwiftWin32.swiftmodule lib/SwiftWin32.lib
cmd.exe /C "cd . && C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe -output-file-map Sources\CMakeFiles\SwiftWin32.dir\Release\output-file-map.json -incremental -j 12 -emit-library -o bin\SwiftWin32.dll -module-name SwiftWin32 -module-link-name SwiftWin32 -emit-module -emit-module-path swift\SwiftWin32.swiftmodule -emit-dependencies -DSwiftWin32_EXPORTS -sdk C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk -I C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk/usr/lib/swift -L C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk/usr/lib/swift/windows -O -libc MD -Xcc -DNONAMELESSUNION -Xcc -DCOBJMACROS  @CMakeFiles\SwiftWin32.rsp    -Xlinker -implib:lib\SwiftWin32.lib  && cd ."
<unknown>:0: error: cannot load underlying module for 'WinSDK'
<unknown>:0: error: cannot load underlying module for 'WinSDK'
<unknown>:0: error: cannot load underlying module for 'WinSDK'
<unknown>:0: error: cannot load underlying module for 'WinSDK'
<unknown>:0: error: cannot load underlying module for 'WinSDK'
<unknown>:0: error: cannot load underlying module for 'WinSDK'
<unknown>:0: error: cannot load underlying module for 'WinSDK'
<unknown>:0: error: cannot load underlying module for 'WinSDK'
<unknown>:0: error: cannot load underlying module for 'WinSDK'
<unknown>:0: error: cannot load underlying module for 'WinSDK'
<unknown>:0: error: cannot load underlying module for 'WinSDK'
<unknown>:0: error: cannot load underlying module for 'WinSDK'
ninja: build stopped: subcommand failed.

I have the latest Windows sdk installed 10.0.19041.0 but I'm not sure if it's using it properly.

[EDIT]
I take it back. I can see with cmake-gui.exe that it does find the win sdk because it has this defined
C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x64/mt.exe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.