@@ -5,7 +5,6 @@ set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64;RISCV CACHE STRING "")
5
5
set (PACKAGE_VENDOR Fuchsia CACHE STRING "" )
6
6
7
7
set (LLVM_ENABLE_PROJECTS "clang;clang-tools-extra;lld;llvm" CACHE STRING "" )
8
- set (LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "" )
9
8
10
9
set (LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "" )
11
10
if (NOT APPLE )
@@ -22,6 +21,10 @@ set(LLVM_INCLUDE_GO_TESTS OFF CACHE BOOL "")
22
21
set (LLVM_USE_RELATIVE_PATHS_IN_FILES ON CACHE BOOL "" )
23
22
set (LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "" )
24
23
24
+ if (MSVC )
25
+ set (LLVM_USE_CRT_RELEASE "MT" CACHE STRING "" )
26
+ endif ()
27
+
25
28
set (CLANG_DEFAULT_CXX_STDLIB libc++ CACHE STRING "" )
26
29
if (NOT APPLE )
27
30
set (CLANG_DEFAULT_LINKER lld CACHE STRING "" )
@@ -39,6 +42,8 @@ set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
39
42
set (CMAKE_BUILD_TYPE Release CACHE STRING "" )
40
43
if (APPLE )
41
44
set (MACOSX_DEPLOYMENT_TARGET 10.7 CACHE STRING "" )
45
+ elseif (MSVC )
46
+ set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE STRING "" )
42
47
endif ()
43
48
44
49
if (APPLE )
@@ -65,6 +70,26 @@ if(APPLE)
65
70
set (DARWIN_iossim_ARCHS i386;x86_64 CACHE STRING "" )
66
71
set (DARWIN_osx_ARCHS x86_64 CACHE STRING "" )
67
72
set (SANITIZER_MIN_OSX_VERSION 10.7 CACHE STRING "" )
73
+ set (LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "" )
74
+ endif ()
75
+
76
+ if (WIN32 )
77
+ set (target "x86_64-pc-windows-msvc" )
78
+
79
+ list (APPEND BUILTIN_TARGETS "${target} " )
80
+ set (BUILTINS_${target} _CMAKE_SYSTEM_NAME Windows CACHE STRING "" )
81
+ set (BUILTINS_${target} _CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "" )
82
+
83
+ list (APPEND RUNTIME_TARGETS "${target} " )
84
+ set (RUNTIMES_${target} _CMAKE_SYSTEM_NAME Windows CACHE STRING "" )
85
+ set (RUNTIMES_${target} _CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "" )
86
+ set (RUNTIMES_${target} _LIBCXX_ABI_VERSION 2 CACHE STRING "" )
87
+ set (RUNTIMES_${target} _LIBCXX_HAS_WIN32_THREAD_API ON CACHE BOOL "" )
88
+ set (RUNTIMES_${target} _LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY OFF CACHE BOOL "" )
89
+ set (RUNTIMES_${target} _LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "" )
90
+ set (RUNTIMES_${target} _LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "" )
91
+ set (RUNTIMES_${target} _LIBCXX_ENABLE_SHARED OFF CACHE BOOL "" )
92
+ set (RUNTIMES_${target} _LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx" CACHE STRING "" )
68
93
endif ()
69
94
70
95
foreach (target aarch64-unknown-linux-gnu;armv7-unknown-linux-gnueabihf;i386-unknown-linux-gnu;x86_64-unknown-linux-gnu)
@@ -73,6 +98,9 @@ foreach(target aarch64-unknown-linux-gnu;armv7-unknown-linux-gnueabihf;i386-unkn
73
98
list (APPEND BUILTIN_TARGETS "${target} " )
74
99
set (BUILTINS_${target} _CMAKE_SYSTEM_NAME Linux CACHE STRING "" )
75
100
set (BUILTINS_${target} _CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "" )
101
+ set (BUILTINS_${target} _CMAKE_C_FLAGS "--target=${target} " CACHE STRING "" )
102
+ set (BUILTINS_${target} _CMAKE_CXX_FLAGS "--target=${target} " CACHE STRING "" )
103
+ set (BUILTINS_${target} _CMAKE_ASM_FLAGS "--target=${target} " CACHE STRING "" )
76
104
set (BUILTINS_${target} _CMAKE_SYSROOT ${LINUX_${target} _SYSROOT} CACHE STRING "" )
77
105
set (BUILTINS_${target} _CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "" )
78
106
set (BUILTINS_${target} _CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "" )
@@ -82,6 +110,9 @@ foreach(target aarch64-unknown-linux-gnu;armv7-unknown-linux-gnueabihf;i386-unkn
82
110
list (APPEND RUNTIME_TARGETS "${target} " )
83
111
set (RUNTIMES_${target} _CMAKE_SYSTEM_NAME Linux CACHE STRING "" )
84
112
set (RUNTIMES_${target} _CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "" )
113
+ set (RUNTIMES_${target} _CMAKE_C_FLAGS "--target=${target} " CACHE STRING "" )
114
+ set (RUNTIMES_${target} _CMAKE_CXX_FLAGS "--target=${target} " CACHE STRING "" )
115
+ set (RUNTIMES_${target} _CMAKE_ASM_FLAGS "--target=${target} " CACHE STRING "" )
85
116
set (RUNTIMES_${target} _CMAKE_SYSROOT ${LINUX_${target} _SYSROOT} CACHE STRING "" )
86
117
set (RUNTIMES_${target} _CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "" )
87
118
set (RUNTIMES_${target} _CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "" )
@@ -100,9 +131,9 @@ foreach(target aarch64-unknown-linux-gnu;armv7-unknown-linux-gnueabihf;i386-unkn
100
131
set (RUNTIMES_${target} _LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "" )
101
132
set (RUNTIMES_${target} _LIBCXX_ABI_VERSION 2 CACHE STRING "" )
102
133
set (RUNTIMES_${target} _LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "" )
103
- set (RUNTIMES_${target} _LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "" )
104
134
set (RUNTIMES_${target} _SANITIZER_CXX_ABI "libc++" CACHE STRING "" )
105
135
set (RUNTIMES_${target} _SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "" )
136
+ set (RUNTIMES_${target} _LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "" )
106
137
107
138
# Use .build-id link.
108
139
list (APPEND RUNTIME_BUILD_ID_LINK "${target} " )
@@ -115,7 +146,7 @@ if(FUCHSIA_SDK)
115
146
set (FUCHSIA_x86_64_NAME x64)
116
147
set (FUCHSIA_riscv64_NAME riscv64)
117
148
foreach (target i386;x86_64;aarch64;riscv64)
118
- set (FUCHSIA_${target} _COMPILER_FLAGS "-I${FUCHSIA_SDK} /pkg/fdio/include" )
149
+ set (FUCHSIA_${target} _COMPILER_FLAGS "--target= ${target} -unknown-fuchsia - I${FUCHSIA_SDK} /pkg/fdio/include" )
119
150
set (FUCHSIA_${target} _LINKER_FLAGS "-L${FUCHSIA_SDK} /arch/${FUCHSIA_${target} _NAME}/lib" )
120
151
set (FUCHSIA_${target} _SYSROOT "${FUCHSIA_SDK} /arch/${FUCHSIA_${target} _NAME}/sysroot" )
121
152
endforeach ()
0 commit comments