Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package modern version of cadquery / cq-editor #222734

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- occt-V7_7_0-185d29b/src/ViewerTest/ViewerTest_CmdParser.cxx 2022-11-11 22:19:44.000000000 +0000
+++ occt-V7_7_0-185d29b/src/ViewerTest/ViewerTest_CmdParser.cxx.new 2023-03-22 22:18:45.500057208 +0000
@@ -21,6 +21,7 @@

#include <algorithm>
#include <iostream>
+#include <limits>

namespace
{
9 changes: 7 additions & 2 deletions pkgs/development/libraries/opencascade-occt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@

stdenv.mkDerivation rec {
pname = "opencascade-occt";
version = "7.6.2";
version = "7.7.0";
commit = "V${builtins.replaceStrings ["."] ["_"] version}";

src = fetchurl {
name = "occt-${commit}.tar.gz";
url = "https://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;h=${commit};sf=tgz";
sha256 = "sha256-n3KFrN/mN1SVXfuhEUAQ1fJzrCvhiclxfEIouyj9Z18=";
sha256 = "sha256-aEWhf+X0CzaFpXG+l+VpZgXeI8x6vxD4pkTSFjcRxv8=";
};

patches = [
# There's a missing include <limits>: https://tracker.dev.opencascade.org/view.php?id=33157
./33157_missing_include.patch
];

nativeBuildInputs = [ cmake ninja ];
buildInputs = [ tcl tk libGL libGLU libXext libXmu libXi ]
++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Cocoa;
Expand Down
142 changes: 138 additions & 4 deletions pkgs/development/python-modules/cadquery/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,39 @@
, fetchFromGitHub
, pyparsing
, opencascade
, opencascade-occt
, stdenv
, pandas
, path
, pybind11
, python
, rapidjson
, click
, cmake
, swig
, smesh
, freetype
, jinja2
, joblib
, libcxx
, libGL
, libGLU
, libX11
, logzero
, llvm
, clang
, libclang
, six
, toml
, toposort
, tqdm
, pytest
, makeFontsConf
, freefont_ttf
, pybindgen
, schema
, Cocoa
, vtk
}:

let
Expand Down Expand Up @@ -63,16 +82,127 @@ let
];
});

pywrap = buildPythonPackage rec {
pname = "pywrap";
version = "0.0.0"; # no version as such
src = fetchFromGitHub {
owner = "CadQuery";
repo = "pywrap";
# no versioning. This version is used as a git submodule in OCP.
rev = "f3bcde70fd66a2d884fa60a7a9d9f6aa7c3b6e16";
sha256 = "QhAvJHV5tFq9bjKOzEpcudZNnmUmNVrJ+BLCZJhO31g=";
};

nativeBuildInputs = [
];

buildInputs = [
clang
schema
pandas
toposort
pyparsing
path
toml
tqdm
logzero
jinja2
joblib
click
pybind11
];

propagatedBuildInputs = [
# TODO needed otherwise you get errors importing logzero
clang
schema
pandas
toposort
pyparsing
path
toml
tqdm
logzero
jinja2
joblib
click
pybind11
];
};

# TODO Can't build this!

# TODO ? https://github.com/NixOS/nixpkgs/issues/84552
# [W 230322 23:33:30 translation_unit:48] ./opencascade/Standard_Std.hxx:20:10: fatal error: 'type_traits' file not found
# and
# /build/source/OCP/AIS.cpp:2223:181: error: no matches converting function 'Append' to type 'void (class AIS_ManipulatorObjectSequence::*)(const int&)'
# 2223 | (void (AIS_ManipulatorObjectSequence::*)( const int & ) ) static_cast<void (AIS_ManipulatorObjectSequence::*)( const int & ) >(&AIS_ManipulatorObjectSequence::Append),
# | ^
# In file included from /nix/store/8pwvarkinzvvq8lf3fayklh5hsmj62vm-opencascade-occt-7.7.0/include/opencascade/NCollection_HSequence.hxx:19,
# from /nix/store/8pwvarkinzvvq8lf3fayklh5hsmj62vm-opencascade-occt-7.7.0/include/opencascade/AIS_Manipulator.hxx:26,
# from /build/source/OCP/AIS.cpp:396:


ocp = toPythonModule (stdenv.mkDerivation rec {
pname = "OCP";
# giving up on this version for now: the new version has CMake improvements
# version = "7.6.3.0";
#
# src = fetchFromGitHub {
# owner = "CadQuery";
# repo = "OCP";
# rev = version;
# sha256 = "sha256-43gM7vpVbSrStG1Fg36IKWgZvTIWgqd0C6vfm5iwQ4w=";
# };
version = "7.7.0.0";

src = fetchFromGitHub {
owner = "CadQuery";
repo = "OCP";
rev = "690c394abf32617f0c044159ad8a89480d40b240";
sha256 = "y4lq0tUY+t6gL2DgQq28uD8a1Cvj7dTUzyoyWAA4J4g=";
};
patches = [ ./patch_OCP_inheritpythonpath.patch ];

nativeBuildInputs = [
cmake

];

buildInputs = [
llvm
vtk
python
pybindgen
rapidjson
clang
libclang
opencascade
opencascade-occt
#pywrap
];

propagatedBuildInputs = [
pywrap
libcxx
];

cmakeFlags = [
#"-DPYTHONPATH=$PYTHONPATH"
#"-DCXX_INCLUDES='-i ${libcxx}'"
];
});

in
buildPythonPackage rec {
pname = "cadquery";
version = "2.0";
version = "2.2.0";

src = fetchFromGitHub {
owner = "CadQuery";
repo = pname;
rev = version;
sha256 = "1n63b6cjjrdwdfmwq0zx1xabjnhndk9mgfkm4w7z9ardcfpvg84l";
sha256 = "KzwPD+bhCHFiLVAVLn9cLsVke/N3PTh7d2pAzuPeHKI=";
};

buildInputs = [
Expand All @@ -81,7 +211,7 @@ in

propagatedBuildInputs = [
pyparsing
pythonocc-core-cadquery
ocp
];

FONTCONFIG_FILE = makeFontsConf {
Expand All @@ -92,12 +222,16 @@ in
pytest
];

disabled = pythonOlder "3.6" || pythonAtLeast "3.8";
disabled = pythonOlder "3.8" || pythonAtLeast "3.11";

meta = with lib; {
description = "Parametric scripting language for creating and traversing CAD models";
homepage = "https://github.com/CadQuery/cadquery";
license = licenses.asl20;
maintainers = with maintainers; [ costrouc marcus7070 ];
};

passthru = {
inherit ocp pywrap;
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 11a9a4e3..e38fb92c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,8 @@ else()
set(PLATFORM Linux)
endif()

-set(ENV{PYTHONPATH} ${CMAKE_SOURCE_DIR}/pywrap )
+# breaks nixpkgs build
+#set(ENV{PYTHONPATH} ${CMAKE_SOURCE_DIR}/pywrap )

if( NOT EXISTS ${CMAKE_SOURCE_DIR}/OCP )
message( STATUS "Running pywrap")
@@ -37,7 +38,7 @@ if( NOT EXISTS ${CMAKE_SOURCE_DIR}/OCP )
-l ${LIBCLANG_PATH}
-i ${CLANG_INCLUDE_DIRS}/
-i ${VTK_INCLUDE_DIR}/
- -i ${CLANG_INSTALL_PREFIX}/lib/clang/${LLVM_VERSION}/include/
+# -i ${CLANG_INSTALL_PREFIX}/lib/clang/${LLVM_VERSION}/include/
${CXX_INCLUDES}
all ocp.toml ${PLATFORM}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
25 changes: 25 additions & 0 deletions pkgs/development/python-modules/clang/common.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{ buildPythonPackage
, fetchPypi
, lib
, nose
, sha256
, version
}:

buildPythonPackage rec {
inherit version;
pname = "clang";

src = fetchPypi {
inherit pname sha256 version;
};

checkInputs = [ nose ];

meta = with lib; {
description = "libclang python bindings";
homepage = "https://clang.llvm.org/";
license = licenses.ncsa;
maintainers = with maintainers; [ samuela ];
};
}
7 changes: 7 additions & 0 deletions pkgs/development/python-modules/clang/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
self: rec {
clang_11 = self.callPackage ./common.nix {
version = "11.0";
sha256 = "sha256:1igqqvnm3yrzy08fz9sszn1r9hr0jkhhms4pzcgckr8zbd3ycf7q";
};
clang = clang_11;
}
5 changes: 5 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1797,6 +1797,11 @@ self: super: with self; {

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

inherit (import ../development/python-modules/clang self)
clang_5
clang_11
clang;

classify-imports = callPackage ../development/python-modules/classify-imports { };

cld2-cffi = callPackage ../development/python-modules/cld2-cffi { };
Expand Down