Skip to content

Commit 46a4bf4

Browse files
committed
build: enable libxml2 in the toolchain, use llvm-mt
Enable support for libxml2 on Windows to allow `llvm-mt` to be usable. This then allows us to use `llvm-mt` as the manifest tool when building for Windows. Remove the then obsoleted workaround of `-D CMAKE_MT=mt`. This reduces the dependency on the MSVC toolchain and paves the path to enabling the use of the manifest tool in SPM.
1 parent 6221b29 commit 46a4bf4

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

cmake/caches/Windows-aarch64.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ set(LLVM_TARGETS_TO_BUILD AArch64 ARM WebAssembly X86 CACHE STRING "")
5050
set(LLVM_BUILD_LLVM_DYLIB NO CACHE BOOL "")
5151
set(LLVM_BUILD_LLVM_C_DYLIB NO CACHE BOOL "")
5252
set(LLVM_ENABLE_LIBEDIT NO CACHE BOOL "")
53-
set(LLVM_ENABLE_LIBXML2 NO CACHE BOOL "")
53+
set(LLVM_ENABLE_LIBXML2 YES CACHE BOOL "")
5454
set(LLVM_ENABLE_OCAMLDOC NO CACHE BOOL "")
5555
set(LLVM_ENABLE_TERMINFO NO CACHE BOOL "")
5656
set(LLVM_ENABLE_Z3_SOLVER NO CACHE BOOL "")
@@ -62,12 +62,14 @@ set(LLVM_INCLUDE_GO_TESTS NO CACHE BOOL "")
6262
set(LLVM_TOOL_GOLD_BUILD NO CACHE BOOL "")
6363
set(LLVM_TOOL_LLVM_SHLIB_BUILD NO CACHE BOOL "")
6464

65+
set(CLANG_ENABLE_LIBXML2 NO CACHE BOOL "")
66+
6567
# Avoid swig dependency for lldb
6668
set(LLDB_ALLOW_STATIC_BINDINGS YES CACHE BOOL "")
6769
set(LLDB_USE_STATIC_BINDINGS YES CACHE BOOL "")
6870
set(LLDB_ENABLE_PYTHON YES CACHE BOOL "")
6971
set(LLDB_EMBED_PYTHON_HOME NO CACHE BOOL "")
70-
set(LLDB_ENABLE_LIBXML2 NO CACHE BOOL "")
72+
set(LLDB_ENABLE_LIBXML2 YES CACHE BOOL "")
7173

7274
# This requires perl which may not be available on Windows
7375
set(SWIFT_INCLUDE_DOCS NO CACHE BOOL "")

cmake/caches/Windows-x86_64.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ set(LLVM_TARGETS_TO_BUILD AArch64 ARM WebAssembly X86 CACHE STRING "")
9090
set(LLVM_BUILD_LLVM_DYLIB NO CACHE BOOL "")
9191
set(LLVM_BUILD_LLVM_C_DYLIB NO CACHE BOOL "")
9292
set(LLVM_ENABLE_LIBEDIT NO CACHE BOOL "")
93-
set(LLVM_ENABLE_LIBXML2 NO CACHE BOOL "")
93+
set(LLVM_ENABLE_LIBXML2 YES CACHE BOOL "")
9494
set(LLVM_ENABLE_OCAMLDOC NO CACHE BOOL "")
9595
set(LLVM_ENABLE_TERMINFO NO CACHE BOOL "")
9696
set(LLVM_ENABLE_Z3_SOLVER NO CACHE BOOL "")
@@ -102,12 +102,14 @@ set(LLVM_INCLUDE_GO_TESTS NO CACHE BOOL "")
102102
set(LLVM_TOOL_GOLD_BUILD NO CACHE BOOL "")
103103
set(LLVM_TOOL_LLVM_SHLIB_BUILD NO CACHE BOOL "")
104104

105+
set(CLANG_ENABLE_LIBXML2 NO CACHE BOOL "")
106+
105107
# Avoid swig dependency for lldb
106108
set(LLDB_ALLOW_STATIC_BINDINGS YES CACHE BOOL "")
107109
set(LLDB_USE_STATIC_BINDINGS YES CACHE BOOL "")
108110
set(LLDB_ENABLE_PYTHON YES CACHE BOOL "")
109111
set(LLDB_EMBED_PYTHON_HOME NO CACHE BOOL "")
110-
set(LLDB_ENABLE_LIBXML2 NO CACHE BOOL "")
112+
set(LLDB_ENABLE_LIBXML2 YES CACHE BOOL "")
111113

112114
# This requires perl which may not be available on Windows
113115
set(SWIFT_INCLUDE_DOCS NO CACHE BOOL "")

utils/build.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,6 @@ function Build-CMakeProject {
959959
}
960960

961961
TryAdd-KeyValue $Defines CMAKE_BUILD_TYPE Release
962-
TryAdd-KeyValue $Defines CMAKE_MT "mt"
963962

964963
$CFlags = @()
965964
switch ($Platform) {
@@ -1382,6 +1381,8 @@ function Build-BuildTools($Arch) {
13821381
-BuildTargets llvm-tblgen,clang-tblgen,clang-pseudo-gen,clang-tidy-confusable-chars-gen,lldb-tblgen,llvm-config,swift-def-to-strings-converter,swift-serialize-diagnostics,swift-compatibility-symbols `
13831382
-Defines @{
13841383
CMAKE_CROSSCOMPILING = "NO";
1384+
CLANG_ENABLE_LIBXML2 = "NO";
1385+
LLDB_ENABLE_LIBXML2 = "NO";
13851386
LLDB_ENABLE_PYTHON = "NO";
13861387
LLDB_INCLUDE_TESTS = "NO";
13871388
LLDB_ENABLE_SWIFT_SUPPORT = "NO";
@@ -1477,7 +1478,9 @@ function Build-Compilers() {
14771478
-Defines ($TestingDefines + @{
14781479
CLANG_TABLEGEN = (Join-Path -Path $BuildTools -ChildPath "clang-tblgen.exe");
14791480
CLANG_TIDY_CONFUSABLE_CHARS_GEN = (Join-Path -Path $BuildTools -ChildPath "clang-tidy-confusable-chars-gen.exe");
1481+
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
14801482
CMAKE_Swift_FLAGS = $SwiftFlags;
1483+
LibXml2_DIR = "$LibraryRoot\libxml2-2.11.5\usr\lib\$Platform\$ShortArch\cmake\libxml2-2.11.5";
14811484
LLDB_PYTHON_EXE_RELATIVE_PATH = "python.exe";
14821485
LLDB_PYTHON_EXT_SUFFIX = ".pyd";
14831486
LLDB_PYTHON_RELATIVE_PATH = "lib/site-packages";
@@ -1900,14 +1903,9 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
19001903
-Defines (@{
19011904
ENABLE_TESTING = "NO";
19021905
FOUNDATION_BUILD_TOOLS = if ($Platform -eq "Windows") { "YES" } else { "NO" };
1906+
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
19031907
CURL_DIR = "$LibraryRoot\curl-8.9.1\usr\lib\$Platform\$ShortArch\cmake\CURL";
1904-
LIBXML2_LIBRARY = if ($Platform -eq "Windows") {
1905-
"$LibraryRoot\libxml2-2.11.5\usr\lib\$Platform\$ShortArch\libxml2s.lib";
1906-
} else {
1907-
"$LibraryRoot\libxml2-2.11.5\usr\lib\$Platform\$ShortArch\libxml2.a";
1908-
};
1909-
LIBXML2_INCLUDE_DIR = "$LibraryRoot\libxml2-2.11.5\usr\include\libxml2";
1910-
LIBXML2_DEFINITIONS = "-DLIBXML_STATIC";
1908+
LibXml2_DIR = "$LibraryRoot\libxml2-2.11.5\usr\lib\$Platform\$ShortArch\cmake\libxml2-2.11.5";
19111909
ZLIB_LIBRARY = if ($Platform -eq "Windows") {
19121910
"$LibraryRoot\zlib-1.3.1\usr\lib\$Platform\$ShortArch\zlibstatic.lib"
19131911
} else {
@@ -2748,13 +2746,15 @@ if (-not $SkipBuild) {
27482746
Invoke-BuildStep Build-CMark $BuildArch
27492747
Invoke-BuildStep Build-BuildTools $BuildArch
27502748
if ($IsCrossCompiling) {
2749+
Invoke-BuildStep Build-XML2 Windows $BuildArch
27512750
Invoke-BuildStep Build-Compilers -Build $BuildArch
27522751
}
27532752
if ($IncludeDS2) {
27542753
Invoke-BuildStep Build-RegsGen2 $BuildArch
27552754
}
27562755

27572756
Invoke-BuildStep Build-CMark $HostArch
2757+
Invoke-BuildStep Build-XML2 Windows $HostArch
27582758
Invoke-BuildStep Build-Compilers $HostArch
27592759
}
27602760

0 commit comments

Comments
 (0)