Skip to content

Commit

Permalink
update CMake to LLVM 18
Browse files Browse the repository at this point in the history
  • Loading branch information
stlemme committed Nov 29, 2024
1 parent ed3c3c4 commit 05dadd4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17 FATAL_ERROR)
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)

project(AnyDSL)

Expand Down
2 changes: 1 addition & 1 deletion applications/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)

file(GLOB _application_paths "*/CMakeLists.txt")

Expand Down
16 changes: 11 additions & 5 deletions cmake/llvm-package.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
set(AnyDSL_PKG_LLVM_VERSION "16.0.6" CACHE STRING "LLVM version of AnyDSL")
set(AnyDSL_PKG_LLVM_VERSION "18.1.8" CACHE STRING "LLVM version of AnyDSL")
set(AnyDSL_PKG_LLVM_URL "https://github.com/llvm/llvm-project/releases/download/llvmorg-${AnyDSL_PKG_LLVM_VERSION}/llvm-project-${AnyDSL_PKG_LLVM_VERSION}.src.tar.xz" CACHE STRING "where to download LLVM")


find_package(LLVM ${AnyDSL_PKG_LLVM_VERSION} QUIET CONFIG)
# LLVM's version handling requires exact matches of major.minor to ensure API compatibility
# however, LLVM does not support version ranges for CMake's find_package() command
string(REGEX MATCH "^([0-9]+)\.([0-9]+)" AnyDSL_PKG_LLVM_VERSION_MAJOR_MINOR ${AnyDSL_PKG_LLVM_VERSION})
set(AnyDSL_PKG_LLVM_VERSION_MAJOR ${CMAKE_MATCH_1})
set(AnyDSL_PKG_LLVM_VERSION_MINOR ${CMAKE_MATCH_2})
foreach(_minor_version RANGE 0 ${AnyDSL_PKG_LLVM_VERSION_MINOR})
find_package(LLVM ${AnyDSL_PKG_LLVM_VERSION_MAJOR}.${_minor_version} CONFIG QUIET)
endforeach()
if (NOT LLVM_FOUND AND NOT CMAKE_DISABLE_FIND_PACKAGE_LLVM)
find_package(LLVM QUIET CONFIG)
find_package(LLVM CONFIG QUIET)
if (NOT LLVM_FOUND)
message(WARNING
"LLVM not found. This is probably not what you want to do. You can either set AnyDSL_PKG_LLVM_AUTOBUILD to ON, or set LLVM_DIR to point to LLVM ${AnyDSL_PKG_LLVM_VERSION}.
You can get also rid of this warning by setting CMAKE_DISABLE_FIND_PACKAGE_LLVM to ON.")
else()
message(WARNING
"LLVM ${LLVM_VERSION} found, but this version does not match what AnyDSL expects. This is probably not what you want to do. You can either set AnyDSL_PKG_LLVM_AUTOBUILD to ON, or set LLVM_DIR to point to LLVM ${AnyDSL_PKG_LLVM_VERSION}.
"LLVM ${LLVM_VERSION} found, but this version does not match what AnyDSL expects. This is probably not what you want to do. You can either set AnyDSL_PKG_LLVM_AUTOBUILD to ON, or set LLVM_DIR to point to LLVM ${AnyDSL_PKG_LLVM_VERSION_MAJOR}.
You can also get rid of this warning by setting AnyDSL_PKG_LLVM_VERSION to ${LLVM_VERSION}, or by enabling CMAKE_DISABLE_FIND_PACKAGE_LLVM.")
endif()
endif()
Expand Down

0 comments on commit 05dadd4

Please sign in to comment.