Initial package (close RHBZ#2297958)
This commit is contained in:
parent
482e034c9a
commit
3e6e312eb1
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/cascadio-0.0.12.tar.gz
|
12
.packit.yaml
Normal file
12
.packit.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
upstream_project_url: https://github.com/trimesh/cascadio
|
||||
copy_upstream_release_description: false
|
||||
|
||||
jobs:
|
||||
- job: pull_from_upstream
|
||||
trigger: release
|
||||
dist_git_branches:
|
||||
- fedora-rawhide
|
||||
- job: koji_build
|
||||
trigger: commit
|
||||
dist_git_branches:
|
||||
- fedora-all
|
60
7.patch
Normal file
60
7.patch
Normal file
@ -0,0 +1,60 @@
|
||||
From de2510fed8f6e2a5c297aef35b08d55534067417 Mon Sep 17 00:00:00 2001
|
||||
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
|
||||
Date: Thu, 28 Mar 2024 15:24:28 -0400
|
||||
Subject: [PATCH] Add a SYSTEM_OPENCASCADE CMake option for using an external
|
||||
OpenCASCADE
|
||||
|
||||
---
|
||||
CMakeLists.txt | 36 ++++++++++++++++++++++--------------
|
||||
1 file changed, 22 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 90cdbf9..72f5816 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -20,23 +20,31 @@ pybind11_add_module(cascadio src/main.cpp)
|
||||
target_compile_definitions(cascadio
|
||||
PRIVATE VERSION_INFO=${PROJECT_VERSION})
|
||||
|
||||
+option(SYSTEM_OPENCASCADE "Use an external/system copy of OpenCASCADE" OFF)
|
||||
+
|
||||
# Set the C++ standard to C++11
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
|
||||
-# Set path to header files directories
|
||||
-target_include_directories(cascadio PUBLIC
|
||||
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/upstream/OCCT/include/opencascade>
|
||||
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/upstream/OCCT/inc>)
|
||||
-
|
||||
-# Set path to executable directories
|
||||
-target_link_directories(
|
||||
- cascadio PUBLIC
|
||||
- "${CMAKE_CURRENT_SOURCE_DIR}/upstream/OCCT/win64/gcc/lib"
|
||||
- "${CMAKE_CURRENT_SOURCE_DIR}/upstream/OCCT/win64/vc14/lib"
|
||||
- "${CMAKE_CURRENT_SOURCE_DIR}/upstream/OCCT/lin64/gcc/lib"
|
||||
- "${CMAKE_CURRENT_SOURCE_DIR}/upstream/OCCT/lin32/gcc/lib"
|
||||
- "${CMAKE_CURRENT_SOURCE_DIR}/upstream/OCCT/mac64/clang/lib"
|
||||
-)
|
||||
+if(SYSTEM_OPENCASCADE)
|
||||
+ find_package(OpenCASCADE CONFIG REQUIRED)
|
||||
+ # Set path to header files directories
|
||||
+ target_include_directories(cascadio PUBLIC "${OpenCASCADE_INCLUDE_DIR}")
|
||||
+else()
|
||||
+ # Set path to header files directories
|
||||
+ target_include_directories(cascadio PUBLIC
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/upstream/OCCT/include/opencascade>
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/upstream/OCCT/inc>)
|
||||
+
|
||||
+ # Set path to executable directories
|
||||
+ target_link_directories(
|
||||
+ cascadio PUBLIC
|
||||
+ "${CMAKE_CURRENT_SOURCE_DIR}/upstream/OCCT/win64/gcc/lib"
|
||||
+ "${CMAKE_CURRENT_SOURCE_DIR}/upstream/OCCT/win64/vc14/lib"
|
||||
+ "${CMAKE_CURRENT_SOURCE_DIR}/upstream/OCCT/lin64/gcc/lib"
|
||||
+ "${CMAKE_CURRENT_SOURCE_DIR}/upstream/OCCT/lin32/gcc/lib"
|
||||
+ "${CMAKE_CURRENT_SOURCE_DIR}/upstream/OCCT/mac64/clang/lib"
|
||||
+ )
|
||||
+endif()
|
||||
|
||||
# Add all possible libraries we might need
|
||||
target_link_libraries(cascadio PRIVATE
|
2
python-cascadio.rpmlintrc
Normal file
2
python-cascadio.rpmlintrc
Normal file
@ -0,0 +1,2 @@
|
||||
# Not a real spelling error:
|
||||
addFilter(r" spelling-error \('(trimesh)',")
|
93
python-cascadio.spec
Normal file
93
python-cascadio.spec
Normal file
@ -0,0 +1,93 @@
|
||||
%bcond bootstrap 0
|
||||
# Break a test-dependency loop between this package and python-trimesh.
|
||||
%bcond tests %{without bootstrap}
|
||||
|
||||
Name: python-cascadio
|
||||
Version: 0.0.12
|
||||
Release: %autorelease
|
||||
Summary: Convert STEP files to GLB using OpenCASCADE
|
||||
|
||||
License: MIT
|
||||
URL: https://github.com/mikedh/cascadio
|
||||
# The PyPI project does not have sdists, so we must use the GitHub archive.
|
||||
Source: %{url}/archive/%{version}/cascadio-%{version}.tar.gz
|
||||
|
||||
# Add a SYSTEM_OPENCASCADE CMake option for using an external OpenCASCADE
|
||||
# https://github.com/trimesh/cascadio/pull/7
|
||||
Patch: %{url}/pull/7.patch
|
||||
|
||||
BuildRequires: python3-devel
|
||||
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: ninja-build
|
||||
|
||||
BuildRequires: cmake(OpenCASCADE)
|
||||
# RapidJSON headers are included indirectly via
|
||||
# opencascade/RWGltf_CafWriter.hxx, so the header-only library is compiled into
|
||||
# this extension and should technically be tracked even though it is an
|
||||
# indirect dependency.
|
||||
# https://docs.fedoraproject.org/en-US/packaging-guidelines/#_packaging_header_only_libraries
|
||||
BuildRequires: rapidjson-static
|
||||
|
||||
%global common_description %{expand:
|
||||
A Python library which uses OpenCASCADE to convert STEP files to a GLB file
|
||||
which can quickly be loaded by trimesh and other libraries.
|
||||
|
||||
This is not intended to be a full binding of OpenCASCADE like OCP or PythonOCC.
|
||||
Rather it is intended to be an easy minimal way to load boundary representation
|
||||
files into a triangulated scene in Python. There are a few options for loading
|
||||
STEP geometry in the open-source ecosystem: GMSH, FreeCAD, etc. However nearly
|
||||
all of them use OpenCASCADE under the hood as it is pretty much the only
|
||||
open-source BREP kernel.}
|
||||
|
||||
%description %{common_description}
|
||||
|
||||
|
||||
%package -n python3-cascadio
|
||||
Summary: %{summary}
|
||||
|
||||
%description -n python3-cascadio %{common_description}
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -n cascadio-%{version} -p1
|
||||
# DEBUG
|
||||
# The CMake scripts shipped with the system VTK try to find HDF5 by compiling
|
||||
# and linking a C program; we need to enable the C language in the top-level
|
||||
# project in order for this to work.
|
||||
sed -r -i 's/\bCXX\b/C &/' CMakeLists.txt
|
||||
|
||||
|
||||
%generate_buildrequires
|
||||
%pyproject_buildrequires %{?with_tests:-x tests}
|
||||
|
||||
|
||||
%build
|
||||
# https://scikit-build-core.readthedocs.io/en/latest/configuration.html
|
||||
%{pyproject_wheel \
|
||||
-Ccmake.define.SYSTEM_OPENCASCADE=ON \
|
||||
-Clogging.level=INFO \
|
||||
-Ccmake.verbose=true \
|
||||
-Ccmake.build-type="RelWithDebInfo" \
|
||||
-Cinstall.strip=false}
|
||||
|
||||
|
||||
%install
|
||||
%pyproject_install
|
||||
%pyproject_save_files -L cascadio
|
||||
|
||||
|
||||
%check
|
||||
%pyproject_check_import
|
||||
%if %{with tests}
|
||||
%pytest
|
||||
%endif
|
||||
|
||||
|
||||
%files -n python3-cascadio -f %{pyproject_files}
|
||||
%license LICENSE/
|
||||
%doc README.md
|
||||
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
Loading…
Reference in New Issue
Block a user