From 9ae43f0036d3bef1060383a467720988576fa5d6 Mon Sep 17 00:00:00 2001 From: nscipione Date: Wed, 25 Sep 2024 10:11:39 +0100 Subject: [PATCH] Address PR feedback --- CMakeLists.txt | 2 - deps/googletest/cmake/internal_utils.cmake | 6 +-- src/CMakeLists.txt | 52 +++++++++++----------- 3 files changed, 29 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15fddba59..b2763cd8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,6 @@ option(BUILD_SHARED_LIBS "Build dynamic libraries" ON) ## Backends option(ENABLE_MKLCPU_BACKEND "Enable the Intel oneMKL CPU backend for supported interfaces" ON) option(ENABLE_MKLGPU_BACKEND "Enable the Intel oneMKL GPU backend for supported interfaces" ON) - if(ENABLE_MKLCPU_BACKEND) option(ENABLE_MKLCPU_THREAD_TBB "Enable the use of Intel TBB with the oneMKL CPU backend" ON) endif() @@ -61,7 +60,6 @@ option(ENABLE_CUFFT_BACKEND "Enable the cuFFT backend for the DFT interface" OFF option(ENABLE_ROCFFT_BACKEND "Enable the rocFFT backend for the DFT interface" OFF) option(ENABLE_PORTFFT_BACKEND "Enable the portFFT DFT backend for the DFT interface. Cannot be used with other DFT backends." OFF) - set(ONEMKL_SYCL_IMPLEMENTATION "dpc++" CACHE STRING "Name of the SYCL compiler") set(HIP_TARGETS "" CACHE STRING "Target HIP architectures") diff --git a/deps/googletest/cmake/internal_utils.cmake b/deps/googletest/cmake/internal_utils.cmake index 845b6cae4..b7b4fdc88 100644 --- a/deps/googletest/cmake/internal_utils.cmake +++ b/deps/googletest/cmake/internal_utils.cmake @@ -26,7 +26,7 @@ macro(fix_default_compiler_settings_) CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if (NOT ONEAPI_ONEMKL_BUILD_SHARED_LIBS AND NOT gtest_force_shared_crt) + if (NOT BUILD_SHARED_LIBS AND NOT gtest_force_shared_crt) # When Google Test is built as a shared library, it should also use # shared runtime libraries. Otherwise, it may end up with multiple # copies of runtime library data in different modules, resulting in @@ -173,7 +173,7 @@ function(cxx_library_with_type name type cxx_flags) COMPILE_PDB_NAME "${name}" COMPILE_PDB_NAME_DEBUG "${name}${pdb_debug_postfix}") - if (ONEAPI_ONEMKL_BUILD_SHARED_LIBS OR type STREQUAL "SHARED") + if (BUILD_SHARED_LIBS OR type STREQUAL "SHARED") set_target_properties(${name} PROPERTIES COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1") @@ -219,7 +219,7 @@ function(cxx_executable_with_flags name cxx_flags libs) PROPERTIES COMPILE_FLAGS "${cxx_flags}") endif() - if (ONEAPI_ONEMKL_BUILD_SHARED_LIBS) + if (BUILD_SHARED_LIBS) set_target_properties(${name} PROPERTIES COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 90ecb3d11..d9ad819f4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -42,33 +42,33 @@ endforeach() # Generate header with enabled backends for testing function(generate_header_file) -# Following if-conditions allow to decouple cmake configuration variables with -# the corresponding generated macro. This is done to be conformant with ES.33 -# C++ Core Guidelines -set(ONEAPI_ONEMKL_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) -set(ONEAPI_ONEMKL_ENABLE_MKLCPU_BACKEND ${ENABLE_MKLCPU_BACKEND}) -set(ONEAPI_ONEMKL_ENABLE_MKLGPU_BACKEND ${ENABLE_MKLGPU_BACKEND}) -set(ONEAPI_ONEMKL_ENABLE_CUBLAS_BACKEND ${ENABLE_CUBLAS_BACKEND}) -set(ONEAPI_ONEMKL_ENABLE_ROCBLAS_BACKEND ${ENABLE_ROCBLAS_BACKEND}) -set(ONEAPI_ONEMKL_ENABLE_NETLIB_BACKEND ${ENABLE_NETLIB_BACKEND}) -set(ONEAPI_ONEMKL_ENABLE_PORTBLAS_BACKEND ${ENABLE_PORTBLAS_BACKEND}) -set(ONEAPI_ONEMKL_ENABLE_CURAND_BACKEND ${ENABLE_CURAND_BACKEND}) -set(ONEAPI_ONEMKL_ENABLE_ROCRAND_BACKEND ${ENABLE_ROCRAND_BACKEND}) -set(ONEAPI_ONEMKL_ENABLE_CUSOLVER_BACKEND ${ENABLE_CUSOLVER_BACKEND}) -set(ONEAPI_ONEMKL_ENABLE_ROCSOLVER_BACKEND ${ENABLE_ROCSOLVER_BACKEND}) -set(ONEAPI_ONEMKL_ENABLE_CUFFT_BACKEND ${ENABLE_CUFFT_BACKEND}) -set(ONEAPI_ONEMKL_ENABLE_ROCFFT_BACKEND ${ENABLE_ROCFFT_BACKEND}) -set(ONEAPI_ONEMKL_ENABLE_PORTFFT_BACKEND ${ENABLE_PORTFFT_BACKEND}) + # Following if-conditions allow to decouple cmake configuration variables with + # the corresponding generated macro. This is done to be conformant with ES.33 + # C++ Core Guidelines + set(ONEAPI_ONEMKL_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) + set(ONEAPI_ONEMKL_ENABLE_MKLCPU_BACKEND ${ENABLE_MKLCPU_BACKEND}) + set(ONEAPI_ONEMKL_ENABLE_MKLGPU_BACKEND ${ENABLE_MKLGPU_BACKEND}) + set(ONEAPI_ONEMKL_ENABLE_CUBLAS_BACKEND ${ENABLE_CUBLAS_BACKEND}) + set(ONEAPI_ONEMKL_ENABLE_ROCBLAS_BACKEND ${ENABLE_ROCBLAS_BACKEND}) + set(ONEAPI_ONEMKL_ENABLE_NETLIB_BACKEND ${ENABLE_NETLIB_BACKEND}) + set(ONEAPI_ONEMKL_ENABLE_PORTBLAS_BACKEND ${ENABLE_PORTBLAS_BACKEND}) + set(ONEAPI_ONEMKL_ENABLE_CURAND_BACKEND ${ENABLE_CURAND_BACKEND}) + set(ONEAPI_ONEMKL_ENABLE_ROCRAND_BACKEND ${ENABLE_ROCRAND_BACKEND}) + set(ONEAPI_ONEMKL_ENABLE_CUSOLVER_BACKEND ${ENABLE_CUSOLVER_BACKEND}) + set(ONEAPI_ONEMKL_ENABLE_ROCSOLVER_BACKEND ${ENABLE_ROCSOLVER_BACKEND}) + set(ONEAPI_ONEMKL_ENABLE_CUFFT_BACKEND ${ENABLE_CUFFT_BACKEND}) + set(ONEAPI_ONEMKL_ENABLE_ROCFFT_BACKEND ${ENABLE_ROCFFT_BACKEND}) + set(ONEAPI_ONEMKL_ENABLE_PORTFFT_BACKEND ${ENABLE_PORTFFT_BACKEND}) -configure_file(config.hpp.in "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/config.hpp.configured") -file(GENERATE - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/detail/config.hpp" - INPUT "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/config.hpp.configured" -) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/detail/config.hpp" - DESTINATION include/oneapi/mkl/detail - COMPONENT Devel -) + configure_file(config.hpp.in "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/config.hpp.configured") + file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/detail/config.hpp" + INPUT "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/config.hpp.configured" + ) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/detail/config.hpp" + DESTINATION include/oneapi/mkl/detail + COMPONENT Devel + ) endfunction() generate_header_file()