mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-02 02:03:21 +00:00
Merge pull request #333314 from nim65s/casadi-darwin
casadi: build on darwin
This commit is contained in:
commit
d4c5ef794a
@ -30,7 +30,7 @@
|
||||
#sundials,
|
||||
superscs,
|
||||
spral,
|
||||
swig,
|
||||
swig4,
|
||||
tinyxml-2,
|
||||
withUnfree ? false,
|
||||
}:
|
||||
@ -96,6 +96,17 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
substituteInPlace swig/python/CMakeLists.txt --replace-fail \
|
||||
"if (SWIG_IMPORT)" \
|
||||
"if (NOT SWIG_IMPORT)"
|
||||
''
|
||||
+ lib.optionalString stdenv.isDarwin ''
|
||||
# this is only printing stuff, and is not defined on all CPU
|
||||
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 = [
|
||||
@ -128,7 +139,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
#sundials
|
||||
superscs
|
||||
spral
|
||||
swig
|
||||
swig4
|
||||
tinyxml-2
|
||||
]
|
||||
++ lib.optionals withUnfree [
|
||||
@ -138,11 +149,15 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
++ lib.optionals pythonSupport [
|
||||
python3Packages.numpy
|
||||
python3Packages.python
|
||||
];
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [ llvmPackages_17.openmp ];
|
||||
|
||||
cmakeFlags = [
|
||||
(lib.cmakeBool "WITH_PYTHON" pythonSupport)
|
||||
(lib.cmakeBool "WITH_PYTHON3" pythonSupport)
|
||||
# We don't mind always setting this cmake variable, it will be read only if
|
||||
# pythonSupport is enabled.
|
||||
"-DPYTHON_PREFIX=${placeholder "out"}/${python3Packages.python.sitePackages}"
|
||||
(lib.cmakeBool "WITH_JSON" false)
|
||||
(lib.cmakeBool "WITH_INSTALL_INTERNAL_HEADERS" true)
|
||||
(lib.cmakeBool "INSTALL_INTERNAL_HEADERS" true)
|
||||
@ -189,11 +204,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
#(lib.cmakeBool "WITH_ALPAQA" true) # this requires casadi...
|
||||
];
|
||||
|
||||
# I don't know how to pass absolute $out path from cmakeFlags
|
||||
postConfigure = lib.optionalString pythonSupport ''
|
||||
cmake -DPYTHON_PREFIX=$out/${python3Packages.python.sitePackages} ..
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
|
||||
meta = {
|
||||
@ -201,5 +211,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
homepage = "https://github.com/casadi/casadi";
|
||||
license = lib.licenses.lgpl3Only;
|
||||
maintainers = with lib.maintainers; [ nim65s ];
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
})
|
||||
|
@ -26,7 +26,8 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DBLASFEO_PATH=${blasfeo}"
|
||||
"-DHPIPM_FIND_BLASFEO=ON"
|
||||
"-DBUILD_SHARED_LIBS=ON"
|
||||
] ++ lib.optionals (!stdenv.isx86_64) [ "-DTARGET=GENERIC" ];
|
||||
|
||||
meta = {
|
||||
|
@ -26,11 +26,17 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# Compatibility with coin-or-mumps version
|
||||
# https://github.com/coin-or-tools/ThirdParty-Mumps/blob/stable/3.0/get.Mumps#L66
|
||||
cp libseq/mpi.h libseq/mumps_mpi.h
|
||||
'';
|
||||
postPatch =
|
||||
''
|
||||
# Compatibility with coin-or-mumps version
|
||||
# https://github.com/coin-or-tools/ThirdParty-Mumps/blob/stable/3.0/get.Mumps#L66
|
||||
cp libseq/mpi.h libseq/mumps_mpi.h
|
||||
''
|
||||
+ lib.optionalString stdenv.isDarwin ''
|
||||
substituteInPlace src/Makefile --replace-fail \
|
||||
"-Wl,\''$(SONAME),libmumps_common" \
|
||||
"-Wl,-install_name,$out/lib/libmumps_common"
|
||||
'';
|
||||
|
||||
configurePhase = ''
|
||||
cp Make.inc/Makefile.debian.SEQ ./Makefile.inc
|
||||
@ -67,11 +73,59 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
scotch
|
||||
];
|
||||
|
||||
preFixup = lib.optionalString stdenv.isDarwin ''
|
||||
install_name_tool \
|
||||
-change libmpiseq.dylib \
|
||||
$out/lib/libmpiseq.dylib \
|
||||
-change libpord.dylib \
|
||||
$out/lib/libpord.dylib \
|
||||
$out/lib/libmumps_common.dylib
|
||||
install_name_tool \
|
||||
-change libmpiseq.dylib \
|
||||
$out/lib/libmpiseq.dylib \
|
||||
-change libpord.dylib \
|
||||
$out/lib/libpord.dylib \
|
||||
-id \
|
||||
$out/lib/libcmumps.dylib \
|
||||
$out/lib/libcmumps.dylib
|
||||
install_name_tool \
|
||||
-change libmpiseq.dylib \
|
||||
$out/lib/libmpiseq.dylib \
|
||||
-change libpord.dylib \
|
||||
$out/lib/libpord.dylib \
|
||||
-id \
|
||||
$out/lib/libdmumps.dylib \
|
||||
$out/lib/libdmumps.dylib
|
||||
install_name_tool \
|
||||
-change libmpiseq.dylib \
|
||||
$out/lib/libmpiseq.dylib \
|
||||
-change libpord.dylib \
|
||||
$out/lib/libpord.dylib \
|
||||
-id \
|
||||
$out/lib/libsmumps.dylib \
|
||||
$out/lib/libsmumps.dylib
|
||||
install_name_tool \
|
||||
-change libmpiseq.dylib \
|
||||
$out/lib/libmpiseq.dylib \
|
||||
-change libpord.dylib \
|
||||
$out/lib/libpord.dylib \
|
||||
-id \
|
||||
$out/lib/libzmumps.dylib \
|
||||
$out/lib/libzmumps.dylib
|
||||
install_name_tool \
|
||||
-id \
|
||||
$out/lib/libmpiseq.dylib \
|
||||
$out/lib/libmpiseq.dylib
|
||||
install_name_tool \
|
||||
-id \
|
||||
$out/lib/libpord.dylib \
|
||||
$out/lib/libpord.dylib
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "MUltifrontal Massively Parallel sparse direct Solver";
|
||||
homepage = "http://mumps-solver.org/";
|
||||
license = lib.licenses.cecill-c;
|
||||
maintainers = with lib.maintainers; [ nim65s ];
|
||||
broken = stdenv.isDarwin;
|
||||
};
|
||||
})
|
||||
|
@ -61,11 +61,15 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
"out"
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
(lib.cmakeBool "BUILD_DOCUMENTATION" true)
|
||||
(lib.cmakeBool "INSTALL_DOCUMENTATION" true)
|
||||
(lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport)
|
||||
];
|
||||
cmakeFlags =
|
||||
[
|
||||
(lib.cmakeBool "BUILD_DOCUMENTATION" true)
|
||||
(lib.cmakeBool "INSTALL_DOCUMENTATION" true)
|
||||
(lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport)
|
||||
]
|
||||
++ lib.optionals (stdenv.hostPlatform.system == "aarch64-linux") [
|
||||
"-DCMAKE_CTEST_ARGUMENTS=--exclude-regex;ProxQP::dense: test primal infeasibility solving"
|
||||
];
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
, boost
|
||||
, eigen
|
||||
, example-robot-data
|
||||
, casadiSupport ? !stdenv.isDarwin
|
||||
, casadiSupport ? true
|
||||
, collisionSupport ? true
|
||||
, console-bridge
|
||||
, jrl-cmakemodules
|
||||
|
@ -1,15 +1,20 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, fontconfig
|
||||
, gfortran
|
||||
, pkg-config
|
||||
, blas
|
||||
, bzip2
|
||||
, cbc
|
||||
, clp
|
||||
, doxygen
|
||||
, graphviz
|
||||
, ipopt
|
||||
, lapack
|
||||
, libamplsolver
|
||||
, osi
|
||||
, texliveSmall
|
||||
, zlib
|
||||
}:
|
||||
|
||||
@ -27,8 +32,11 @@ stdenv.mkDerivation rec {
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
doxygen
|
||||
gfortran
|
||||
graphviz
|
||||
pkg-config
|
||||
texliveSmall
|
||||
];
|
||||
buildInputs = [
|
||||
blas
|
||||
@ -38,17 +46,43 @@ stdenv.mkDerivation rec {
|
||||
ipopt
|
||||
lapack
|
||||
libamplsolver
|
||||
osi
|
||||
zlib
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
configureFlagsArray = lib.optionals stdenv.isDarwin [
|
||||
"--with-asl-lib=-lipoptamplinterface -lamplsolver"
|
||||
];
|
||||
|
||||
# Fix doc install. Should not be necessary after next release
|
||||
# ref https://github.com/coin-or/Bonmin/commit/4f665bc9e489a73cb867472be9aea518976ecd28
|
||||
sourceRoot = "${src.name}/Bonmin";
|
||||
|
||||
# Fontconfig error: Cannot load default config file: No such file: (null)
|
||||
env.FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf";
|
||||
|
||||
# Fontconfig error: No writable cache directories
|
||||
preBuild = "export XDG_CACHE_HOME=$(mktemp -d)";
|
||||
|
||||
doCheck = true;
|
||||
checkTarget = "test";
|
||||
|
||||
# ignore one failing test
|
||||
postPatch = lib.optionalString stdenv.isDarwin ''
|
||||
substituteInPlace test/Makefile.in --replace-fail \
|
||||
"./unitTest\''$(EXEEXT)" \
|
||||
""
|
||||
'';
|
||||
|
||||
# install documentation
|
||||
postInstall = "make install-doxygen-docs";
|
||||
|
||||
meta = {
|
||||
description = "Open-source code for solving general MINLP (Mixed Integer NonLinear Programming) problems";
|
||||
mainProgram = "bonmin";
|
||||
homepage = "https://github.com/coin-or/Bonmin";
|
||||
license = licenses.epl10;
|
||||
platforms = platforms.unix;
|
||||
maintainers = with maintainers; [ aanderse ];
|
||||
# never built on aarch64-darwin, x86_64-darwin since first introduction in nixpkgs
|
||||
broken = stdenv.isDarwin;
|
||||
license = lib.licenses.epl10;
|
||||
platforms = lib.platforms.unix;
|
||||
maintainers = with lib.maintainers; [ aanderse ];
|
||||
};
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
, lapack
|
||||
, gfortran
|
||||
, enableAMPL ? true, libamplsolver
|
||||
, enableMUMPS ? !stdenv.isDarwin, mumps, mpi
|
||||
, enableMUMPS ? true, mumps, mpi
|
||||
, enableSPRAL ? true, spral
|
||||
}:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user