Linking swift-win32 sample code failed

The following are the steps that I have made:

  1. install 'Visual Studio 2019'
  2. Download 'swift-5.3.2-RELEASE-windows10.exe' and install it.
  3. Download 'Windows Software Development Kit 10.0.19041.685' and install it.
  4. Open an 'x64 Native Tools for VS2019 Command Prompt' and execute the copy commands:
copy %SDKROOT%\usr\share\ucrt.modulemap "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap"
copy %SDKROOT%\usr\share\visualc.modulemap "%VCToolsInstallDir%\include\module.modulemap"
copy %SDKROOT%\usr\share\visualc.apinotes "%VCToolsInstallDir%\include\visualc.apinotes"
copy %SDKROOT%\usr\share\winsdk.modulemap "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap"
  1. Clone 'swift-win32' project from github.
  2. Execute the following commands:
set SDKROOT=%SystemDrive%/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk
set SWIFTFLAGS=-sdk %SDKROOT% -I %SDKROOT%/usr/lib/swift -L %SDKROOT%/usr/lib/swift/windows

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

The cmake command succeeded but the ninja command failed with the following error messages:

C:\chenchang\study\swift-win32>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\output-file-map.json -incremental -j 6 -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 %SWIFTFLAGS% -O -libc MD  @CMakeFiles\SwiftCOM.rsp    -Xlinker -implib:lib\SwiftCOM.lib  && cd ."
..\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.

Could anyone give some advices?

The following are the swift on my computer:

C:\chenchang\study\swift-win32>swift --version
compnerd.org Swift version 5.3.2 (swift-5.3.2-RELEASE)
Target: x86_64-unknown-windows-msvc

I have intalled the 'Python 3.8' and set 'SWIFTFLAGS' environment variable. When I tried to run swift REPL but the command just exited immediate and nothing happen.

C:\chenchang\study\swift-win32>where python
C:\Users\shche\AppData\Local\Programs\Python\Python38\python.exe
C:\Users\shche\AppData\Local\Microsoft\WindowsApps\python.exe

C:\chenchang\study\swift-win32>echo %SWIFTFLAGS%
-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

C:\chenchang\study\swift-win32>swift repl -target x86_64-unknown-windows-msvc %SWIFTFLAGS%

C:\chenchang\study\swift-win32>

The reason that this fails is that the current development is much further along and requires a newer WinSDK modulemap than what was part of 5.3. The best option IMO is to use the development snapshot (12/14 should be reasonable). My, you can try to play around with the WinSDK module map, but I expect that to be much more difficult.

I tried the following combinations:

swift-5.3.1-RELEASE-Windows10.exe and Windows SDK 10.0.18362.0
swift-5.3.1-RELEASE-Windows10.exe and Windows SDK 10.0.19041.0
swift-5.3.2-RELEASE-Windows10.exe and Windows SDK 10.0.18362.0
swift-5.3.2-RELEASE-Windows10.exe and Windows SDK 10.0.19041.0

This error still exits.

C:\chenchang\study\swift-win32>set SWIFTFLAGS=-sdk %SDKROOT% -I %SDKROOT%/usr/lib/swift -L %SDKROOT%/usr/lib/swift/windows

C:\chenchang\study\swift-win32>
C:\chenchang\study\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.24.28315.0
-- The CXX compiler identification is MSVC 19.24.28315.0
-- The Swift compiler identification is Apple 5.3.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- 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
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.25.0.windows.1")
-- Building with sub-modules:
--   Cassowary rGa438611
--   Swift/COM rGebbc617
-- Configuring done
-- Generating done
-- Build files have been written to: C:/chenchang/study/swift-win32/build

C:\chenchang\study\swift-win32>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\output-file-map.json -incremental -j 6 -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 -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  @CMakeFiles\SwiftCOM.rsp    -Xlinker -implib:lib\SwiftCOM.lib  && cd ."
..\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.

C:\chenchang\study\swift-win32>

I write a simple Hello.swift file and it can be built:

Hello.swift

print("Hello, world!")
C:\chenchang\study\swift_study>swiftc %SWIFTFLAGS% -emit-executable -o Hello.exe Hello.swift
  正在创建库 Hello.lib 和对象 Hello.exp

C:\chenchang\study\swift_study>hello.exe
hello, world!

Correct, that is exactly expected. The releases that you tried are 5.3, and building the project from the current development state of the tree requires the development snapshot (5.4 pre-releases).