Skip to content

Commit 658114d

Browse files
Make sure to not overwrite -fsycl option in select files
Removed -fsycl for default linking options on Windows. The option is added as needed.
1 parent cd7c23f commit 658114d

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

dpctl/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ elseif(UNIX)
5858
string(CONCAT CXXFLAGS
5959
"${WARNING_FLAGS}"
6060
"${SDL_FLAGS}"
61-
"-fsycl "
6261
)
6362
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 ${CFLAGS}")
6463
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 ${CXXFLAGS}")
@@ -190,14 +189,18 @@ function(build_dpctl_ext _trgt _src _dest)
190189
install(TARGETS ${_trgt} LIBRARY DESTINATION ${_dest})
191190
endfunction()
192191

193-
file(GLOB _cython_sources *.pyx)
192+
file(GLOB _cython_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.pyx)
193+
list(REMOVE_ITEM _cython_sources ${CMAKE_CURRENT_SOURCE_DIR}/_sycl_queue.pyx)
194194
foreach(_cy_file ${_cython_sources})
195195
get_filename_component(_trgt ${_cy_file} NAME_WLE)
196196
build_dpctl_ext(${_trgt} ${_cy_file} "dpctl")
197197
endforeach()
198198

199+
set(_cy_file ${CMAKE_CURRENT_SOURCE_DIR}/_sycl_queue.pyx)
200+
get_filename_component(_trgt ${_cy_file} NAME_WLE)
201+
build_dpctl_ext(${_trgt} ${_cy_file} "dpctl" SYCL)
202+
199203
target_include_directories(_sycl_queue PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
200-
add_sycl_to_target(TARGET _sycl_queue SOURCES _sycl_queue.cxx)
201204

202205
add_subdirectory(program)
203206
add_subdirectory(memory)

dpctl/tensor/CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,20 @@ set(_clang_prefix "")
5959
if (WIN32)
6060
set(_clang_prefix "/clang:")
6161
endif()
62-
set_source_files_properties(
62+
63+
set(_no_fast_math_sources
6364
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/full_ctor.cpp
6465
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/linear_sequences.cpp
6566
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions.cpp
66-
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/reduction_over_axis.cpp
67-
PROPERTIES COMPILE_OPTIONS "${_clang_prefix}-fno-fast-math")
67+
)
68+
foreach(_src_fn ${_no_fast_math_sources})
69+
get_source_file_property(_cmpl_options_prop ${_src_fn} COMPILE_OPTIONS)
70+
set(_combined_options_prop ${_cmpl_options_prop} "${_clang_prefix}-fno-fast-math")
71+
set_source_files_properties(
72+
${_src_fn}
73+
PROPERTIES COMPILE_OPTIONS "${_combined_options_prop}"
74+
)
75+
endforeach()
6876
if (UNIX)
6977
set_source_files_properties(
7078
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions.cpp

0 commit comments

Comments
 (0)