|
2 | 2 | file(GLOB _cython_sources *.pyx)
|
3 | 3 | foreach(_cy_file ${_cython_sources})
|
4 | 4 | get_filename_component(_trgt ${_cy_file} NAME_WLE)
|
5 |
| - build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/utils") |
| 5 | + build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/utils" RELATIVE_PATH "..") |
6 | 6 | endforeach()
|
7 | 7 |
|
| 8 | +set(_pybind11_targets) |
| 9 | + |
8 | 10 | set(python_module_name _device_queries)
|
9 | 11 | set(_module_src ${CMAKE_CURRENT_SOURCE_DIR}/src/device_queries.cpp)
|
10 | 12 | pybind11_add_module(${python_module_name} MODULE
|
11 | 13 | ${_module_src}
|
12 | 14 | )
|
13 | 15 | add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_module_src})
|
14 |
| -if(DPCTL_GENERATE_COVERAGE) |
15 |
| - if(DPCTL_GENERATE_COVERAGE_FOR_PYBIND11_EXTENSIONS) |
16 |
| - target_compile_options(${python_module_name} |
17 |
| - PRIVATE -fprofile-instr-generate -fcoverage-mapping |
18 |
| - ) |
19 |
| - endif() |
20 |
| - target_link_options(${python_module_name} |
21 |
| - PRIVATE -fprofile-instr-generate -fcoverage-mapping |
22 |
| - ) |
23 |
| -endif() |
24 |
| -if(_dpctl_sycl_targets) |
25 |
| - # make fat binary |
26 |
| - target_compile_options( |
27 |
| - ${python_module_name} |
28 |
| - PRIVATE |
29 |
| - -fsycl-targets=${_dpctl_sycl_targets} |
30 |
| - ) |
31 |
| - target_link_options( |
32 |
| - ${python_module_name} |
33 |
| - PRIVATE |
34 |
| - -fsycl-targets=${_dpctl_sycl_targets} |
35 |
| - ) |
36 |
| -endif() |
37 |
| -target_link_libraries(${python_module_name} PRIVATE DpctlCAPI) |
38 |
| -install(TARGETS ${python_module_name} DESTINATION "dpctl/utils") |
| 16 | +list(APPEND _pybind11_targets ${python_module_name}) |
39 | 17 |
|
40 | 18 |
|
41 | 19 | set(python_module_name _seq_order_keeper)
|
42 | 20 | set(_module_src ${CMAKE_CURRENT_SOURCE_DIR}/src/order_keeper.cpp)
|
43 | 21 | pybind11_add_module(${python_module_name} MODULE
|
44 | 22 | ${_module_src}
|
45 | 23 | )
|
46 |
| -target_include_directories(${python_module_name} PRIVATE ${CUMAKE_CURRENT_SOURCE_DIR}/src) |
| 24 | +target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) |
47 | 25 | add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_module_src})
|
48 |
| -if(DPCTL_GENERATE_COVERAGE) |
49 |
| - if(DPCTL_GENERATE_COVERAGE_FOR_PYBIND11_EXTENSIONS) |
50 |
| - target_compile_options(${python_module_name} |
51 |
| - PRIVATE -fprofile-instr-generate -fcoverage-mapping |
52 |
| - ) |
53 |
| - endif() |
54 |
| - target_link_options(${python_module_name} |
55 |
| - PRIVATE -fprofile-instr-generate -fcoverage-mapping |
56 |
| - ) |
57 |
| -endif() |
58 |
| -if(_dpctl_sycl_targets) |
59 |
| - # make fat binary |
60 |
| - target_compile_options( |
61 |
| - ${python_module_name} |
62 |
| - PRIVATE |
63 |
| - -fsycl-targets=${_dpctl_sycl_targets} |
64 |
| - ) |
65 |
| - target_link_options( |
66 |
| - ${python_module_name} |
| 26 | +list(APPEND _pybind11_targets ${python_module_name}) |
| 27 | + |
| 28 | +set(_linker_options "LINKER:${DPCTL_LDFLAGS}") |
| 29 | +foreach(python_module_name ${_pybind11_targets}) |
| 30 | + target_compile_options(${python_module_name} PRIVATE -fno-sycl-id-queries-fit-in-int) |
| 31 | + target_link_options(${python_module_name} PRIVATE -fsycl-device-code-split=per_kernel) |
| 32 | + target_include_directories(${python_module_name} |
67 | 33 | PRIVATE
|
68 |
| - -fsycl-targets=${_dpctl_sycl_targets} |
| 34 | + ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/include |
| 35 | + ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/ |
69 | 36 | )
|
70 |
| -endif() |
71 |
| -target_link_libraries(${python_module_name} PRIVATE DpctlCAPI) |
72 |
| -install(TARGETS ${python_module_name} DESTINATION "dpctl/utils") |
| 37 | + target_link_options(${python_module_name} PRIVATE ${_linker_options}) |
| 38 | + if(DPCTL_GENERATE_COVERAGE) |
| 39 | + if(DPCTL_GENERATE_COVERAGE_FOR_PYBIND11_EXTENSIONS) |
| 40 | + target_compile_options(${python_module_name} |
| 41 | + PRIVATE -fprofile-instr-generate -fcoverage-mapping |
| 42 | + ) |
| 43 | + endif() |
| 44 | + target_link_options(${python_module_name} |
| 45 | + PRIVATE -fprofile-instr-generate -fcoverage-mapping |
| 46 | + ) |
| 47 | + endif() |
| 48 | + if(_dpctl_sycl_targets) |
| 49 | + # make fat binary |
| 50 | + target_compile_options( |
| 51 | + ${python_module_name} |
| 52 | + PRIVATE |
| 53 | + -fsycl-targets=${_dpctl_sycl_targets} |
| 54 | + ) |
| 55 | + target_link_options( |
| 56 | + ${python_module_name} |
| 57 | + PRIVATE |
| 58 | + -fsycl-targets=${_dpctl_sycl_targets} |
| 59 | + ) |
| 60 | + endif() |
| 61 | + # TODO: update source so they refernece individual libraries instead of |
| 62 | + # dpctl4pybind11.hpp. It will allow to simplify dependency tree |
| 63 | + target_link_libraries(${python_module_name} PRIVATE DpctlCAPI) |
| 64 | + if (DPCTL_WITH_REDIST) |
| 65 | + set_target_properties( |
| 66 | + ${python_module_name} |
| 67 | + PROPERTIES |
| 68 | + INSTALL_RPATH "$ORIGIN/../../../.." |
| 69 | + ) |
| 70 | + endif() |
| 71 | + install(TARGETS ${python_module_name} DESTINATION "dpctl/utils") |
| 72 | +endforeach() |
0 commit comments