Unverified Commit 6232c591 authored by Vladimír Čunát's avatar Vladimír Čunát
Browse files

casadi: 3.7.1 -> 3.7.2 + related fixes (#447543)

- drop abandoned clang_compiler interface
- hpipm: unbreak casadi
parents afa2627e 141759de
Loading
Loading
Loading
Loading
+0 −35
Original line number Diff line number Diff line
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})
+6 −17
Original line number Diff line number Diff line
@@ -38,20 +38,16 @@

stdenv.mkDerivation (finalAttrs: {
  pname = "casadi";
  version = "3.7.1";
  version = "3.7.2";

  src = fetchFromGitHub {
    owner = "casadi";
    repo = "casadi";
    tag = finalAttrs.version;
    hash = "sha256-554ZN+GfkGHN0cthsb/fPWdo+U2IqLz4q+x60SxRAfk=";
    hash = "sha256-I6CYtKVvE67NSYH/JGJFP5wHhm1xACctz7uTwOFFihA=";
  };

  patches = [
    # update include file path and link with clangAPINotes
    # https://github.com/casadi/casadi/issues/3969
    ./clang-19.diff

    # Add missing include
    # ref. https://github.com/casadi/casadi/pull/4192
    (fetchpatch {
@@ -77,11 +73,6 @@ stdenv.mkDerivation (finalAttrs: {
      "FATROP HPIPM" \
      "FATROP hpipm"

    # 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.libclang}/lib

    # help casadi find its own libs
    substituteInPlace casadi/core/casadi_os.cpp --replace-fail \
      "std::vector<std::string> search_paths;" \
@@ -108,11 +99,6 @@ stdenv.mkDerivation (finalAttrs: {
    substituteInPlace casadi/interfaces/hpipm/hpipm_runtime.hpp --replace-fail \
      "d_print_exp_tran_mat" \
      "//d_print_exp_tran_mat"

    # fix missing symbols
    substituteInPlace cmake/FindCLANG.cmake --replace-fail \
      "clangBasic)" \
      "clangBasic clangASTMatchers clangSupport)"
  '';

  nativeBuildInputs = [
@@ -189,7 +175,9 @@ stdenv.mkDerivation (finalAttrs: {
    (lib.cmakeBool "WITH_TINYXML" true)
    (lib.cmakeBool "WITH_BUILD_DSDP" true) # not sure where this come from
    (lib.cmakeBool "WITH_DSDP" true)
    (lib.cmakeBool "WITH_CLANG" true)
    # "clang_compiler.cpp has basically been abandonded for several years", ref.
    # https://github.com/casadi/casadi/issues/4225#issuecomment-3352552113
    (lib.cmakeBool "WITH_CLANG" false)
    (lib.cmakeBool "WITH_LAPACK" true)
    (lib.cmakeBool "WITH_QPOASES" true)
    (lib.cmakeBool "WITH_BLOCKSQP" true)
@@ -223,6 +211,7 @@ stdenv.mkDerivation (finalAttrs: {
      Python or Matlab/Octave
    '';
    homepage = "https://github.com/casadi/casadi";
    changelog = "https://github.com/casadi/casadi/releases/tag/${finalAttrs.version}";
    license = lib.licenses.lgpl3Only;
    maintainers = with lib.maintainers; [ nim65s ];
    platforms = lib.platforms.all;
+3 −3
Original line number Diff line number Diff line
@@ -10,13 +10,13 @@
stdenv.mkDerivation (finalAttrs: {
  pname = "hpipm";
  #version = "0.1.3";  not building, use master instead
  version = "0.1.3-unstable-2025-09-25";
  version = "0.1.3-unstable-2025-07-25";

  src = fetchFromGitHub {
    owner = "giaf";
    repo = "hpipm";
    rev = "8f3a2d00f6d1bd7101fb651391fba79377915288";
    hash = "sha256-XtnUs1RiB7zJOv7zdRzB31hnxDYaiH+Q4SLyE6/kuEg=";
    rev = "00c2a084e059e2e1b79877f668e282d0c4282110";
    hash = "sha256-Lg7po7xTs9jc8FiYFMbNFJooTjOpzBFiyd5f+TPMWQA=";
  };

  nativeBuildInputs = [ cmake ];