Skip to content
Open
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
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import re
import pathlib
import platform

from setuptools import setup
from setuptools import dist
Expand Down Expand Up @@ -32,11 +33,15 @@
# we don't want to require cython for package install from
# source distributions, like pypi installs, and the best way I
# can think of to detect this is by checking if PKG-INFO exists
cython_build = not base_dir.joinpath('PKG-INFO').is_file()
cython_build = not base_dir.joinpath('PKG-INFO').is_file() or (platform.system() == 'Windows')

# configure c extensions
ext = 'pyx' if cython_build else 'c'
ext_opts = dict(extra_compile_args=['-O3', '-std=c99'])
if platform.system() == 'Windows':
ext_opts = dict(extra_compile_args=['/O2', '/std:c++17'])
else:
ext_opts = dict(extra_compile_args=['-O3', '-std=c99'])

extensions = [
Extension('surfa.image.interp', [f'surfa/image/interp.{ext}'], **ext_opts),
Extension('surfa.mesh.intersection', [f'surfa/mesh/intersection.{ext}'], **ext_opts),
Expand Down
2 changes: 1 addition & 1 deletion surfa/image/interp.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def interpolate(source, target_shape, method, affine=None, disp=None, fill=0):
interp_func = globals().get(f'interp_3d_{order}_{method}')

# speeds up if conditionals are computed outside of function (TODO is this even true?)
shape = np.asarray(target_shape).astype('int64')
shape = np.asarray(target_shape).astype(np.int_)

# ensure correct byteorder
# TODO maybe this should be done at read-time?
Expand Down