@@ -1320,6 +1320,10 @@ function Build-CMakeProject {
1320
1320
Add-KeyValueIfNew $Defines CMAKE_SYSTEM_PROCESSOR $Platform.Architecture.CMakeName
1321
1321
}
1322
1322
1323
+ # Always prefer the CONFIG format for the packages so that we can build
1324
+ # against the build tree.
1325
+ Add-KeyValueIfNew $Defines CMAKE_FIND_PACKAGE_PREFER_CONFIG YES
1326
+
1323
1327
switch ($Platform.OS ) {
1324
1328
Windows {
1325
1329
if ($UseASM ) {
@@ -1913,7 +1917,6 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch]
1913
1917
return $TestDefines + $DebugDefines + @ {
1914
1918
CLANG_TABLEGEN = (Join-Path - Path $BuildTools - ChildPath " clang-tblgen.exe" );
1915
1919
CLANG_TIDY_CONFUSABLE_CHARS_GEN = (Join-Path - Path $BuildTools - ChildPath " clang-tidy-confusable-chars-gen.exe" );
1916
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
1917
1920
CMAKE_Swift_FLAGS = $SwiftFlags ;
1918
1921
LibXml2_DIR = " $BinaryCache \$ ( $Platform.Triple ) \usr\lib\cmake\libxml2-2.11.5" ;
1919
1922
LLDB_LIBXML2_VERSION = " 2.11.5" ;
@@ -2121,7 +2124,6 @@ function Build-LLVM([Hashtable] $Platform) {
2121
2124
- Platform $Platform `
2122
2125
- UseBuiltCompilers C, CXX `
2123
2126
- Defines @ {
2124
- CMAKE_SYSTEM_NAME = $Platform.OS.ToString ();
2125
2127
LLVM_HOST_TRIPLE = $Platform.Triple ;
2126
2128
}
2127
2129
}
@@ -2144,7 +2146,6 @@ function Build-Sanitizers([Hashtable] $Platform) {
2144
2146
- UseBuiltCompilers ASM, C, CXX `
2145
2147
- BuildTargets " install-compiler-rt" `
2146
2148
- Defines (@ {
2147
- CMAKE_SYSTEM_NAME = $Platform.OS.ToString ();
2148
2149
LLVM_DIR = " $LLVMTargetCache \lib\cmake\llvm" ;
2149
2150
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR = " YES" ;
2150
2151
COMPILER_RT_DEFAULT_TARGET_ONLY = " YES" ;
@@ -2157,8 +2158,7 @@ function Build-Sanitizers([Hashtable] $Platform) {
2157
2158
- Platform $Platform `
2158
2159
- UseBuiltCompilers ASM, C, CXX `
2159
2160
- BuildTargets " install-compiler-rt" `
2160
- - Defines (@ {
2161
- CMAKE_SYSTEM_NAME = $Platform.OS.ToString ();
2161
+ - Defines @ {
2162
2162
LLVM_DIR = " $LLVMTargetCache \lib\cmake\llvm" ;
2163
2163
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR = " YES" ;
2164
2164
COMPILER_RT_DEFAULT_TARGET_ONLY = " YES" ;
@@ -2169,7 +2169,7 @@ function Build-Sanitizers([Hashtable] $Platform) {
2169
2169
COMPILER_RT_BUILD_XRAY = " NO" ;
2170
2170
COMPILER_RT_BUILD_PROFILE = " YES" ;
2171
2171
COMPILER_RT_BUILD_SANITIZERS = " YES" ;
2172
- })
2172
+ }
2173
2173
}
2174
2174
2175
2175
function Build-ZLib ([Hashtable ] $Platform ) {
@@ -2182,7 +2182,6 @@ function Build-ZLib([Hashtable] $Platform) {
2182
2182
- Defines @ {
2183
2183
BUILD_SHARED_LIBS = " NO" ;
2184
2184
CMAKE_POSITION_INDEPENDENT_CODE = " YES" ;
2185
- CMAKE_SYSTEM_NAME = $Platform.OS.ToString ();
2186
2185
}
2187
2186
}
2188
2187
@@ -2196,7 +2195,6 @@ function Build-XML2([Hashtable] $Platform) {
2196
2195
- Defines @ {
2197
2196
BUILD_SHARED_LIBS = " NO" ;
2198
2197
CMAKE_POSITION_INDEPENDENT_CODE = " YES" ;
2199
- CMAKE_SYSTEM_NAME = $Platform.OS.ToString ();
2200
2198
LIBXML2_WITH_ICONV = " NO" ;
2201
2199
LIBXML2_WITH_ICU = " NO" ;
2202
2200
LIBXML2_WITH_LZMA = " NO" ;
@@ -2227,7 +2225,6 @@ function Build-DS2([Hashtable] $Platform) {
2227
2225
- InstallTo " $ ( Get-PlatformRoot $Platform.OS ) \Developer\Library\ds2\usr" `
2228
2226
- Platform $Platform `
2229
2227
- Defines @ {
2230
- CMAKE_SYSTEM_NAME = $Platform.OS.ToString ();
2231
2228
DS2_REGSGEN2 = " $ ( Get-ProjectBinaryCache $BuildPlatform RegsGen2) /regsgen2.exe" ;
2232
2229
DS2_PROGRAM_PREFIX = " $ ( Get-ModuleTriple $Platform ) -" ;
2233
2230
BISON_EXECUTABLE = " $ ( Get-BisonExecutable ) " ;
@@ -2253,7 +2250,6 @@ function Build-CURL([Hashtable] $Platform) {
2253
2250
BUILD_SHARED_LIBS = " NO" ;
2254
2251
BUILD_TESTING = " NO" ;
2255
2252
CMAKE_POSITION_INDEPENDENT_CODE = " YES" ;
2256
- CMAKE_SYSTEM_NAME = $Platform.OS.ToString ();
2257
2253
BUILD_CURL_EXE = " NO" ;
2258
2254
BUILD_LIBCURL_DOCS = " NO" ;
2259
2255
BUILD_MISC_DOCS = " NO" ;
@@ -2365,8 +2361,6 @@ function Build-Runtime([Hashtable] $Platform) {
2365
2361
- SwiftSDK $null `
2366
2362
- CacheScript $SourceCache \swift\cmake\caches\Runtime- $ ($Platform.OS.ToString ())- $ ($Platform.Architecture.LLVMName ).cmake `
2367
2363
- Defines ($PlatformDefines + @ {
2368
- CMAKE_Swift_COMPILER_WORKS = " YES" ;
2369
- CMAKE_SYSTEM_NAME = $Platform.OS.ToString ();
2370
2364
LLVM_DIR = " $ ( Get-ProjectBinaryCache $Platform LLVM) \lib\cmake\llvm" ;
2371
2365
SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY = " YES" ;
2372
2366
SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP = " YES" ;
@@ -2484,7 +2478,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2484
2478
- UseGNUDriver `
2485
2479
- Defines @ {
2486
2480
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2487
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2488
2481
# TODO(compnerd) enforce dynamic linking of BlocksRuntime and dispatch.
2489
2482
CMAKE_CXX_FLAGS = $ (if ($Static ) { @ (" -Ddispatch_STATIC" ) } else { @ () });
2490
2483
CMAKE_Swift_FLAGS = $ (if ($Static ) { @ (" -Xcc" , " -static-libclosure" ) } else { @ () });
@@ -2509,7 +2502,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2509
2502
- UseGNUDriver `
2510
2503
- Defines @ {
2511
2504
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2512
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2513
2505
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2514
2506
2515
2507
SwiftCore_DIR = " ${RuntimeBinaryCache} \cmake\SwiftCore" ;
@@ -2525,7 +2517,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2525
2517
- UseGNUDriver `
2526
2518
- Defines @ {
2527
2519
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2528
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2529
2520
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2530
2521
2531
2522
SwiftCore_DIR = " ${RuntimeBinaryCache} \cmake\SwiftCore" ;
@@ -2541,7 +2532,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2541
2532
- UseGNUDriver `
2542
2533
- Defines @ {
2543
2534
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2544
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2545
2535
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2546
2536
2547
2537
SwiftCore_DIR = " ${RuntimeBinaryCache} \cmake\SwiftCore" ;
@@ -2558,7 +2548,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2558
2548
- UseGNUDriver `
2559
2549
- Defines @ {
2560
2550
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2561
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2562
2551
# FIXME(#83449): avoid using `SwiftCMakeConfig.h`
2563
2552
CMAKE_CXX_FLAGS = @ (" -I${RuntimeBinaryCache} \include" );
2564
2553
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2577,7 +2566,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2577
2566
- UseGNUDriver `
2578
2567
- Defines @ {
2579
2568
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2580
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2581
2569
# FIXME(#83449): avoid using `SwiftCMakeConfig.h`
2582
2570
CMAKE_CXX_FLAGS = @ (" -I${RuntimeBinaryCache} \include" );
2583
2571
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2596,7 +2584,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2596
2584
- UseGNUDriver `
2597
2585
- Defines @ {
2598
2586
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2599
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2600
2587
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2601
2588
2602
2589
SwiftCore_DIR = " ${RuntimeBinaryCache} \cmake\SwiftCore" ;
@@ -2723,7 +2710,6 @@ function Build-Foundation {
2723
2710
- SwiftSDK $SwiftSDK `
2724
2711
- Defines @ {
2725
2712
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2726
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2727
2713
CMAKE_NINJA_FORCE_RESPONSE_FILE = " YES" ;
2728
2714
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2729
2715
CMAKE_Swift_FLAGS = $SwiftFlags ;
@@ -2942,7 +2928,6 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
2942
2928
- SwiftSDK (Get-SwiftSDK $Platform.OS - Identifier " $ ( $Platform.OS ) Experimental" ) `
2943
2929
- Defines @ {
2944
2930
BUILD_SHARED_LIBS = " NO" ;
2945
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2946
2931
CMAKE_Swift_FLAGS = @ (" -static-stdlib" , " -Xfrontend" , " -use-static-resource-dir" );
2947
2932
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2948
2933
@@ -3014,7 +2999,6 @@ function Build-ToolsSupportCore([Hashtable] $Platform) {
3014
2999
- SwiftSDK (Get-SwiftSDK $Platform.OS ) `
3015
3000
- Defines @ {
3016
3001
BUILD_SHARED_LIBS = " YES" ;
3017
- CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
3018
3002
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
3019
3003
3020
3004
Foundation_DIR = $ (Get-ProjectCMakeModules $Platform DynamicFoundation);
0 commit comments