Skip to content

Commit 973ebf7

Browse files
authored
Merge pull request #171 from tataratat/ft-gustaf
gustaf - Flip dependency
2 parents 4023855 + d634be3 commit 973ebf7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+17164
-361
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: build docs
3030
run: |
3131
pip install -r ./docs/requirements.txt
32-
sphinx-build -W -b html docs/source docs/build
32+
sphinx-build -W -b html docs/source docs/build -j auto
3333
3434
- name: deploy docs only if it is pushed to main
3535
uses: peaceiris/actions-gh-pages@v3

.github/workflows/main.yml

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,76 @@ on:
55
branches: ["main"]
66

77
jobs:
8-
wheel_build_full:
9-
runs-on: ${{ matrix.os }}
8+
macos_wheel:
9+
runs-on: macos-latest
1010
strategy:
1111
matrix:
12-
os: [macos-latest, ubuntu-latest, windows-latest]
12+
arch: [x86_64, arm64]
13+
cw_build: ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp310-*", "cp311-*"]
1314

1415
steps:
1516
- uses: actions/checkout@v3
1617
with:
1718
submodules: recursive
18-
- name: build wheels
19-
uses: pypa/cibuildwheel@v2.12.1
19+
- name: build wheels
20+
uses: pypa/cibuildwheel@v2.13.1
2021
env:
22+
CIBW_ARCHS: ${{ matrix.arch }}
23+
CIBW_BUILD: ${{ matrix.cw_build }}
24+
CIBW_TEST_SKIP: "*-macosx_arm64"
2125
SPLINEPY_GITHUB_ACTIONS_BUILD: True
2226

2327
- uses: actions/upload-artifact@v3
2428
with:
2529
path: ./wheelhouse/*.whl
30+
retention-days: 2
31+
32+
linux_wheel:
33+
runs-on: ubuntu-latest
34+
strategy:
35+
matrix:
36+
arch: [x86_64]
37+
cw_build: ["cp36*many*", "cp37*many*", "cp38*many*", "cp39*many*", "cp310*many*", "cp311*many*"]
38+
39+
steps:
40+
- uses: actions/checkout@v3
41+
with:
42+
submodules: recursive
43+
- name: build wheels
44+
uses: pypa/[email protected]
45+
env:
46+
CIBW_ARCHS: ${{ matrix.arch }}
47+
CIBW_BUILD: ${{ matrix.cw_build }}
48+
SPLINEPY_GITHUB_ACTIONS_BUILD: True
49+
50+
- uses: actions/upload-artifact@v3
51+
with:
52+
path: ./wheelhouse/*.whl
53+
retention-days: 2
54+
55+
windows_wheel:
56+
runs-on: windows-latest
57+
strategy:
58+
matrix:
59+
arch: [x86, AMD64, ARM64]
60+
cw_build: ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp310-*", "cp311-*"]
61+
62+
steps:
63+
- uses: actions/checkout@v3
64+
with:
65+
submodules: recursive
66+
- name: build wheels
67+
uses: pypa/[email protected]
68+
env:
69+
CIBW_ARCHS: ${{ matrix.arch }}
70+
CIBW_BUILD: ${{ matrix.cw_build }}
71+
CIBW_TEST_SKIP: "*-win_arm64"
72+
SPLINEPY_GITHUB_ACTIONS_BUILD: True
73+
74+
- uses: actions/upload-artifact@v3
75+
with:
76+
path: ./wheelhouse/*.whl
77+
retention-days: 2
2678

2779
source_dist:
2880
runs-on: ubuntu-latest
@@ -37,6 +89,8 @@ jobs:
3789
- uses: actions/upload-artifact@v3
3890
with:
3991
path: ./dist/*
92+
retention-days: 2
93+
4094

4195
upload_test_pypi:
4296
needs: [wheel_build_full, source_dist]

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,3 @@
1010
[submodule "third_party/bezman"]
1111
path = third_party/bezman
1212
url = [email protected]:tataratat/bezman.git
13-
[submodule "third_party/uff"]
14-
path = third_party/uff
15-
url = [email protected]:tataratat/uff

CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
2626
set(namespace "${PROJECT_NAME}::")
2727

2828

29+
# default build type id debug
30+
if (NOT CMAKE_BUILD_TYPE)
31+
message("CMAKE_BUILD_TYPE undefined. Setting Debug.")
32+
set(CMAKE_BUILD_TYPE Debug)
33+
endif()
34+
2935
# global flags
3036
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
3137
set(SPLINEPY_DEFS $<$<NOT:$<CONFIG:Debug>>:NDEBUG>)
@@ -76,5 +82,19 @@ if(SPLINEPY_BUILD_EXPLICIT)
7682
SPLINEPY_BUILD_EXPLICIT)
7783
endif(SPLINEPY_BUILD_EXPLICIT)
7884

85+
# try to avoid re-build of splinepy if possible
86+
if(SPLINEPY_COMPILE_PYTHON)
87+
find_package(SplineLib QUIET)
88+
find_package(bezman QUIET)
89+
find_package(napf QUIET)
90+
find_package(splinepy QUIET)
91+
if(splinepy_FOUND)
92+
message("Found installed splinepy, building only python module")
93+
add_subdirectory(third_party/pybind11)
94+
add_subdirectory(cpp/splinepy/py)
95+
return()
96+
endif()
97+
endif()
98+
7999
add_subdirectory(third_party)
80100
add_subdirectory(cpp/splinepy)

cpp/splinepy/py/CMakeLists.txt

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,16 @@ set(PYSPLINEPY_SRCS
88
init/multi_patch.cpp
99
init/reader.cpp
1010
init/spline_extensions.cpp
11-
init/uffpy.cpp
1211
splinepy_core.cpp)
1312

1413
# add target
1514
pybind11_add_module(splinepy_core ${PYSPLINEPY_SRCS})
1615
target_include_directories(splinepy_core PRIVATE "${PROJECT_SOURCE_DIR}/cpp")
17-
target_compile_definitions(splinepy_core PRIVATE ${DEFS})
16+
target_compile_definitions(splinepy_core PRIVATE ${SPLINEPY_DEFS})
1817
target_compile_options(splinepy_core
1918
PRIVATE
2019
${SPLINEPY_FLAGS}
2120
${SPLINEPY_OPTIMIZATION_FLAGS})
2221

23-
# link splinepy
24-
target_link_libraries(splinepy_core PRIVATE splinepy)
25-
26-
# link splinelib
27-
if(SPLINEPY_COMPILE_SPLINELIB)
28-
target_link_libraries(splinepy_core PRIVATE splines input_output)
29-
else()
30-
find_package(SplineLib REQUIRED)
31-
target_link_libraries(splinepy_core
32-
PRIVATE
33-
SplineLib::splines
34-
SplineLib::input_output
35-
)
36-
endif()
37-
38-
# link bezman
39-
target_link_libraries(splinepy_core PRIVATE bezman)
40-
41-
# link fitting
42-
target_link_libraries(splinepy_core PRIVATE fitting)
43-
44-
# link napf
45-
target_link_libraries(splinepy_core PRIVATE napf)
46-
47-
# link uff
48-
target_link_libraries(splinepy_core PRIVATE uff)
22+
# link splinepy - all the other dependencies should propagte from splinepy
23+
target_link_libraries(splinepy_core PRIVATE splinepy::splinepy)

cpp/splinepy/py/init/uffpy.cpp

Lines changed: 0 additions & 8 deletions
This file was deleted.

cpp/splinepy/py/py_multi_patch.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
// Bezman
1414
#include <bezman/src/utils/algorithms/point_uniquifier.hpp>
1515

16-
// uff
17-
#include <uff.hpp>
18-
1916
//
2017
#include <splinepy/py/py_spline.hpp>
2118
#include <splinepy/splines/null_spline.hpp>

cpp/splinepy/py/py_uffpy.hpp

Lines changed: 0 additions & 73 deletions
This file was deleted.

cpp/splinepy/py/splinepy_core.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ void init_exporter(py::module_&);
2626
// fitting
2727
void init_fitting(py::module_&);
2828

29-
// unique vertices
30-
void init_uffpy(py::module_&);
31-
3229
// multi_patch
3330
void init_multi_patch(py::module_& m);
3431

@@ -46,6 +43,5 @@ PYBIND11_MODULE(splinepy_core, m) {
4643
splinepy::py::init::init_exporter(m);
4744
splinepy::py::init::init_fitting(m);
4845
splinepy::py::init::init_knot_insertion_matrix(m);
49-
splinepy::py::init::init_uffpy(m);
5046
splinepy::py::init::init_multi_patch(m);
5147
}

examples/create_basic_splines.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import gustaf as gus
2+
import numpy as np
3+
4+
import splinepy
5+
6+
if __name__ == "__main__":
7+
line = splinepy.helpme.create.line(
8+
np.array([[0, 0, 0], [2, 5, 0], [4, 4, 2]])
9+
)
10+
rect = splinepy.helpme.create.box(5, 3)
11+
box = splinepy.helpme.create.box(3, 2, 4)
12+
pyramid = splinepy.helpme.create.pyramid(1, 1, 2)
13+
14+
gus.show(
15+
["Line", line],
16+
["Rectangle", rect],
17+
["Box", box],
18+
["Pyramid", pyramid],
19+
title="Rectangular objects",
20+
resolution=50,
21+
)
22+
23+
circ = splinepy.helpme.create.circle(5)
24+
disk1 = splinepy.helpme.create.disk(3, angle=100, n_knot_spans=4)
25+
disk2 = splinepy.helpme.create.disk(
26+
5, inner_radius=1.0, angle=360, n_knot_spans=10
27+
)
28+
29+
gus.show(["Line Circle", circ], ["Disk section", disk1], ["Disk", disk2])
30+
31+
cone = splinepy.helpme.create.cone(5, 10, angle=180)
32+
gus.show(["Cone", cone])
33+
34+
torus = splinepy.helpme.create.torus(10, 2)
35+
torus2 = splinepy.helpme.create.torus(
36+
5, 2, section_inner_radius=0.5, torus_angle=100, section_angle=210
37+
)
38+
39+
gus.show(["Torus", torus], ["Torus section", torus2], resolution=50)
40+
41+
sphere = splinepy.helpme.create.sphere(3)
42+
gus.show(["Sphere", sphere], resolution=50)

0 commit comments

Comments
 (0)