Skip to content

Commit

Permalink
fix ifcopenshell build
Browse files Browse the repository at this point in the history
  • Loading branch information
autra committed Jun 20, 2024
1 parent e7fd430 commit 689d08e
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 24 deletions.
96 changes: 73 additions & 23 deletions pkgs/development/python-modules/ifcopenshell/default.nix
Original file line number Diff line number Diff line change
@@ -1,60 +1,104 @@
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
gcc10,
cmake,
boost179,
icu,
swig,
pcre,
opencascade-occt_7_6,
opencollada,
libxml2,
# TODO format with nixpkgs (comma position ?)
{ lib
, stdenv
, testers
, buildPythonPackage
, fetchFromGitHub
, gcc10
, cmake
, cgal
, boost179
, gmp
, icu
, swig
, mpfr
, pcre
, opencascade-occt_7_6
, opencollada
, libxml2
, hdf5
, zlib
, libaec
, python3
# python deps
, setuptools
, mathutils
, shapely
, numpy
, isodate
, python-dateutil
, lark
}:
let
opencascade-occt = opencascade-occt_7_6;
in
buildPythonPackage rec {
pname = "ifcopenshell";
version = "240306";
version = "0.7.0";
format = "other";

src = fetchFromGitHub {
owner = "IfcOpenShell";
repo = "IfcOpenShell";
rev = "refs/tags/blenderbim-${version}";
owner = "IfcOpenShell";
repo = "IfcOpenShell";
rev = "refs/tags/v${version}";
fetchSubmodules = true;
sha256 = "sha256-DtA8KeWipPfOnztKG/lrgLZeOCUG3nWR9oW7OST7koc=";
};

nativeBuildInputs = [
gcc10
cmake
];
nativeBuildInputs = [ gcc10 cmake setuptools ];
pythonImportsCheck = [ "ifcopenshell" ];

buildInputs = [
# ifcopenshell needs stdc++
stdenv.cc.cc.lib
boost179
cgal
gmp
icu
mpfr
pcre
libxml2
hdf5
opencascade-occt
python3
libaec
];

dependencies = [
mathutils
shapely
numpy
isodate
python-dateutil
lark
];

preConfigure = ''
cd cmake
'';

PYTHONUSERBASE = ".";
postInstall = ''
echo Installing pyproject.toml
cp -v $src/src/ifcopenshell-python/pyproject.toml $out/lib/python3.11/site-packages/ifcopenshell/pyproject.toml
'';

PYTHONUSERBASE=".";
cmakeFlags = [
"-DUSERSPACE_PYTHON_PREFIX=ON"
"-DBUILD_IFCPYTHON=ON"
"-DOCC_INCLUDE_DIR=${opencascade-occt}/include/opencascade"
"-DOCC_LIBRARY_DIR=${opencascade-occt}/lib"
"-DOPENCOLLADA_INCLUDE_DIR=${opencollada}/include/opencollada"
"-DOPENCOLLADA_LIBRARY_DIR=${opencollada}/lib/opencollada"
"-DSWIG_EXECUTABLE=${swig}/bin/swig"
"-DLIBXML2_INCLUDE_DIR=${libxml2.dev}/include/libxml2"
"-DLIBXML2_LIBRARIES=${libxml2.out}/lib/libxml2${stdenv.hostPlatform.extensions.sharedLibrary}"
"-DGMP_LIBRARY_DIR=${gmp.out}/lib/"
"-DMPFR_LIBRARY_DIR=${mpfr.out}/lib/"
# HDF5 support is currently not optional, see https://github.com/IfcOpenShell/IfcOpenShell/issues/1815
"-DHDF5_SUPPORT=ON"
"-DHDF5_INCLUDE_DIR=${hdf5.dev}/include/"
"-DHDF5_LIBRARIES=${hdf5.out}/lib/libhdf5_cpp.so;${hdf5.out}/lib/libhdf5.so;${zlib.out}/lib/libz.so;${libaec.out}/lib/libaec.so;" # /usr/lib64/libsz.so;"
];

meta = with lib; {
Expand All @@ -64,4 +108,10 @@ buildPythonPackage rec {
license = licenses.lgpl3;
maintainers = with maintainers; [ fehnomenal ];
};

# passthru.tests.version = testers.testVersion {
# package = ifcopenshell;
# command = "IfcConvert --version";
# version = version;
# };
}
4 changes: 3 additions & 1 deletion pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5712,7 +5712,9 @@ self: super: with self; {

ifconfig-parser = callPackage ../development/python-modules/ifconfig-parser { };

ifcopenshell = callPackage ../development/python-modules/ifcopenshell { };
ifcopenshell = callPackage ../development/python-modules/ifcopenshell {
inherit (pkgs) libxml2;
};

ignite = callPackage ../development/python-modules/ignite { };

Expand Down

0 comments on commit 689d08e

Please sign in to comment.