openscad: fix lib3mf linking

This change explicitly sets the LIB3MF_INCLUDEPATH and LIB3MF_LIBPATH
environment variables instead of relying on `pkg-config` resolution.
This is due to the following issues with the existing build logic:

* The library name was using `lib3MF` instead of `lib3mf`. `pkg-config`
  is case-sensitive and is unable to find the former.
* The current `lib3mf` nix artifact exports multiple language bindings
  in the `includedir`. Each language needs to refer to the correct path
  inside of it.
This commit is contained in:
Cameron Bytheway 2024-06-26 16:49:33 -06:00
parent 7b56d9dd0d
commit 7677e0f78e
No known key found for this signature in database
GPG Key ID: BAF3C71DE3174EDA

View File

@ -32,6 +32,8 @@
, wrapGAppsHook3
, qtwayland
, cairo
, openscad
, runCommand
}:
mkDerivation rec {
@ -69,7 +71,11 @@ mkDerivation rec {
++ lib.optional spacenavSupport libspnav
;
qmakeFlags = [ "VERSION=${version}" ] ++
qmakeFlags = [
"VERSION=${version}"
"LIB3MF_INCLUDEPATH=${lib3mf.dev}/include/lib3mf/Bindings/Cpp"
"LIB3MF_LIBPATH=${lib3mf}/lib"
] ++
lib.optionals spacenavSupport [
"ENABLE_SPNAV=1"
"SPNAV_INCLUDEPATH=${libspnav}/include"
@ -112,4 +118,14 @@ mkDerivation rec {
maintainers = with lib.maintainers; [ bjornfor raskin gebner ];
mainProgram = "openscad";
};
passthru.tests = {
lib3mf_support = runCommand "${pname}-lib3mf-support-test" {
nativeBuildInputs = [ openscad ];
} ''
echo "cube([1, 1, 1]);" | openscad -o cube.3mf -
echo "import(\"cube.3mf\");" | openscad -o cube-import.3mf -
mv cube-import.3mf $out
'';
};
}