Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
72 lines (65 loc) · 2.55 KB
/
Copy pathCMakeLists.txt
File metadata and controls
72 lines (65 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
file(GLOB _cython_sources *.pyx)
foreach(_cy_file ${_cython_sources})
get_filename_component(_trgt ${_cy_file} NAME_WLE)
build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/utils" RELATIVE_PATH "..")
endforeach()
set(_pybind11_targets)
set(python_module_name _device_queries)
set(_module_src ${CMAKE_CURRENT_SOURCE_DIR}/src/device_queries.cpp)
pybind11_add_module(${python_module_name} MODULE
${_module_src}
)
add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_module_src})
list(APPEND _pybind11_targets ${python_module_name})
set(python_module_name _seq_order_keeper)
set(_module_src ${CMAKE_CURRENT_SOURCE_DIR}/src/order_keeper.cpp)
pybind11_add_module(${python_module_name} MODULE
${_module_src}
)
target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_module_src})
list(APPEND _pybind11_targets ${python_module_name})
set(_linker_options "LINKER:${DPCTL_LDFLAGS}")
foreach(python_module_name ${_pybind11_targets})
if(DPCTL_SYCL_PROVIDER STREQUAL "Intel")
target_link_options(${python_module_name} PRIVATE -fsycl-device-code-split=per_kernel)
if (DPCTL_OFFLOAD_COMPRESS)
target_link_options(${python_module_name} PRIVATE --offload-compress)
endif()
endif()
target_link_options(${python_module_name} PRIVATE ${_linker_options})
if(DPCTL_GENERATE_COVERAGE)
if(DPCTL_GENERATE_COVERAGE_FOR_PYBIND11_EXTENSIONS)
target_compile_options(${python_module_name}
PRIVATE -fprofile-instr-generate -fcoverage-mapping
)
endif()
target_link_options(${python_module_name}
PRIVATE -fprofile-instr-generate -fcoverage-mapping
)
endif()
if(_dpctl_sycl_targets)
# make fat binary
target_compile_options(
${python_module_name}
PRIVATE
${_dpctl_sycl_target_compile_options}
)
target_link_options(
${python_module_name}
PRIVATE
${_dpctl_sycl_target_link_options}
)
endif()
# TODO: update source so they reference individual libraries instead of
# dpctl4pybind11.hpp. It will allow to simplify dependency tree
target_link_libraries(${python_module_name} PRIVATE DpctlCAPI)
if (DPCTL_WITH_REDIST)
set_target_properties(
${python_module_name}
PROPERTIES
INSTALL_RPATH "$ORIGIN/../../../.."
)
endif()
install(TARGETS ${python_module_name} DESTINATION "dpctl/utils")
endforeach()