Skip to content

Commit e24e1f7

Browse files
committed
[cmake] Use LLVMConfig.cmake instead of llvm-config to set some variables.
Previously in order to support cross-compiling, we were setting these variables in build-script. Now that we are using LLVMConfig.cmake, passing in these values are no longer necessary. As an added benefit, Swift when not cross compiling, does not need to set these variables anyways. rdar://26154980
1 parent c87aabb commit e24e1f7

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

cmake/modules/SwiftSharedCMakeConfig.cmake

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ macro(swift_common_standalone_build_config product is_cross_compiling)
117117
if(${is_cross_compiling})
118118
# Can't run llvm-config from the cross-compiled LLVM.
119119
set(LLVM_TOOLS_BINARY_DIR "" CACHE PATH "Path to llvm/bin")
120-
set(LLVM_LIBRARY_DIR "" CACHE PATH "Path to llvm/lib")
121-
set(LLVM_MAIN_INCLUDE_DIR "" CACHE PATH "Path to llvm/include")
122-
set(LLVM_BINARY_DIR "" CACHE PATH "Path to LLVM build tree")
123-
set(LLVM_MAIN_SRC_DIR "" CACHE PATH "Path to LLVM source tree")
124120
else()
125121
# Rely on llvm-config.
126122
_swift_llvm_config_info(
@@ -138,10 +134,6 @@ macro(swift_common_standalone_build_config product is_cross_compiling)
138134
mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
139135

140136
set(LLVM_TOOLS_BINARY_DIR "${llvm_config_tools_binary_dir}" CACHE PATH "Path to llvm/bin")
141-
set(LLVM_LIBRARY_DIR "${llvm_config_library_dir}" CACHE PATH "Path to llvm/lib")
142-
set(LLVM_MAIN_INCLUDE_DIR "${llvm_config_include_dir}" CACHE PATH "Path to llvm/include")
143-
set(LLVM_BINARY_DIR "${llvm_config_obj_root}" CACHE PATH "Path to LLVM build tree")
144-
set(LLVM_MAIN_SRC_DIR "${llvm_config_src_dir}" CACHE PATH "Path to LLVM source tree")
145137

146138
set(${product}_NATIVE_LLVM_TOOLS_PATH "${LLVM_TOOLS_BINARY_DIR}")
147139
set(${product}_NATIVE_CLANG_TOOLS_PATH "${LLVM_TOOLS_BINARY_DIR}")
@@ -175,6 +167,11 @@ macro(swift_common_standalone_build_config product is_cross_compiling)
175167
set(LLVM_TOOLS_BINARY_DIR "${LLVM_TOOLS_BINARY_DIR_saved}")
176168
set(LLVM_ENABLE_ASSERTIONS "${LLVM_ENABLE_ASSERTIONS_saved}")
177169

170+
precondition_translate_flag(LLVM_BUILD_LIBRARY_DIR LLVM_LIBRARY_DIR)
171+
precondition_translate_flag(LLVM_BUILD_MAIN_INCLUDE_DIR LLVM_MAIN_INCLUDE_DIR)
172+
precondition_translate_flag(LLVM_BUILD_BINARY_DIR LLVM_BINARY_DIR)
173+
precondition_translate_flag(LLVM_BUILD_MAIN_SRC_DIR LLVM_MAIN_SRC_DIR)
174+
178175
# Clang
179176
set(${product}_PATH_TO_CLANG_SOURCE "${PATH_TO_LLVM_SOURCE}/tools/clang"
180177
CACHE PATH "Path to Clang source code.")

utils/build-script-impl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,10 +1836,6 @@ for host in "${ALL_HOSTS[@]}"; do
18361836
cmake_options=(
18371837
"${cmake_options[@]}"
18381838
-DLLVM_TOOLS_BINARY_DIR:PATH=$(build_directory ${host} llvm)/bin
1839-
-DLLVM_LIBRARY_DIR:PATH=$(build_directory ${host} llvm)/lib
1840-
-DLLVM_MAIN_INCLUDE_DIR:PATH=$(build_directory ${host} llvm)/include
1841-
-DLLVM_BINARY_DIR:PATH=$(build_directory ${host} llvm)
1842-
-DLLVM_MAIN_SRC_DIR:PATH="${LLVM_SOURCE_DIR}"
18431839
)
18441840
else
18451841
build_perf_testsuite_this_time=$(true_false "$(not ${SKIP_BUILD_BENCHMARKS})")
@@ -1862,10 +1858,6 @@ for host in "${ALL_HOSTS[@]}"; do
18621858
cmake_options=(
18631859
"${cmake_options[@]}"
18641860
-DLLVM_TOOLS_BINARY_DIR:PATH=/tmp/dummy
1865-
-DLLVM_LIBRARY_DIR:PATH="${build_dir}"
1866-
-DLLVM_MAIN_INCLUDE_DIR:PATH=/tmp/dummy
1867-
-DLLVM_BINARY_DIR:PATH=$(build_directory ${host} llvm)
1868-
-DLLVM_MAIN_SRC_DIR:PATH="${LLVM_SOURCE_DIR}"
18691861
)
18701862
fi
18711863

0 commit comments

Comments
 (0)