From b83d32931c33ac1ec759b5262abe7e00c4fed1f4 Mon Sep 17 00:00:00 2001 From: nscipione Date: Wed, 24 Apr 2024 08:58:16 +0100 Subject: [PATCH] Reverting PORTBLAS_SRC setting in cmake --- CMakeLists.txt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a41d27fd..26c8e491d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,10 +100,9 @@ set(PORTBLAS_INCLUDE $ $) set(PORTBLAS_COMMON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common/include) if(INSTALL_HEADER_ONLY) - set(PORTBLAS_SRC $ $) -else() - set(PORTBLAS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src) + set(PORTBLAS_INSTALL_SRC $ $) endif() +set(PORTBLAS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src) set(PORTBLAS_SRC_GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/python_generator) list(APPEND THIRD_PARTIES_INCLUDE ${CBLAS_INCLUDE}) @@ -146,10 +145,15 @@ include(CmakeFunctionHelper) if (INSTALL_HEADER_ONLY) add_library(portblas INTERFACE) set_target_properties(portblas PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${PORTBLAS_INCLUDE};${PORTBLAS_SRC}" - ) - target_compile_definitions(portblas INTERFACE "SB_ENABLE_USM") - target_compile_definitions(portblas INTERFACE "BLAS_ENABLE_COMPLEX=${BLAS_ENABLE_COMPLEX}") + INTERFACE_INCLUDE_DIRECTORIES "${PORTBLAS_INCLUDE};${PORTBLAS_INSTALL_SRC}") + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag("-fsycl" is_dpcpp) + if(is_dpcpp) + target_compile_definitions(portblas INTERFACE "SB_ENABLE_USM") + endif() + if(${BLAS_ENABLE_COMPLEX}) + target_compile_definitions(portblas INTERFACE "BLAS_ENABLE_COMPLEX") + endif() target_compile_definitions(portblas INTERFACE ${TUNING_TARGET}) if((${CMAKE_CXX_COMPILER_ID} STREQUAL "IntelLLVM") AND NOT (${TUNING_TARGET} STREQUAL "INTEL_GPU") ) @@ -215,7 +219,7 @@ install(DIRECTORY ${PORTBLAS_INCLUDE} FILES_MATCHING PATTERN "*.h" ) if (INSTALL_HEADER_ONLY) - install(DIRECTORY ${PORTBLAS_SRC} + install(DIRECTORY ${PORTBLAS_INSTALL_SRC} DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT portblas FILES_MATCHING PATTERN "*.hpp"