Skip to content

Commit 83e497d

Browse files
Ensure that cythonize pass is done after backend building but before setup steps are run to collect headers generated by cythonization (#464)
1 parent b4d811a commit 83e497d

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

MANIFEST.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
include versioneer.py
2-
recursive-include dpctl/include *.h *.hpp
2+
recursive-include dpctl/include *.h
33
recursive-include dpctl *.pxd
44
include dpctl/_sycl_context.h
55
include dpctl/_sycl_device.h
@@ -9,4 +9,3 @@ include dpctl/_sycl_event.h
99
include dpctl/memory/_memory.h
1010
include dpctl/*DPCTL*Interface.*
1111
include dpctl/tests/input_files/*
12-
global-exclude *.cpp

setup.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import setuptools.command.build_ext as orig_build_ext
2323
import setuptools.command.develop as orig_develop
2424
import setuptools.command.install as orig_install
25+
from Cython.Build import cythonize
2526
from setuptools import Extension, find_packages, setup
2627

2728
import versioneer
@@ -124,17 +125,11 @@ def extensions():
124125

125126
if IS_LIN:
126127
libs += ["rt", "DPCTLSyclInterface"]
127-
elif IS_WIN:
128-
libs += ["DPCTLSyclInterface"]
129-
130-
if IS_LIN:
131-
libraries = [dpctl_sycl_interface_lib]
132-
elif IS_WIN:
133128
libraries = [dpctl_sycl_interface_lib]
134-
135-
if IS_LIN:
136129
runtime_library_dirs = ["$ORIGIN"]
137130
elif IS_WIN:
131+
libs += ["DPCTLSyclInterface"]
132+
libraries = [dpctl_sycl_interface_lib]
138133
runtime_library_dirs = []
139134

140135
extension_args = {
@@ -237,15 +232,13 @@ def extensions():
237232
define_macros=extension_args["define_macros"],
238233
),
239234
]
240-
# ext = cythonize(extensions, language_level=3)
241235
return extensions
242236

243237

244238
class build_ext(orig_build_ext.build_ext):
245239
description = "Build dpctl native extensions"
246240

247241
def finalize_options(self):
248-
global _coverage
249242
if _coverage:
250243
pre_d = getattr(self, "define", None)
251244
if pre_d is None:
@@ -308,6 +301,13 @@ def finalize_options(self):
308301

309302
def run(self):
310303
build_backend(self.level_zero_support, False, self.sycl_compiler_prefix)
304+
if _coverage:
305+
pre_d = getattr(self, "define", None)
306+
if pre_d is None:
307+
self.define = "CYTHON_TRACE"
308+
else:
309+
self.define = ",".join((pre_d, "CYTHON_TRACE"))
310+
cythonize(self.distribution.ext_modules)
311311
return super().run()
312312

313313

@@ -378,6 +378,13 @@ def run(self):
378378
build_backend(
379379
self.level_zero_support, self.coverage, self.sycl_compiler_prefix
380380
)
381+
if _coverage:
382+
pre_d = getattr(self, "define", None)
383+
if pre_d is None:
384+
self.define = "CYTHON_TRACE"
385+
else:
386+
self.define = ",".join((pre_d, "CYTHON_TRACE"))
387+
cythonize(self.distribution.ext_modules)
381388
return super().run()
382389

383390

0 commit comments

Comments
 (0)