From b2cf50d354cbf168f121597dceaaac123908d541 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Sun, 21 Apr 2024 11:34:36 +0200 Subject: [PATCH] cppinsights: patch for LLVM 18 --- Formula/c/cppinsights.rb | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/Formula/c/cppinsights.rb b/Formula/c/cppinsights.rb index b090ed28c68b8..084e37e87106c 100644 --- a/Formula/c/cppinsights.rb +++ b/Formula/c/cppinsights.rb @@ -23,6 +23,10 @@ class Cppinsights < Formula cause "Requires C++20" end + # Patch from https://github.com/andreasfertig/cppinsights/pull/622 + # Support for LLVM 18, remove in next version + patch :DATA + def install ENV.llvm_clang if ENV.compiler == :clang && DevelopmentTools.clang_build_version <= 1500 @@ -40,3 +44,50 @@ def install assert_match "{2, 3, 4, 0, 0}", shell_output("#{bin}/insights ./test.cpp") end end +__END__ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 31341709..8b7430db 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,4 @@ +-cmake_minimum_required(VERSION 3.10 FATAL_ERROR) +-# 3.8* is required because of C++17 support ++cmake_minimum_required(VERSION 3.20 FATAL_ERROR) + + # For better control enable MSVC_RUNTIME_LIBRARY target property + # see https://cmake.org/cmake/help/latest/policy/CMP0091.html +@@ -33,7 +32,7 @@ option(INSIGHTS_STATIC "Use static linking" Off) + + set(INSIGHTS_LLVM_CONFIG "llvm-config" CACHE STRING "LLVM config executable to use") + +-set(INSIGHTS_MIN_LLVM_MAJOR_VERSION 17) ++set(INSIGHTS_MIN_LLVM_MAJOR_VERSION 18) + set(INSIGHTS_MIN_LLVM_VERSION ${INSIGHTS_MIN_LLVM_MAJOR_VERSION}.0) + + if(NOT DEFINED LLVM_VERSION_MAJOR) # used when build inside the clang tool/extra folder +@@ -372,6 +371,17 @@ if (BUILD_INSIGHTS_OUTSIDE_LLVM) + # additional libs required when building insights outside llvm + set(ADDITIONAL_LIBS + ${LLVM_LDFLAGS} ++ ) ++ ++ if(${LLVM_PACKAGE_VERSION_PLAIN} VERSION_GREATER_EQUAL "18.0.0") ++ set(ADDITIONAL_LIBS ++ ${ADDITIONAL_LIBS} ++ clangAPINotes ++ ) ++ endif() ++ ++ set(ADDITIONAL_LIBS ++ ${ADDITIONAL_LIBS} + clangFrontend + clangDriver + clangSerialization +@@ -768,6 +778,7 @@ message(STATUS "[ Build summary ]") + message(STATUS "CMAKE_GENERATOR : ${CMAKE_GENERATOR}") + message(STATUS "CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}") + message(STATUS "CMAKE_LINKER : ${CMAKE_LINKER}") ++message(STATUS "CMAKE_OSX_ARCHITECTURES : ${CMAKE_OSX_ARCHITECTURES}") + message(STATUS "Compiler ID : ${CMAKE_CXX_COMPILER_ID}") + message(STATUS "Compiler version : ${CMAKE_CXX_COMPILER_VERSION}") + message(STATUS "Compiler path : ${CMAKE_CXX_COMPILER}")