|
22 | 22 | import setuptools.command.build_ext as orig_build_ext
|
23 | 23 | import setuptools.command.develop as orig_develop
|
24 | 24 | import setuptools.command.install as orig_install
|
| 25 | +from Cython.Build import cythonize |
25 | 26 | from setuptools import Extension, find_packages, setup
|
26 | 27 |
|
27 | 28 | import versioneer
|
@@ -124,17 +125,11 @@ def extensions():
|
124 | 125 |
|
125 | 126 | if IS_LIN:
|
126 | 127 | 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: |
133 | 128 | libraries = [dpctl_sycl_interface_lib]
|
134 |
| - |
135 |
| - if IS_LIN: |
136 | 129 | runtime_library_dirs = ["$ORIGIN"]
|
137 | 130 | elif IS_WIN:
|
| 131 | + libs += ["DPCTLSyclInterface"] |
| 132 | + libraries = [dpctl_sycl_interface_lib] |
138 | 133 | runtime_library_dirs = []
|
139 | 134 |
|
140 | 135 | extension_args = {
|
@@ -237,15 +232,13 @@ def extensions():
|
237 | 232 | define_macros=extension_args["define_macros"],
|
238 | 233 | ),
|
239 | 234 | ]
|
240 |
| - # ext = cythonize(extensions, language_level=3) |
241 | 235 | return extensions
|
242 | 236 |
|
243 | 237 |
|
244 | 238 | class build_ext(orig_build_ext.build_ext):
|
245 | 239 | description = "Build dpctl native extensions"
|
246 | 240 |
|
247 | 241 | def finalize_options(self):
|
248 |
| - global _coverage |
249 | 242 | if _coverage:
|
250 | 243 | pre_d = getattr(self, "define", None)
|
251 | 244 | if pre_d is None:
|
@@ -308,6 +301,13 @@ def finalize_options(self):
|
308 | 301 |
|
309 | 302 | def run(self):
|
310 | 303 | 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) |
311 | 311 | return super().run()
|
312 | 312 |
|
313 | 313 |
|
@@ -378,6 +378,13 @@ def run(self):
|
378 | 378 | build_backend(
|
379 | 379 | self.level_zero_support, self.coverage, self.sycl_compiler_prefix
|
380 | 380 | )
|
| 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) |
381 | 388 | return super().run()
|
382 | 389 |
|
383 | 390 |
|
|
0 commit comments