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 1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616
17- import Cython .Build
17+ import shutil
18+
1819import setuptools
20+ from Cython .Build import build_ext
1921
2022import dpctl
2123
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+
2247ext = setuptools .Extension (
2348 "_cython_api" ,
2449 ["_cython_api.pyx" ],
2752)
2853
2954setuptools .setup (
30- name = "_cython_api " ,
55+ name = "test_cython_api " ,
3156 version = "0.0.0" ,
3257 ext_modules = [ext ],
33- cmdclass = {"build_ext" : Cython . Build . build_ext },
58+ cmdclass = {"build_ext" : custom_build_ext },
3459)
You can’t perform that action at this time.
0 commit comments