@@ -113,25 +113,11 @@ macro(swift_common_standalone_build_config product is_cross_compiling)
113
113
114
114
precondition_translate_flag (${product} _PATH_TO_LLVM_SOURCE PATH_TO_LLVM_SOURCE )
115
115
precondition_translate_flag (${product} _PATH_TO_LLVM_BUILD PATH_TO_LLVM_BUILD )
116
+ set (PATH_TO_LLVM_TOOLS_BINARY_DIR "${PATH_TO_LLVM_BUILD} /bin" )
116
117
117
- if (${is_cross_compiling} )
118
- # Can't run llvm-config from the cross-compiled LLVM.
119
- set (LLVM_TOOLS_BINARY_DIR "" CACHE PATH "Path to llvm/bin" )
120
- else ()
121
- # Rely on llvm-config.
122
- _swift_llvm_config_info (
123
- ENABLE_ASSERTIONS llvm_config_enable_assertions
124
- TOOLS_BINARY_DIR llvm_config_tools_binary_dir
125
- LIBRARY_DIR llvm_config_library_dir
126
- INCLUDE_DIR llvm_config_include_dir
127
- OBJ_ROOT_DIR llvm_config_obj_root
128
- SOURCE_DIR llvm_config_src_dir
129
- )
130
-
131
- set (LLVM_TOOLS_BINARY_DIR "${llvm_config_tools_binary_dir} " CACHE PATH "Path to llvm/bin" )
132
-
133
- set (${product} _NATIVE_LLVM_TOOLS_PATH "${LLVM_TOOLS_BINARY_DIR} " )
134
- set (${product} _NATIVE_CLANG_TOOLS_PATH "${LLVM_TOOLS_BINARY_DIR} " )
118
+ if (NOT ${is_cross_compiling} )
119
+ set (${product} _NATIVE_LLVM_TOOLS_PATH "${PATH_TO_LLVM_TOOLS_BINARY_DIR} " )
120
+ set (${product} _NATIVE_CLANG_TOOLS_PATH "${PATH_TO_LLVM_TOOLS_BINARY_DIR} " )
135
121
endif ()
136
122
137
123
find_program (LLVM_TABLEGEN_EXE "llvm-tblgen" "${${product} _NATIVE_LLVM_TOOLS_PATH}"
@@ -155,17 +141,14 @@ macro(swift_common_standalone_build_config product is_cross_compiling)
155
141
message (FATAL_ERROR "Not found: ${LLVMCONFIG_FILE} " )
156
142
endif ()
157
143
158
- # Save and restore variables that LLVM configuration overrides.
159
- set (LLVM_TOOLS_BINARY_DIR_saved "${LLVM_TOOLS_BINARY_DIR} " )
160
-
161
144
# If we already have a cached value for LLVM_ENABLE_ASSERTIONS, save the value.
162
145
if (DEFINED LLVM_ENABLE_ASSERTIONS )
163
146
set (LLVM_ENABLE_ASSERTIONS_saved "${LLVM_ENABLE_ASSERTIONS} " )
164
147
endif ()
148
+
165
149
# Then we import LLVMCONFIG_FILE. This is going to override whatever cached
166
150
# value we have for LLVM_ENABLE_ASSERTIONS.
167
151
include (${LLVMCONFIG_FILE} )
168
- set (LLVM_TOOLS_BINARY_DIR "${LLVM_TOOLS_BINARY_DIR_saved} " )
169
152
170
153
# If we did not have a cached value for LLVM_ENABLE_ASSERTIONS, set
171
154
# LLVM_ENABLE_ASSERTIONS_saved to be the ENABLE_ASSERTIONS value from LLVM so
@@ -184,6 +167,7 @@ macro(swift_common_standalone_build_config product is_cross_compiling)
184
167
CACHE BOOL "Enable assertions" )
185
168
mark_as_advanced (LLVM_ENABLE_ASSERTIONS )
186
169
170
+ precondition (LLVM_TOOLS_BINARY_DIR )
187
171
precondition_translate_flag (LLVM_BUILD_LIBRARY_DIR LLVM_LIBRARY_DIR )
188
172
precondition_translate_flag (LLVM_BUILD_MAIN_INCLUDE_DIR LLVM_MAIN_INCLUDE_DIR )
189
173
precondition_translate_flag (LLVM_BUILD_BINARY_DIR LLVM_BINARY_DIR )
0 commit comments