@@ -27,49 +27,52 @@ set(LLVM_APPEND_VC_REV NO CACHE BOOL "")
27
27
set (LLVM_ENABLE_PER_TARGET_RUNTIME_DIR YES CACHE BOOL "" )
28
28
set (LLVM_ENABLE_PYTHON YES CACHE BOOL "" )
29
29
30
- set (default_targets
31
- x86_64-unknown-windows-msvc
32
- aarch64-unknown-windows-msvc
33
- i686-unknown-windows-msvc )
34
- set (LLVM_RUNTIME_TARGETS ${default_targets} CACHE STRING "" )
35
-
36
- # Build the android builtins if NDK path is provided.
37
- if (NOT "$ENV{NDKPATH} " STREQUAL "" )
38
- list (APPEND default_targets
39
- aarch64-unknown-linux-android
40
- x86_64-unknown-linux-android
41
- i686-unknown-linux-android
42
- armv7-unknown-linux-androideabi)
30
+ if ("$ENV{NDKPATH} " STREQUAL "" )
31
+ set (LLVM_RUNTIME_TARGETS
32
+ x86_64-unknown-windows-msvc
33
+ aarch64-unknown-windows-msvc
34
+ i686-unknown-windows-msvc
35
+ CACHE STRING "" )
36
+ else ()
37
+ # Keep API level in sync with build.ps1
38
+ set (CMAKE_ANDROID_API 28 CACHE BOOL "" )
39
+ set (LLVM_RUNTIME_TARGETS
40
+ x86_64-unknown-windows-msvc
41
+ aarch64-unknown-windows-msvc
42
+ i686-unknown-windows-msvc
43
+ x86_64-unknown-linux-android
44
+ aarch64-unknown-linux-android
45
+ i686-unknown-linux-android
46
+ armv7-unknown-linux-androideabi
47
+ CACHE STRING "" )
43
48
endif ()
44
49
45
- set (LLVM_BUILTIN_TARGETS ${default_targets} CACHE STRING "" )
46
-
47
50
foreach (target ${LLVM_RUNTIME_TARGETS} )
48
- set (RUNTIMES_${target} _LLVM_ENABLE_RUNTIMES
49
- compiler-rt
50
- CACHE STRING "" )
51
+ # We configure all runtimes, but don't build them yet. build.ps1 has a
52
+ # separate step for it, because we need a different shell for each target.
51
53
set (RUNTIMES_${target} _CMAKE_MT mt CACHE STRING "" )
52
54
set (RUNTIMES_${target} _CMAKE_SYSTEM_NAME Windows CACHE STRING "" )
53
55
set (RUNTIMES_${target} _CMAKE_BUILD_TYPE Release CACHE STRING "" )
54
- set (RUNTIMES_${target} _COMPILER_RT_BUILD_BUILTINS NO CACHE BOOL "" )
55
56
set (RUNTIMES_${target} _COMPILER_RT_BUILD_CRT NO CACHE BOOL "" )
56
57
set (RUNTIMES_${target} _COMPILER_RT_BUILD_LIBFUZZER NO CACHE BOOL "" )
57
58
set (RUNTIMES_${target} _COMPILER_RT_BUILD_ORC NO CACHE BOOL "" )
58
- set (RUNTIMES_${target} _COMPILER_RT_BUILD_PROFILE NO CACHE BOOL "" )
59
59
set (RUNTIMES_${target} _COMPILER_RT_BUILD_XRAY NO CACHE BOOL "" )
60
- # Sanitizers will be configured, but not built. We have separate build
61
- # steps for that, because we need a different shell for each target.
60
+ set (RUNTIMES_${target} _COMPILER_RT_BUILD_PROFILE NO CACHE BOOL "" )
62
61
set (RUNTIMES_${target} _COMPILER_RT_BUILD_SANITIZERS NO CACHE BOOL "" )
63
- endforeach ()
64
62
65
- foreach ( target ${LLVM_BUILTIN_TARGETS} )
63
+ # Configure and build builtins for all targets
66
64
set (BUILTINS_${target} _CMAKE_MT mt CACHE STRING "" )
65
+ set (BUILTINS_${target} _CMAKE_BUILD_TYPE Release CACHE STRING "" )
67
66
if (${target} MATCHES windows-msvc )
68
67
set (BUILTINS_${target} _CMAKE_SYSTEM_NAME Windows CACHE STRING "" )
69
68
elseif (${target} MATCHES linux-android)
69
+ set (BUILTINS_${target} _CMAKE_SYSTEM_NAME Android CACHE STRING "" )
70
+ set (BUILTINS_${target} _CMAKE_ANDROID_API ${CMAKE_ANDROID_API} CACHE STRING "" )
71
+ set (BUILTINS_${target} _CMAKE_C_COMPILER_TARGET "${target}${CMAKE_ANDROID_API} " CACHE STRING "" )
72
+ set (BUILTINS_${target} _CMAKE_CXX_COMPILER_TARGET "${target}${CMAKE_ANDROID_API} " CACHE STRING "" )
73
+ set (BUILTINS_${target} _CMAKE_ANDROID_NDK $ENV{NDKPATH} CACHE PATH "" )
70
74
# Use a single 'linux' directory and arch-based lib names on Android.
71
75
set (BUILTINS_${target} _LLVM_ENABLE_PER_TARGET_RUNTIME_DIR NO CACHE BOOL "" )
72
- set (BUILTINS_${target} _CMAKE_SYSTEM_NAME Android CACHE STRING "" )
73
76
if (${target} MATCHES aarch64)
74
77
set (BUILTINS_${target} _CMAKE_ANDROID_ARCH_ABI arm64-v8a CACHE STRING "" )
75
78
elseif (${target} MATCHES armv7)
@@ -79,12 +82,7 @@ foreach(target ${LLVM_BUILTIN_TARGETS})
79
82
else ()
80
83
set (BUILTINS_${target} _CMAKE_ANDROID_ARCH_ABI x86_64 CACHE STRING "" )
81
84
endif ()
82
- set (BUILTINS_${target} _CMAKE_ANDROID_NDK $ENV{NDKPATH} CACHE PATH "" )
83
- set (BUILTINS_${target} _CMAKE_ANDROID_API 21 CACHE STRING "" )
84
- set (BUILTINS_${target} _CMAKE_C_COMPILER_TARGET "${target} 21" CACHE STRING "" )
85
- set (BUILTINS_${target} _CMAKE_CXX_COMPILER_TARGET "${target} 21" CACHE STRING "" )
86
85
endif ()
87
- set (BUILTINS_${target} _CMAKE_BUILD_TYPE Release CACHE STRING "" )
88
86
endforeach ()
89
87
90
88
set (LLVM_TARGETS_TO_BUILD AArch64 ARM WebAssembly X86 CACHE STRING "" )
0 commit comments