1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 csxcad,
6 fparser,
7 tinyxml,
8 hdf5,
9 vtk,
10 boost,
11 zlib,
12 cmake,
13 octave,
14 mpi,
15 withQcsxcad ? true,
16 withMPI ? false,
17 withHyp2mat ? true,
18 qcsxcad,
19 hyp2mat,
20}:
21
22stdenv.mkDerivation rec {
23 pname = "openems";
24 version = "0.0.36";
25
26 src = fetchFromGitHub {
27 owner = "thliebig";
28 repo = "openEMS";
29 rev = "v${version}";
30 sha256 = "sha256-wdH+Zw7G2ZigzBMX8p3GKdFVx/AhbTNL+P3w+YjI/dc=";
31 };
32
33 nativeBuildInputs = [
34 cmake
35 ];
36
37 cmakeFlags = lib.optionals withMPI [ "-DWITH_MPI=ON" ];
38
39 buildInputs = [
40 fparser
41 tinyxml
42 hdf5
43 vtk
44 boost
45 zlib
46 csxcad
47 (octave.override { inherit hdf5; })
48 ]
49 ++ lib.optionals withQcsxcad [ qcsxcad ]
50 ++ lib.optionals withMPI [ mpi ]
51 ++ lib.optionals withHyp2mat [ hyp2mat ];
52
53 postFixup = ''
54 substituteInPlace $out/share/openEMS/matlab/setup.m \
55 --replace /usr/lib ${hdf5}/lib \
56 --replace /usr/include ${hdf5}/include
57
58 ${octave}/bin/mkoctfile -L${hdf5}/lib -I${hdf5}/include \
59 -lhdf5 $out/share/openEMS/matlab/h5readatt_octave.cc \
60 -o $out/share/openEMS/matlab/h5readatt_octave.oct
61 '';
62
63 meta = with lib; {
64 description = "Open Source Electromagnetic Field Solver";
65 homepage = "https://wiki.openems.de/index.php/Main_Page.html";
66 license = licenses.gpl3;
67 maintainers = with maintainers; [ matthuszagh ];
68 platforms = platforms.linux;
69 };
70}