Skip to content

Commit 17f500f

Browse files
install: arm64 compilation on MacOS
1 parent c73cca1 commit 17f500f

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

build-macos-arm.sh

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#!/bin/zsh
22

3+
source /usr/local/bin/virtualenvwrapper.sh
4+
5+
export ARCHFLAGS="-arch arm64"
6+
37
function build {
8+
pip install numpy cython -U
9+
rm src/DracoPy.cpp
10+
cython -3 src/DracoPy.pyx
411
python setup-macos-arm.py develop
512
python -m pytest -v -x tests.py
613
python setup-macos-arm.py bdist_wheel

setup-macos-arm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def read(fname):
3535
np.get_include(),
3636
],
3737
extra_compile_args=[
38-
'-std=c++11','-O3', '-stdlib=libc++'
38+
'-std=c++17','-O3', '-stdlib=libc++'
3939
],
4040
extra_link_args=[ "-ldraco" ],
4141
)

src/DracoPy.pxd

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ from libcpp.vector cimport vector
33
from libc.stdint cimport uint8_t, uint32_t
44
from libcpp cimport bool
55

6-
cimport numpy
6+
cimport numpy as cnp
77
import numpy as np
88

9+
cnp.import_array()
10+
911
cdef extern from "DracoPy.h" namespace "DracoFunctions":
1012

1113
cdef enum decoding_status:

src/DracoPy.pyx

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ from libc.stdint cimport (
1111
uint8_t, uint16_t, uint32_t, uint64_t,
1212
)
1313

14-
cimport numpy as np
15-
import numpy as np
16-
np.import_array()
14+
cimport numpy as cnp
15+
cnp.import_array()
1716

17+
import numpy as np
1818

1919
class DracoPointCloud:
2020
def __init__(self, data_struct):
@@ -170,7 +170,7 @@ def encode(
170170
elif np.issubdtype(points.dtype, np.unsignedinteger):
171171
integer_mark = 2
172172

173-
cdef np.ndarray[float, ndim=1] qorigin = np.zeros((3,), dtype=np.float32)
173+
cdef cnp.ndarray[float, ndim=1] qorigin = np.zeros((3,), dtype=np.float32)
174174
cdef float[:] quant_origin = qorigin
175175

176176
if quantization_origin is not None:

0 commit comments

Comments
 (0)