Skip to content

Commit 428d60a

Browse files
committed
install
1 parent aaf3632 commit 428d60a

4 files changed

Lines changed: 71 additions & 119 deletions

File tree

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,22 +135,27 @@ function(pyigl_include prefix name)
135135
set(output_dir "${PYIGL_OUTPUT_DIRECTORY}/${subpath}")
136136
file(MAKE_DIRECTORY ${output_dir})
137137
file(WRITE "${output_dir}/__init__.py" "from .${target_name} import *\n")
138+
install(FILES "${output_dir}/__init__.py" DESTINATION "igl/${subpath}")
138139
if("${name}" STREQUAL "core" AND "${prefix}" STREQUAL "")
140+
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/igl/_version.py" DESTINATION "igl/${subpath}")
139141
file(APPEND "${output_dir}/__init__.py" "from ._version import __version__\n")
140142
endif()
143+
141144
set_target_properties(${target_name} PROPERTIES
142145
LIBRARY_OUTPUT_DIRECTORY "${output_dir}"
143146
RUNTIME_OUTPUT_DIRECTORY "${output_dir}"
144147
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${output_dir}"
145148
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${output_dir}"
146149
)
150+
set(PYI_OUTPUT "${output_dir}/${target_name}.pyi")
147151
nanobind_add_stub(
148152
${target_name}_stub
149153
MODULE ${target_name}
150-
OUTPUT "${output_dir}/${target_name}.pyi"
154+
OUTPUT ${PYI_OUTPUT}
151155
PYTHON_PATH $<TARGET_FILE_DIR:${target_name}>
152156
DEPENDS ${target_name}
153157
)
158+
install(FILES "${PYI_OUTPUT}" DESTINATION "igl/${subpath}")
154159

155160
# just to add dependency?
156161
if("${name}" STREQUAL "core")

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,10 @@ According to the [scikit-build-core documentation](https://scikit-build-core.rea
3535
```
3636
python -m pip install --no-build-isolation --config-settings=editable.rebuild=true -Cbuild-dir=build -ve.
3737
```
38+
39+
## Testing cibuildwheel locally
40+
41+
Install whichever version of Python from the [official website](https://www.python.org/downloads/) and then run:
42+
43+
/Library/Frameworks/Python.framework/Versions/[version]/bin/python -m pip install cibuildwheel
44+
CIBW_BUILD="cp311-*" python -m cibuildwheel --output-dir wheelhouse --platform macos

igl/helpers.py

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

tests/test_all.py

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -16,62 +16,62 @@ def test_version():
1616
pass
1717

1818

19-
##def rand_sparse(n,density):
20-
## n_features = n
21-
## n_samples = n
22-
## rng1 = np.random.RandomState(42)
23-
## rng2 = np.random.RandomState(43)
24-
##
25-
## nnz = int(n_samples*n_features*density)
26-
##
27-
## row = rng1.randint(n_samples, size=nnz)
28-
## cols = rng2.randint(n_features, size=nnz)
29-
## data = rng1.rand(nnz)
30-
##
31-
## S = scipy.sparse.coo_matrix((data, (row, cols)), shape=(n_samples, n_features))
32-
## return S.tocsc()
33-
##
34-
##def time_noop():
35-
## def helper(N,I,SN,SI):
36-
## igl.noop(SN=SN)
37-
## # start timer
38-
## runs = 100
39-
## start = time.time()
40-
## for i in range(runs):
41-
## igl.noop(SN=SN)
42-
## # end timer
43-
## end = time.time()
44-
## return (end - start)/runs
45-
## n = 10000
46-
## m = 10
47-
## N64_f = np.asfortranarray(np.random.randn(n,m).astype(np.float64))
48-
## I64_f = np.asfortranarray(np.random.randn(n,m).astype(np.int64))
49-
## # random sparse matrix
50-
## SN64 = rand_sparse(n,1.0/(n))
51-
## # print number of nonzeros
52-
## SI64 = (rand_sparse(n,1.0/(n))*1000).astype(np.int64)
53-
## print(f"noop<{n},{m}>: {helper(N64_f,I64_f,SN64,SI64)} secs")
54-
##
55-
##time_noop()
56-
#
57-
## print(igl.matlab_format(V,"V"))
58-
## print(igl.matlab_format_index(F,"F"))
59-
## print(igl.matlab_format(dV,"dV"))
60-
## print(igl.matlab_format_index(dF,"dF"))
19+
#def rand_sparse(n,density):
20+
# n_features = n
21+
# n_samples = n
22+
# rng1 = np.random.RandomState(42)
23+
# rng2 = np.random.RandomState(43)
24+
#
25+
# nnz = int(n_samples*n_features*density)
26+
#
27+
# row = rng1.randint(n_samples, size=nnz)
28+
# cols = rng2.randint(n_features, size=nnz)
29+
# data = rng1.rand(nnz)
30+
#
31+
# S = scipy.sparse.coo_matrix((data, (row, cols)), shape=(n_samples, n_features))
32+
# return S.tocsc()
33+
#
34+
#def time_noop():
35+
# def helper(N,I,SN,SI):
36+
# igl.noop(SN=SN)
37+
# # start timer
38+
# runs = 100
39+
# start = time.time()
40+
# for i in range(runs):
41+
# igl.noop(SN=SN)
42+
# # end timer
43+
# end = time.time()
44+
# return (end - start)/runs
45+
# n = 10000
46+
# m = 10
47+
# N64_f = np.asfortranarray(np.random.randn(n,m).astype(np.float64))
48+
# I64_f = np.asfortranarray(np.random.randn(n,m).astype(np.int64))
49+
# # random sparse matrix
50+
# SN64 = rand_sparse(n,1.0/(n))
51+
# # print number of nonzeros
52+
# SI64 = (rand_sparse(n,1.0/(n))*1000).astype(np.int64)
53+
# print(f"noop<{n},{m}>: {helper(N64_f,I64_f,SN64,SI64)} secs")
54+
#
55+
#time_noop()
6156

57+
# print(igl.matlab_format(V,"V"))
58+
# print(igl.matlab_format_index(F,"F"))
59+
# print(igl.matlab_format(dV,"dV"))
60+
# print(igl.matlab_format_index(dF,"dF"))
6261

63-
# seed numpy's random number generator
64-
#
65-
#def triangulated_square():
66-
# V = np.array([[0,0,0],[1,0,0],[1,1,0],[0,1,0]],dtype=np.float64)
67-
# F = np.array([[0,1,2],[0,2,3]],dtype=np.int64)
68-
# return V,F
69-
#
70-
#def single_tet():
71-
# V = np.array([[0,0,0],[1,0,0],[0,1,0],[0,0,1]],dtype=np.float64)
72-
# F = np.array([[2,1,0],[1,3,0],[3,2,0],[2,3,1]],dtype=np.int64)
73-
# T = np.array([[0,1,2,3]],dtype=np.int64)
74-
# return V,F,T
62+
63+
#seed numpy's random number generator
64+
65+
def triangulated_square():
66+
V = np.array([[0,0,0],[1,0,0],[1,1,0],[0,1,0]],dtype=np.float64)
67+
F = np.array([[0,1,2],[0,2,3]],dtype=np.int64)
68+
return V,F
69+
70+
def single_tet():
71+
V = np.array([[0,0,0],[1,0,0],[0,1,0],[0,0,1]],dtype=np.float64)
72+
F = np.array([[2,1,0],[1,3,0],[3,2,0],[2,3,1]],dtype=np.int64)
73+
T = np.array([[0,1,2,3]],dtype=np.int64)
74+
return V,F,T
7575

7676
#def test_edges():
7777
# F = np.array([[0,1,2],[0,2,3]],dtype=np.int64)
@@ -170,10 +170,10 @@ def test_version():
170170
# igl.writeMSH("out.msh",V,F,T)
171171
# V,F,T,_,_,_,_,_,_,_ = igl.readMSH("out.msh")
172172
#
173-
#def test_bvh():
174-
# V,F,T = single_tet()
175-
# tree = igl.AABB()
176-
# tree.init(V,T)
173+
def test_bvh():
174+
V,F,T = single_tet()
175+
tree = igl.AABB()
176+
tree.init(V,T)
177177

178178
# P = np.array([[0.5,0.5,0.0],[0.5,0.5,0.5]],dtype=np.float64)
179179
# # first row of P

0 commit comments

Comments
 (0)