File tree Expand file tree Collapse file tree 1 file changed +28
-3
lines changed Expand file tree Collapse file tree 1 file changed +28
-3
lines changed Original file line number Diff line number Diff line change 14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
16
17
- import Cython .Build
17
+ import shutil
18
+
18
19
import setuptools
20
+ from Cython .Build import build_ext
19
21
20
22
import dpctl
21
23
24
+
25
+ class custom_build_ext (build_ext ):
26
+ def build_extensions (self ):
27
+ cmplr_name = shutil .which ("icpx" )
28
+ if cmplr_name is None :
29
+ cmplr_name = shutil .which ("clang++" )
30
+ if cmplr_name is None :
31
+ raise RuntimeError ("DPC++ compiler is required" )
32
+ self .compiler .set_executable (
33
+ "compiler_so" , cmplr_name + " -fsycl -fPIC"
34
+ )
35
+ self .compiler .set_executable (
36
+ "compiler_cxx" , cmplr_name + " -fsycl -fPIC"
37
+ )
38
+ self .compiler .set_executable (
39
+ "linker_so" ,
40
+ cmplr_name
41
+ + " -fsycl -shared -fpic "
42
+ + "-fsycl-device-code-split=per_kernel" ,
43
+ )
44
+ build_ext .build_extensions (self )
45
+
46
+
22
47
ext = setuptools .Extension (
23
48
"_cython_api" ,
24
49
["_cython_api.pyx" ],
27
52
)
28
53
29
54
setuptools .setup (
30
- name = "_cython_api " ,
55
+ name = "test_cython_api " ,
31
56
version = "0.0.0" ,
32
57
ext_modules = [ext ],
33
- cmdclass = {"build_ext" : Cython . Build . build_ext },
58
+ cmdclass = {"build_ext" : custom_build_ext },
34
59
)
You can’t perform that action at this time.
0 commit comments