casadi: unpin LLVM17 (#371734)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
diff --git a/casadi/interfaces/clang/clang_compiler.hpp b/casadi/interfaces/clang/clang_compiler.hpp
|
||||
index 7f54853..9f8d4b1 100644
|
||||
--- a/casadi/interfaces/clang/clang_compiler.hpp
|
||||
+++ b/casadi/interfaces/clang/clang_compiler.hpp
|
||||
@@ -52,7 +52,7 @@
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
//#include "llvm/IR/Verifier.h"
|
||||
#include <llvm/Support/FileSystem.h>
|
||||
-#include <llvm/Support/Host.h>
|
||||
+#include <llvm/TargetParser/Host.h>
|
||||
#include <llvm/Support/ManagedStatic.h>
|
||||
#include <llvm/Support/Path.h>
|
||||
#include <llvm/Support/TargetSelect.h>
|
||||
diff --git a/cmake/FindCLANG.cmake b/cmake/FindCLANG.cmake
|
||||
index 4edf60b..f23a348 100644
|
||||
--- a/cmake/FindCLANG.cmake
|
||||
+++ b/cmake/FindCLANG.cmake
|
||||
@@ -16,7 +16,7 @@ set(CLANG_CXX_FLAGS "-fPIC -fvisibility-inlines-hidden -ffunction-sections -fdat
|
||||
set(CLANG_INCLUDE_DIR ${LLVM_INSTALL_PREFIX}/include)
|
||||
|
||||
# All clang libraries
|
||||
-set(CLANG_DEP clangFrontend clangDriver clangCodeGen clangRewriteFrontend clangSerialization clangParse clangSema clangAnalysis clangEdit clangAST clangLex clangBasic ${LLVM_DEP})
|
||||
+set(CLANG_DEP clangFrontend clangDriver clangCodeGen clangRewriteFrontend clangSerialization clangParse clangSema clangAPINotes clangAnalysis clangEdit clangAST clangLex clangBasic ${LLVM_DEP})
|
||||
|
||||
# Get libraries
|
||||
set(CLANG_LIBRARIES)
|
||||
@@ -86,7 +86,7 @@ set(CLANG_INCLUDE_DIR ${CLANG_LLVM_INCLUDE_DIR})
|
||||
|
||||
# All clang libraries
|
||||
set(CLANG_DEP clangFrontend clangDriver clangCodeGen clangRewriteFrontend clangSerialization
|
||||
- clangParse clangSema clangAnalysis clangEdit clangAST clangLex clangBasic)
|
||||
+ clangParse clangSema clangAPINotes clangAnalysis clangEdit clangAST clangLex clangBasic)
|
||||
|
||||
# Get libraries
|
||||
foreach(D ${CLANG_DEP})
|
||||
@@ -17,8 +17,9 @@
|
||||
lib,
|
||||
ipopt,
|
||||
lapack,
|
||||
llvmPackages_17, # llvm/Support/Host.h required by casadi 3.6.5 and not available in llvm 18
|
||||
llvmPackages,
|
||||
mumps,
|
||||
ninja,
|
||||
osqp,
|
||||
pkg-config,
|
||||
pythonSupport ? false,
|
||||
@@ -52,6 +53,9 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
url = "https://github.com/casadi/casadi/pull/3899/commits/274f4b23f73e60c5302bec0479fe1e92682b63d2.patch";
|
||||
hash = "sha256-3GWEWlN8dKLD6htpnOQLChldcT3hE09JWLeuCfAhY+4=";
|
||||
})
|
||||
# update include file path and link with clangAPINotes
|
||||
# https://github.com/casadi/casadi/issues/3969
|
||||
./clang-19.diff
|
||||
];
|
||||
|
||||
postPatch =
|
||||
@@ -64,7 +68,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
# nix provide lib/clang headers in libclang, not in llvm.
|
||||
substituteInPlace casadi/interfaces/clang/CMakeLists.txt --replace-fail \
|
||||
'$'{CLANG_LLVM_LIB_DIR} \
|
||||
${lib.getLib llvmPackages_17.libclang}/lib
|
||||
${lib.getLib llvmPackages.libclang}/lib
|
||||
|
||||
# help casadi find its own libs
|
||||
substituteInPlace casadi/core/casadi_os.cpp --replace-fail \
|
||||
@@ -101,6 +105,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
pkg-config
|
||||
];
|
||||
|
||||
@@ -118,9 +123,9 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
hpipm
|
||||
ipopt
|
||||
lapack
|
||||
llvmPackages_17.clang
|
||||
llvmPackages_17.libclang
|
||||
llvmPackages_17.llvm
|
||||
llvmPackages.clang
|
||||
llvmPackages.libclang
|
||||
llvmPackages.llvm
|
||||
mumps
|
||||
osqp
|
||||
proxsuite
|
||||
@@ -140,7 +145,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
python3Packages.numpy
|
||||
python3Packages.python
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [ llvmPackages_17.openmp ];
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [ llvmPackages.openmp ];
|
||||
|
||||
cmakeFlags = [
|
||||
(lib.cmakeBool "WITH_PYTHON" pythonSupport)
|
||||
|
||||
Reference in New Issue
Block a user