Skip to content

Commit

Permalink
[BUILD] Fix build when LLVM_LIBRARY_DIR is not set (triton-lang#1128)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
xndcn and ptillet authored Feb 1, 2023
1 parent 8fea1fb commit fc846e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
12 changes: 5 additions & 7 deletions cmake/FindLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fc846e5

Please sign in to comment.