Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 6 additions & 22 deletions utils/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,10 @@ function Build-CMakeProject {
Add-KeyValueIfNew $Defines CMAKE_SYSTEM_PROCESSOR $Platform.Architecture.CMakeName
}

# Always prefer the CONFIG format for the packages so that we can build
# against the build tree.
Add-KeyValueIfNew $Defines CMAKE_FIND_PACKAGE_PREFER_CONFIG YES

switch ($Platform.OS) {
Windows {
if ($UseASM) {
Expand Down Expand Up @@ -1913,7 +1917,6 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch]
return $TestDefines + $DebugDefines + @{
CLANG_TABLEGEN = (Join-Path -Path $BuildTools -ChildPath "clang-tblgen.exe");
CLANG_TIDY_CONFUSABLE_CHARS_GEN = (Join-Path -Path $BuildTools -ChildPath "clang-tidy-confusable-chars-gen.exe");
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
CMAKE_Swift_FLAGS = $SwiftFlags;
LibXml2_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\libxml2-2.11.5";
LLDB_LIBXML2_VERSION = "2.11.5";
Expand Down Expand Up @@ -2121,7 +2124,6 @@ function Build-LLVM([Hashtable] $Platform) {
-Platform $Platform `
-UseBuiltCompilers C,CXX `
-Defines @{
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
LLVM_HOST_TRIPLE = $Platform.Triple;
}
}
Expand All @@ -2144,7 +2146,6 @@ function Build-Sanitizers([Hashtable] $Platform) {
-UseBuiltCompilers ASM,C,CXX `
-BuildTargets "install-compiler-rt" `
-Defines (@{
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
LLVM_DIR = "$LLVMTargetCache\lib\cmake\llvm";
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR = "YES";
COMPILER_RT_DEFAULT_TARGET_ONLY = "YES";
Expand All @@ -2157,8 +2158,7 @@ function Build-Sanitizers([Hashtable] $Platform) {
-Platform $Platform `
-UseBuiltCompilers ASM,C,CXX `
-BuildTargets "install-compiler-rt" `
-Defines (@{
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
-Defines @{
LLVM_DIR = "$LLVMTargetCache\lib\cmake\llvm";
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR = "YES";
COMPILER_RT_DEFAULT_TARGET_ONLY = "YES";
Expand All @@ -2169,7 +2169,7 @@ function Build-Sanitizers([Hashtable] $Platform) {
COMPILER_RT_BUILD_XRAY = "NO";
COMPILER_RT_BUILD_PROFILE = "YES";
COMPILER_RT_BUILD_SANITIZERS = "YES";
})
}
}

function Build-ZLib([Hashtable] $Platform) {
Expand All @@ -2182,7 +2182,6 @@ function Build-ZLib([Hashtable] $Platform) {
-Defines @{
BUILD_SHARED_LIBS = "NO";
CMAKE_POSITION_INDEPENDENT_CODE = "YES";
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
}
}

Expand All @@ -2196,7 +2195,6 @@ function Build-XML2([Hashtable] $Platform) {
-Defines @{
BUILD_SHARED_LIBS = "NO";
CMAKE_POSITION_INDEPENDENT_CODE = "YES";
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
LIBXML2_WITH_ICONV = "NO";
LIBXML2_WITH_ICU = "NO";
LIBXML2_WITH_LZMA = "NO";
Expand Down Expand Up @@ -2227,7 +2225,6 @@ function Build-DS2([Hashtable] $Platform) {
-InstallTo "$(Get-PlatformRoot $Platform.OS)\Developer\Library\ds2\usr" `
-Platform $Platform `
-Defines @{
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
DS2_REGSGEN2 = "$(Get-ProjectBinaryCache $BuildPlatform RegsGen2)/regsgen2.exe";
DS2_PROGRAM_PREFIX = "$(Get-ModuleTriple $Platform)-";
BISON_EXECUTABLE = "$(Get-BisonExecutable)";
Expand All @@ -2253,7 +2250,6 @@ function Build-CURL([Hashtable] $Platform) {
BUILD_SHARED_LIBS = "NO";
BUILD_TESTING = "NO";
CMAKE_POSITION_INDEPENDENT_CODE = "YES";
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
BUILD_CURL_EXE = "NO";
BUILD_LIBCURL_DOCS = "NO";
BUILD_MISC_DOCS = "NO";
Expand Down Expand Up @@ -2365,8 +2361,6 @@ function Build-Runtime([Hashtable] $Platform) {
-SwiftSDK $null `
-CacheScript $SourceCache\swift\cmake\caches\Runtime-$($Platform.OS.ToString())-$($Platform.Architecture.LLVMName).cmake `
-Defines ($PlatformDefines + @{
CMAKE_Swift_COMPILER_WORKS = "YES";
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
LLVM_DIR = "$(Get-ProjectBinaryCache $Platform LLVM)\lib\cmake\llvm";
SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY = "YES";
SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP = "YES";
Expand Down Expand Up @@ -2484,7 +2478,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
-UseGNUDriver `
-Defines @{
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
# TODO(compnerd) enforce dynamic linking of BlocksRuntime and dispatch.
CMAKE_CXX_FLAGS = $(if ($Static) { @("-Ddispatch_STATIC") } else { @() });
CMAKE_Swift_FLAGS = $(if ($Static) { @("-Xcc", "-static-libclosure") } else { @() });
Expand All @@ -2509,7 +2502,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
-UseGNUDriver `
-Defines @{
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";

SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
Expand All @@ -2525,7 +2517,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
-UseGNUDriver `
-Defines @{
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";

SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
Expand All @@ -2541,7 +2532,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
-UseGNUDriver `
-Defines @{
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";

SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
Expand All @@ -2558,7 +2548,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
-UseGNUDriver `
-Defines @{
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
# FIXME(#83449): avoid using `SwiftCMakeConfig.h`
CMAKE_CXX_FLAGS = @("-I${RuntimeBinaryCache}\include");
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
Expand All @@ -2577,7 +2566,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
-UseGNUDriver `
-Defines @{
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
# FIXME(#83449): avoid using `SwiftCMakeConfig.h`
CMAKE_CXX_FLAGS = @("-I${RuntimeBinaryCache}\include");
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
Expand All @@ -2596,7 +2584,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
-UseGNUDriver `
-Defines @{
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";

SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
Expand Down Expand Up @@ -2723,7 +2710,6 @@ function Build-Foundation {
-SwiftSDK $SwiftSDK `
-Defines @{
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
CMAKE_NINJA_FORCE_RESPONSE_FILE = "YES";
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
CMAKE_Swift_FLAGS = $SwiftFlags;
Expand Down Expand Up @@ -2942,7 +2928,6 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
-SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") `
-Defines @{
BUILD_SHARED_LIBS = "NO";
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
CMAKE_Swift_FLAGS = @("-static-stdlib", "-Xfrontend", "-use-static-resource-dir");
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";

Expand Down Expand Up @@ -3014,7 +2999,6 @@ function Build-ToolsSupportCore([Hashtable] $Platform) {
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
-Defines @{
BUILD_SHARED_LIBS = "YES";
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";

Foundation_DIR = $(Get-ProjectCMakeModules $Platform DynamicFoundation);
Expand Down