Skip to content

Commit 102c60b

Browse files
authored
Merge pull request #68743 from bnbarham/compnerd-59-windows-no-subst
[5.9] Enable macros on Windows
2 parents 0a8d0e8 + d1553c9 commit 102c60b

File tree

4 files changed

+72
-8
lines changed

4 files changed

+72
-8
lines changed

test/Interop/Cxx/class/method/msvc-abi-return-indirect-trivial-record.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// RUN: %target-swift-emit-irgen -I %t/Inputs -enable-experimental-cxx-interop -Xcc -std=c++17 %t/test.swift -module-name Test | %FileCheck %s
44

55
// REQUIRES: OS=windows-msvc
6+
// XFAIL: OS=windows-msvc
67

78
//--- Inputs/module.modulemap
89
module MsvcUseVecIt {

test/lit.cfg

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ config.gyb = make_path(config.swift_utils, 'gyb.py')
351351
config.rth = make_path(config.swift_utils, 'rth') # Resilience test helper
352352
config.scale_test = make_path(config.swift_utils, 'scale-test')
353353
config.PathSanitizingFileCheck = make_path(config.swift_utils, 'PathSanitizingFileCheck')
354+
config.swift_bin_dir = make_path(config.swift, '..', '..', 'bin')
354355
config.swift_lib_dir = make_path(config.swift, '..', '..', 'lib')
355356
config.swift_libexec_dir = make_path(config.swift, '..', '..', 'libexec')
356357
config.round_trip_syntax_test = make_path(config.swift_utils, 'round-trip-syntax-test')
@@ -2711,8 +2712,8 @@ run_filecheck = '%s %s --allow-unused-prefixes --sanitize BUILD_DIR=%s --sanitiz
27112712
# we provide we use realpath here. Because PathSanitizingFileCheck only
27122713
# understands sanitize patterns with forward slashes, and realpath normalizes
27132714
# the slashes, we have to replace them back to forward slashes.
2714-
shell_quote(os.path.realpath(swift_obj_root).replace("\\", "/")),
2715-
shell_quote(os.path.realpath(config.swift_src_root).replace("\\", "/")),
2715+
shell_quote(lit.util.abs_path_preserve_drive(swift_obj_root).replace("\\", "/")),
2716+
shell_quote(lit.util.abs_path_preserve_drive(config.swift_src_root).replace("\\", "/")),
27162717
shell_quote(config.filecheck),
27172718
'--enable-windows-compatibility' if kIsWindows else '')
27182719

test/lit.site.cfg.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import os
1414
import platform
1515
import sys
16+
import lit.util
1617

1718
config.cmake = "@CMAKE_COMMAND@"
1819
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
@@ -170,6 +171,6 @@ if '@SWIFT_SWIFT_PARSER@' == 'TRUE':
170171

171172
# Let the main config do the real work.
172173
if config.test_exec_root is None:
173-
config.test_exec_root = os.path.dirname(os.path.realpath(__file__))
174+
config.test_exec_root = os.path.dirname(lit.util.abs_path_preserve_drive(__file__))
174175
lit_config.load_config(
175176
config, os.path.join(config.swift_src_root, "test", "lit.cfg"))

utils/build-windows-toolchain.bat

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ del /f /q "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap"
5454
del /f /q "%VCToolsInstallDir%\include\module.modulemap"
5555
del /f /q "%VCToolsInstallDir%\include\vcruntime.apinotes"
5656

57+
call :FetchWiX || (exit /b)
58+
call :FetchX64Toolchain || (exit /b)
5759
call :CloneDependencies || (exit /b)
5860
call :CloneRepositories || (exit /b)
5961

@@ -190,6 +192,33 @@ cmake ^
190192
cmake --build "%BuildRoot%\curl" || (exit /b)
191193
cmake --build "%BuildRoot%\curl" --target install || (exit /b)
192194

195+
path %BuildRoot%\toolchains\5.9.0\PFiles64\Swift\runtime-development\usr\bin;%BuildRoot%\toolchains\5.9.0\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;%Path%
196+
197+
:: Build Swift Syntax
198+
cmake ^
199+
-B "%BuildRoot%\99" ^
200+
201+
-D BUILD_SHARED_LIBS=YES ^
202+
-D CMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^
203+
-D CMAKE_C_COMPILER=cl.exe ^
204+
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
205+
-D CMAKE_CXX_COMPILER=cl ^
206+
-D CMAKE_CXX_FLAGS="/GS- /Oy /Gw /Gy" ^
207+
-D CMAKE_MT=mt ^
208+
-D CMAKE_Swift_COMPILER=%BuildRoot%/toolchains/5.9.0/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe ^
209+
-D CMAKE_Swift_FLAGS="-sdk %BuildRoot%/toolchains/5.9.0/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk" ^
210+
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
211+
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^
212+
-D CMAKE_Swift_FLAGS_RELEASE="-O" ^
213+
-D CMAKE_Swift_FLAGS_RELWITHDEBINFO="-O" ^
214+
215+
-D CMAKE_INSTALL_PREFIX="%InstallRoot%" ^
216+
217+
-G Ninja ^
218+
-S %SourceRoot%\swift-syntax || (exit /b)
219+
cmake --build %BuildRoot%\99 || (exit /b)
220+
cmake --build %BuildRoot%\99 --target install || (exit /b)
221+
193222
:: Build Toolchain
194223
cmake ^
195224
-B "%BuildRoot%\1" ^
@@ -207,11 +236,17 @@ cmake ^
207236

208237
-D CMAKE_INSTALL_PREFIX="%InstallRoot%" ^
209238

239+
-D CMAKE_Swift_COMPILER="%BuildRoot%/toolchains/5.9.0/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe" ^
240+
-D CMAKE_Swift_FLAGS="-sdk %BuildRoot%/toolchains/5.9.0/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk" ^
241+
210242
-D LLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-windows-msvc ^
211243

212244
-D PACKAGE_VENDOR="swift.org" ^
213245
-D CLANG_VENDOR="swift.org" ^
214246
-D CLANG_VENDOR_UTI="org.swift" ^
247+
-D LLDB_PYTHON_EXE_RELATIVE_PATH=python.exe ^
248+
-D LLDB_PYTHON_EXT_SUFFIX=.pyd ^
249+
-D LLDB_PYTHON_RELATIVE_PATH=lib/site-packages ^
215250
-D LLVM_APPEND_VC_REV=NO ^
216251
-D LLVM_VERSION_SUFFIX="" ^
217252

@@ -226,9 +261,11 @@ cmake ^
226261
-D LLVM_EXTERNAL_CMARK_SOURCE_DIR="%SourceRoot%\cmark" ^
227262
-D PYTHON_HOME=%PYTHON_HOME% ^
228263
-D PYTHON_EXECUTABLE=%PYTHON_HOME%\python.exe ^
264+
-D SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR="%BuildRoot%\99" ^
229265
-D SWIFT_PATH_TO_LIBDISPATCH_SOURCE="%SourceRoot%\swift-corelibs-libdispatch" ^
230266
-D SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE="%SourceRoot%\swift-syntax" ^
231267
-D SWIFT_PATH_TO_STRING_PROCESSING_SOURCE=%SourceRoot%\swift-experimental-string-processing ^
268+
-D SWIFT_PATH_TO_SWIFT_SDK="%BuildRoot%/toolchains/5.9.0/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk" ^
232269

233270
-G Ninja ^
234271
-S llvm-project\llvm || (exit /b)
@@ -744,25 +781,25 @@ python -c "import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'D
744781
:: TODO(compnerd) match the XCTest installation name
745782
python -c "import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'XCTEST_VERSION': 'development' } }), encoding='utf-8'))" > %PlatformRoot%\Info.plist
746783

747-
IF NOT "%SKIP_PACKAGING%"=="1" call :PackageToolchain
784+
IF NOT "%SKIP_PACKAGING%"=="1" call :PackageToolchain || (exit /b)
748785

749786
:: TODO(compnerd) test LLVM
750787

751788
SET SKIP_TEST=0
752789
FOR %%T IN (%SKIP_TESTS%) DO (IF /I %%T==swift SET SKIP_TEST=1)
753-
IF "%SKIP_TEST%"=="0" call :TestSwift
790+
IF "%SKIP_TEST%"=="0" call :TestSwift || (exit /b)
754791

755792
SET SKIP_TEST=0
756793
FOR %%T IN (%SKIP_TESTS%) DO (IF /I %%T==dispatch SET SKIP_TEST=1)
757-
IF "%SKIP_TEST%"=="0" call :TestDispatch
794+
IF "%SKIP_TEST%"=="0" call :TestDispatch || (exit /b)
758795

759796
SET SKIP_TEST=0
760797
FOR %%T IN (%SKIP_TESTS%) DO (IF /I %%T==foundation SET SKIP_TEST=1)
761-
IF "%SKIP_TEST%"=="0" call :TestFoundation
798+
IF "%SKIP_TEST%"=="0" call :TestFoundation || (exit /b)
762799

763800
SET SKIP_TEST=0
764801
FOR %%T IN (%SKIP_TESTS%) DO (IF /I %%T==xctest SET SKIP_TEST=1)
765-
IF "%SKIP_TEST%"=="0" call :TestXCTest
802+
IF "%SKIP_TEST%"=="0" call :TestXCTest || (exit /b)
766803

767804
:: Clean up the module cache
768805
rd /s /q %LocalAppData%\clang\ModuleCache
@@ -815,6 +852,30 @@ git clone --quiet --no-tags --depth 1 --branch curl-7_77_0 https://github.com/cu
815852
goto :eof
816853
endlocal
817854

855+
:FetchWiX
856+
setlocal enableextensions enabledelayedexpansion
857+
858+
curl.exe -sL https://www.nuget.org/api/v2/package/wix/4.0.1 -o wix-4.0.1.zip
859+
md WiX-4.0.1 || exit (/b)
860+
cd WiX-4.0.1 || exit (/b)
861+
tar -xf ../wix-4.0.1.zip || exit (/b)
862+
863+
goto :eof
864+
endlocal
865+
866+
:FetchX64Toolchain
867+
setlocal enableextensions enabledelayedexpansion
868+
869+
curl.exe -k -sOL "https://download.swift.org/swift-5.9-release/windows10/swift-5.9-RELEASE/swift-5.9-RELEASE-windows10.exe" || (exit /b)
870+
"WiX-4.0.1\tools\net6.0\any\wix.exe" burn extract swift-5.9-RELEASE-windows10.exe -o %BuildRoot%\toolchains || (exit /b)
871+
msiexec.exe /qn /a "%BuildRoot%\toolchains\a0" TARGETDIR="%BuildRoot%\toolchains\5.9.0\" || (exit /b)
872+
msiexec.exe /qn /a "%BuildRoot%\toolchains\a1" TARGETDIR="%BuildRoot%\toolchains\5.9.0\" || (exit /b)
873+
msiexec.exe /qn /a "%BuildRoot%\toolchains\a2" TARGETDIR="%BuildRoot%\toolchains\5.9.0\" || (exit /b)
874+
msiexec.exe /qn /a "%BuildRoot%\toolchains\a3" TARGETDIR="%BuildRoot%\toolchains\5.9.0\" || (exit /b)
875+
876+
goto :eof
877+
endlocal
878+
818879
:TestSwift
819880
setlocal enableextensions enabledelayedexpansion
820881

0 commit comments

Comments
 (0)