mirror of
https://github.com/ROCm/ROCm.git
synced 2026-04-05 03:01:17 -04:00
[BUILD] Fix build when LLVM_LIBRARY_DIR is not set (#1128)
1. try to search llvm-config up to llvm-config-17 version 2. LLVM_LIBRARY_DIR is expected by MLIR_DIR, so set it to LLVM_LIBRARY_DIRS, which is outputted by FindLLVM Co-authored-by: Philippe Tillet <phil@openai.com>
This commit is contained in:
@@ -72,6 +72,8 @@ if (NOT MLIR_DIR)
|
||||
find_package(LLVM 11 REQUIRED COMPONENTS "nvptx;amdgpu")
|
||||
endif()
|
||||
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
|
||||
# FindLLVM outputs LLVM_LIBRARY_DIRS but we expect LLVM_LIBRARY_DIR here
|
||||
set(LLVM_LIBRARY_DIR ${LLVM_LIBRARY_DIRS})
|
||||
if(APPLE)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
|
||||
endif()
|
||||
|
||||
@@ -33,14 +33,12 @@
|
||||
# We also want an user-specified LLVM_ROOT_DIR to take precedence over the
|
||||
# system default locations such as /usr/local/bin. Executing find_program()
|
||||
# multiples times is the approach recommended in the docs.
|
||||
set(llvm_config_names llvm-config-12.0 llvm-config120 llvm-config-12 llvm-config-12-64
|
||||
llvm-config-11.0 llvm-config110 llvm-config-11 llvm-config-11-64
|
||||
llvm-config-10.0 llvm-config100 llvm-config-10 llvm-config-10-64
|
||||
llvm-config-9.0 llvm-config90 llvm-config-9 llvm-config-9-64
|
||||
llvm-config-8.0 llvm-config80 llvm-config-8 llvm-config-8-64
|
||||
llvm-config-7.0 llvm-config70 llvm-config-7 llvm-config-7-64
|
||||
llvm-config-6.0 llvm-config60
|
||||
set(llvm_config_names llvm-config-6.0 llvm-config60
|
||||
llvm-config)
|
||||
foreach(v RANGE 7 17)
|
||||
# names like llvm-config-7.0 llvm-config70 llvm-config-7 llvm-config-7-64
|
||||
list(PREPEND llvm_config_names llvm-config-${v}.0 llvm-config${v}0 llvm-config-${v} llvm-config-${v}-64)
|
||||
endforeach()
|
||||
find_program(LLVM_CONFIG
|
||||
NAMES ${llvm_config_names}
|
||||
PATHS ${LLVM_ROOT_DIR}/bin NO_DEFAULT_PATH
|
||||
|
||||
Reference in New Issue
Block a user