mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Update cmake configuration from master
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
if (NOT TARGET eigen)
|
||||
if (NOT TARGET Eigen3::Eigen)
|
||||
include ("${CMAKE_CURRENT_LIST_DIR}/Eigen3Targets.cmake")
|
||||
endif ()
|
||||
endif (NOT TARGET Eigen3::Eigen)
|
||||
|
||||
# Legacy variables, do *not* use. May be removed in the future.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ ei_set_sitename()
|
||||
ei_set_build_string()
|
||||
|
||||
add_custom_target(buildtests)
|
||||
add_custom_target(check COMMAND "ctest")
|
||||
add_custom_target(check COMMAND "ctest" ${EIGEN_CTEST_ARGS})
|
||||
add_dependencies(check buildtests)
|
||||
|
||||
# Convenience target for only building GPU tests.
|
||||
|
||||
@@ -61,6 +61,9 @@ set(ei_smoke_test_list
|
||||
mapped_matrix_1
|
||||
mapstaticmethods_1
|
||||
mapstride_1
|
||||
unaryviewstride_1
|
||||
unaryviewstride_2
|
||||
unaryviewstride_3
|
||||
matrix_square_root_1
|
||||
meta
|
||||
minres_2
|
||||
@@ -100,6 +103,7 @@ set(ei_smoke_test_list
|
||||
sizeof
|
||||
sizeoverflow
|
||||
smallvectors
|
||||
sparse_basic_1
|
||||
sparse_basic_3
|
||||
sparse_block_1
|
||||
sparse_extra_4
|
||||
@@ -128,4 +132,5 @@ set(ei_smoke_test_list
|
||||
unalignedassert
|
||||
unalignedcount
|
||||
vectorwiseop_1
|
||||
visitor_1)
|
||||
visitor_1
|
||||
vectorization_logic_1)
|
||||
|
||||
@@ -28,66 +28,59 @@ macro(ei_add_test_internal testname testname_with_suffix)
|
||||
set(is_gpu_test ON)
|
||||
if(EIGEN_TEST_HIP)
|
||||
hip_reset_flags()
|
||||
hip_add_executable(${targetname} ${filename} HIPCC_OPTIONS "-DEIGEN_USE_HIP ${ARGV2}")
|
||||
hip_add_executable(${targetname} ${filename} HIPCC_OPTIONS -std=c++14)
|
||||
target_compile_definitions(${targetname} PRIVATE -DEIGEN_USE_HIP)
|
||||
set_property(TARGET ${targetname} PROPERTY HIP_ARCHITECTURES gfx900 gfx906 gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030)
|
||||
elseif(EIGEN_TEST_CUDA_CLANG)
|
||||
set_source_files_properties(${filename} PROPERTIES LANGUAGE CXX)
|
||||
|
||||
|
||||
if(CUDA_64_BIT_DEVICE_CODE AND (EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64"))
|
||||
link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
|
||||
else()
|
||||
link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib")
|
||||
endif()
|
||||
|
||||
if (${ARGC} GREATER 2)
|
||||
add_executable(${targetname} ${filename})
|
||||
else()
|
||||
add_executable(${targetname} ${filename} OPTIONS ${ARGV2})
|
||||
endif()
|
||||
add_executable(${targetname} ${filename})
|
||||
set(CUDA_CLANG_LINK_LIBRARIES "cudart_static" "cuda" "dl" "pthread")
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(CUDA_CLANG_LINK_LIBRARIES ${CUDA_CLANG_LINK_LIBRARIES} "rt")
|
||||
endif()
|
||||
target_link_libraries(${targetname} ${CUDA_CLANG_LINK_LIBRARIES})
|
||||
else()
|
||||
if (${ARGC} GREATER 2)
|
||||
cuda_add_executable(${targetname} ${filename} OPTIONS ${ARGV2})
|
||||
else()
|
||||
cuda_add_executable(${targetname} ${filename})
|
||||
endif()
|
||||
cuda_add_executable(${targetname} ${filename})
|
||||
endif()
|
||||
else()
|
||||
add_executable(${targetname} ${filename})
|
||||
endif()
|
||||
|
||||
add_dependencies(buildtests ${targetname})
|
||||
|
||||
|
||||
if (is_gpu_test)
|
||||
add_dependencies(buildtests_gpu ${targetname})
|
||||
endif()
|
||||
|
||||
if(EIGEN_NO_ASSERTION_CHECKING)
|
||||
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_NO_ASSERTION_CHECKING=1")
|
||||
target_compile_definitions(${targetname} PRIVATE EIGEN_NO_ASSERTION_CHECKING=1)
|
||||
else()
|
||||
if(EIGEN_DEBUG_ASSERTS)
|
||||
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_DEBUG_ASSERTS=1")
|
||||
target_compile_definitions(${targetname} PRIVATE EIGEN_DEBUG_ASSERTS=1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_MAX_SIZE=${EIGEN_TEST_MAX_SIZE}")
|
||||
target_compile_definitions(${targetname} PRIVATE EIGEN_TEST_MAX_SIZE=${EIGEN_TEST_MAX_SIZE})
|
||||
|
||||
if(MSVC)
|
||||
ei_add_target_property(${targetname} COMPILE_FLAGS "/bigobj")
|
||||
target_compile_options(${targetname} PRIVATE "/bigobj")
|
||||
endif()
|
||||
|
||||
# let the user pass flags.
|
||||
if(${ARGC} GREATER 2)
|
||||
set(compile_options "${ARGV2}")
|
||||
separate_arguments(compile_options)
|
||||
ei_add_target_property(${targetname} COMPILE_FLAGS ${compile_options})
|
||||
separate_arguments(compile_options NATIVE_COMMAND ${ARGV2})
|
||||
target_compile_options(${targetname} PRIVATE ${compile_options})
|
||||
endif()
|
||||
|
||||
if(EIGEN_TEST_CUSTOM_CXX_FLAGS)
|
||||
ei_add_target_property(${targetname} COMPILE_FLAGS ${EIGEN_TEST_CUSTOM_CXX_FLAGS})
|
||||
target_compile_options(${targetname} PRIVATE ${EIGEN_TEST_CUSTOM_CXX_FLAGS})
|
||||
endif()
|
||||
|
||||
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
||||
@@ -99,6 +92,7 @@ macro(ei_add_test_internal testname testname_with_suffix)
|
||||
if(EIGEN_TEST_CUSTOM_LINKER_FLAGS)
|
||||
target_link_libraries(${targetname} ${EIGEN_TEST_CUSTOM_LINKER_FLAGS})
|
||||
endif()
|
||||
target_link_libraries(${targetname} Eigen3::Eigen)
|
||||
|
||||
if(${ARGC} GREATER 3)
|
||||
set(libs_to_link ${ARGV3})
|
||||
@@ -113,7 +107,7 @@ macro(ei_add_test_internal testname testname_with_suffix)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_test(${testname_with_suffix} "${targetname}")
|
||||
add_test(NAME ${testname_with_suffix} COMMAND "${targetname}")
|
||||
|
||||
# Specify target and test labels according to EIGEN_CURRENT_SUBPROJECT
|
||||
get_property(current_subproject GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT)
|
||||
@@ -126,22 +120,10 @@ macro(ei_add_test_internal testname testname_with_suffix)
|
||||
# Add gpu tag for testing only GPU tests.
|
||||
set_property(TEST ${testname_with_suffix} APPEND PROPERTY LABELS "gpu")
|
||||
endif()
|
||||
|
||||
|
||||
if(EIGEN_SYCL)
|
||||
# Force include of the SYCL file at the end to avoid errors.
|
||||
set_property(TARGET ${targetname} PROPERTY COMPUTECPP_INCLUDE_AFTER 1)
|
||||
# Set COMPILE_FLAGS to COMPILE_DEFINITIONS instead to avoid having to duplicate the flags
|
||||
# to the device compiler.
|
||||
get_target_property(target_compile_flags ${targetname} COMPILE_FLAGS)
|
||||
separate_arguments(target_compile_flags)
|
||||
foreach(flag ${target_compile_flags})
|
||||
if(${flag} MATCHES "^-D.*")
|
||||
string(REPLACE "-D" "" definition_flag ${flag})
|
||||
set_property(TARGET ${targetname} APPEND PROPERTY COMPILE_DEFINITIONS ${definition_flag})
|
||||
list(REMOVE_ITEM target_compile_flags ${flag})
|
||||
endif()
|
||||
endforeach()
|
||||
set_property(TARGET ${targetname} PROPERTY COMPILE_FLAGS ${target_compile_flags})
|
||||
set_property(TARGET ${gittargetname} PROPERTY COMPUTECPP_INCLUDE_AFTER 1)
|
||||
# Link against pthread and add sycl to target
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
@@ -218,12 +200,13 @@ macro(ei_add_test testname)
|
||||
if( (EIGEN_SPLIT_LARGE_TESTS AND suffixes) OR explicit_suffixes)
|
||||
add_custom_target(${testname})
|
||||
foreach(suffix ${suffixes})
|
||||
ei_add_test_internal(${testname} ${testname}_${suffix}
|
||||
"${ARGV1} -DEIGEN_TEST_PART_${suffix}=1" "${ARGV2}")
|
||||
ei_add_test_internal(${testname} ${testname}_${suffix} "${ARGV1}" "${ARGV2}")
|
||||
add_dependencies(${testname} ${testname}_${suffix})
|
||||
target_compile_definitions(${testname}_${suffix} PRIVATE -DEIGEN_TEST_PART_${suffix}=1)
|
||||
endforeach()
|
||||
else()
|
||||
ei_add_test_internal(${testname} ${testname} "${ARGV1} -DEIGEN_TEST_PART_ALL=1" "${ARGV2}")
|
||||
ei_add_test_internal(${testname} ${testname} "${ARGV1}" "${ARGV2}")
|
||||
target_compile_definitions(${testname} PRIVATE -DEIGEN_TEST_PART_ALL=1)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -249,11 +232,16 @@ macro(ei_add_failtest testname)
|
||||
|
||||
# Add the tests to ctest.
|
||||
add_test(NAME ${test_target_ok}
|
||||
COMMAND ${CMAKE_COMMAND} --build . --target ${test_target_ok} --config $<CONFIGURATION>
|
||||
COMMAND ${CMAKE_COMMAND} --build . --target ${test_target_ok} --config $<CONFIG>
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
add_test(NAME ${test_target_ko}
|
||||
COMMAND ${CMAKE_COMMAND} --build . --target ${test_target_ko} --config $<CONFIGURATION>
|
||||
COMMAND ${CMAKE_COMMAND} --build . --target ${test_target_ko} --config $<CONFIG>
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
# Disable emulator if cross-compiling.
|
||||
if (CMAKE_CROSSCOMPILING)
|
||||
set_property(TEST ${test_target_ok} PROPERTY CROSSCOMPILING_EMULATOR "")
|
||||
set_property(TEST ${test_target_ko} PROPERTY CROSSCOMPILING_EMULATOR "")
|
||||
endif()
|
||||
|
||||
# Expect the second test to fail
|
||||
set_tests_properties(${test_target_ko} PROPERTIES WILL_FAIL TRUE)
|
||||
@@ -393,8 +381,10 @@ macro(ei_testing_print_summary)
|
||||
if(EIGEN_TEST_SYCL)
|
||||
if(EIGEN_SYCL_TRISYCL)
|
||||
message(STATUS "SYCL: ON (using triSYCL)")
|
||||
else()
|
||||
elseif(EIGEN_SYCL_ComputeCpp)
|
||||
message(STATUS "SYCL: ON (using computeCPP)")
|
||||
elseif(EIGEN_SYCL_DPCPP)
|
||||
message(STATUS "SYCL: ON (using DPCPP)")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "SYCL: OFF")
|
||||
@@ -464,15 +454,7 @@ endmacro()
|
||||
|
||||
macro(ei_get_compilerver VAR)
|
||||
if(MSVC)
|
||||
# on windows system, we use a modified CMake script
|
||||
include(EigenDetermineVSServicePack)
|
||||
EigenDetermineVSServicePack( my_service_pack )
|
||||
|
||||
if( my_service_pack )
|
||||
set(${VAR} ${my_service_pack})
|
||||
else()
|
||||
set(${VAR} "na")
|
||||
endif()
|
||||
set(${VAR} "${CMAKE_CXX_COMPILER_VERSION}")
|
||||
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "PGI")
|
||||
set(${VAR} "${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}")
|
||||
else()
|
||||
@@ -541,12 +523,12 @@ macro(ei_get_compilerver_from_cxx_version_string VERSTRING CNAME CVER)
|
||||
string(REGEX MATCH "[^0-9][0-9]+\\.[0-9]+" eicver ${VERSTRING})
|
||||
if (NOT eicver AND ei_has_mingw)
|
||||
# try to extract 1 number plus suffix:
|
||||
string(REGEX MATCH "[^0-9][0-9]+-win32" eicver ${VERSTRING})
|
||||
string(REGEX MATCH "[^0-9][0-9]+-win32" eicver ${VERSTRING})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if (NOT eicver)
|
||||
set(eicver " _")
|
||||
endif()
|
||||
@@ -607,10 +589,7 @@ macro(ei_set_build_string)
|
||||
ei_get_compilerver(LOCAL_COMPILER_VERSION)
|
||||
ei_get_cxxflags(LOCAL_COMPILER_FLAGS)
|
||||
|
||||
include(EigenDetermineOSVersion)
|
||||
DetermineOSVersion(OS_VERSION)
|
||||
|
||||
set(TMP_BUILD_STRING ${OS_VERSION}-${LOCAL_COMPILER_VERSION})
|
||||
set(TMP_BUILD_STRING ${CMAKE_SYSTEM}-${LOCAL_COMPILER_VERSION})
|
||||
|
||||
if (NOT ${LOCAL_COMPILER_FLAGS} STREQUAL "")
|
||||
set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-${LOCAL_COMPILER_FLAGS})
|
||||
@@ -680,10 +659,10 @@ endmacro()
|
||||
# Split all tests listed in EIGEN_TESTS_LIST into num_splits many targets
|
||||
# named buildtestspartN with N = { 0, ..., num_splits-1}.
|
||||
#
|
||||
# The intention behind the existance of this macro is the size of Eigen's
|
||||
# testsuite. Together with the relativly big compile-times building all tests
|
||||
# The intention behind the existence of this macro is the size of Eigen's
|
||||
# testsuite. Together with the relatively big compile-times building all tests
|
||||
# can take a substantial amount of time depending on the available hardware.
|
||||
#
|
||||
#
|
||||
# The last buildtestspartN target will build possible remaining tests.
|
||||
#
|
||||
# An example:
|
||||
@@ -727,7 +706,7 @@ macro(ei_split_testsuite num_splits)
|
||||
endforeach()
|
||||
math(EXPR test_idx "${test_idx} + ${num_tests_per_target}")
|
||||
endforeach()
|
||||
|
||||
|
||||
# Handle the possibly remaining tests
|
||||
math(EXPR test_idx "${num_splits} * ${num_tests_per_target}")
|
||||
math(EXPR target_bound "${eigen_test_count} - 1")
|
||||
@@ -739,10 +718,10 @@ endmacro(ei_split_testsuite num_splits)
|
||||
|
||||
# Defines the custom command buildsmoketests to build a number of tests
|
||||
# specified in smoke_test_list.
|
||||
#
|
||||
#
|
||||
# Test in smoke_test_list can be either test targets (e.g. packetmath) or
|
||||
# subtests targets (e.g. packetmath_2). If any of the test are not available
|
||||
# in the current configuration they are just skipped.
|
||||
# in the current configuration they are just skipped.
|
||||
#
|
||||
# All tests added via this macro are labeled with the smoketest label. This
|
||||
# allows running smoketests only using ctest.
|
||||
|
||||
61
cmake/FindCLANG_FORMAT.cmake
Normal file
61
cmake/FindCLANG_FORMAT.cmake
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
|
||||
# Find clang-format
|
||||
#
|
||||
# CLANG_FORMAT_EXECUTABLE - Path to clang-format executable
|
||||
# CLANG_FORMAT_FOUND - True if the clang-format executable was found.
|
||||
# CLANG_FORMAT_VERSION - The version of clang-format found
|
||||
#
|
||||
# Copyright 2009-2020 The VOTCA Development Team (http://www.votca.org)
|
||||
#
|
||||
# Licensed under the Mozilla Public License Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.mozilla.org/en-US/MPL/2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
find_program(CLANG_FORMAT_EXECUTABLE
|
||||
NAMES
|
||||
clang-format-9
|
||||
clang-format
|
||||
clang-format-11
|
||||
clang-format-10
|
||||
clang-format-8
|
||||
clang-format-7
|
||||
|
||||
DOC "clang-format executable")
|
||||
mark_as_advanced(CLANG_FORMAT_EXECUTABLE)
|
||||
|
||||
# Extract version from command "clang-format -version"
|
||||
if(CLANG_FORMAT_EXECUTABLE)
|
||||
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} -version
|
||||
OUTPUT_VARIABLE clang_format_version
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(clang_format_version MATCHES "^.*clang-format version .*")
|
||||
# clang_format_version sample: "clang-format version 3.9.1-4ubuntu3~16.04.1
|
||||
# (tags/RELEASE_391/rc2)"
|
||||
string(REGEX
|
||||
REPLACE "^.*clang-format version ([.0-9]+).*"
|
||||
"\\1"
|
||||
CLANG_FORMAT_VERSION
|
||||
"${clang_format_version}")
|
||||
# CLANG_FORMAT_VERSION sample: "3.9.1"
|
||||
else()
|
||||
set(CLANG_FORMAT_VERSION 0.0)
|
||||
endif()
|
||||
else()
|
||||
set(CLANG_FORMAT_VERSION 0.0)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set CLANG_FORMAT_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(CLANG_FORMAT REQUIRED_VARS CLANG_FORMAT_EXECUTABLE VERSION_VAR CLANG_FORMAT_VERSION)
|
||||
@@ -382,7 +382,7 @@ endfunction(__build_ir)
|
||||
#######################
|
||||
#
|
||||
# Adds a SYCL compilation custom command associated with an existing
|
||||
# target and sets a dependancy on that new command.
|
||||
# target and sets a dependency on that new command.
|
||||
#
|
||||
# TARGET : Name of the target to add SYCL to.
|
||||
# SOURCES : Source files to be compiled for SYCL.
|
||||
|
||||
62
cmake/FindDPCPP.cmake
Normal file
62
cmake/FindDPCPP.cmake
Normal file
@@ -0,0 +1,62 @@
|
||||
include_guard()
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
if("${DPCPP_SYCL_TARGET}" STREQUAL "amdgcn-amd-amdhsa" AND
|
||||
"${DPCPP_SYCL_ARCH}" STREQUAL "")
|
||||
message(FATAL_ERROR "Architecture required for AMD DPCPP builds,"
|
||||
" please specify in DPCPP_SYCL_ARCH")
|
||||
endif()
|
||||
|
||||
set(DPCPP_USER_FLAGS "" CACHE STRING
|
||||
"Additional user-specified compiler flags for DPC++")
|
||||
|
||||
get_filename_component(DPCPP_BIN_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
|
||||
find_library(DPCPP_LIB_DIR NAMES sycl sycl6 PATHS "${DPCPP_BIN_DIR}/../lib")
|
||||
|
||||
add_library(DPCPP::DPCPP INTERFACE IMPORTED)
|
||||
|
||||
set(DPCPP_FLAGS "-fsycl;-fsycl-targets=${DPCPP_SYCL_TARGET};-fsycl-unnamed-lambda;${DPCPP_USER_FLAGS};-ftemplate-backtrace-limit=0")
|
||||
if(NOT "${DPCPP_SYCL_ARCH}" STREQUAL "")
|
||||
if("${DPCPP_SYCL_TARGET}" STREQUAL "amdgcn-amd-amdhsa")
|
||||
list(APPEND DPCPP_FLAGS "-Xsycl-target-backend")
|
||||
list(APPEND DPCPP_FLAGS "--offload-arch=${DPCPP_SYCL_ARCH}")
|
||||
elseif("${DPCPP_SYCL_TARGET}" STREQUAL "nvptx64-nvidia-cuda")
|
||||
list(APPEND DPCPP_FLAGS "-Xsycl-target-backend")
|
||||
list(APPEND DPCPP_FLAGS "--cuda-gpu-arch=${DPCPP_SYCL_ARCH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
set_target_properties(DPCPP::DPCPP PROPERTIES
|
||||
INTERFACE_COMPILE_OPTIONS "${DPCPP_FLAGS}"
|
||||
INTERFACE_LINK_OPTIONS "${DPCPP_FLAGS}"
|
||||
INTERFACE_LINK_LIBRARIES ${DPCPP_LIB_DIR}
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${DPCPP_BIN_DIR}/../include/sycl;${DPCPP_BIN_DIR}/../include")
|
||||
message(STATUS ">>>>>>>>> DPCPP INCLUDE DIR: ${DPCPP_BIN_DIR}/../include/sycl")
|
||||
else()
|
||||
set_target_properties(DPCPP::DPCPP PROPERTIES
|
||||
INTERFACE_COMPILE_OPTIONS "${DPCPP_FLAGS}"
|
||||
INTERFACE_LINK_LIBRARIES ${DPCPP_LIB_DIR}
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${DPCPP_BIN_DIR}/../include/sycl")
|
||||
endif()
|
||||
|
||||
function(add_sycl_to_target)
|
||||
set(options)
|
||||
set(one_value_args TARGET)
|
||||
set(multi_value_args SOURCES)
|
||||
cmake_parse_arguments(SB_ADD_SYCL
|
||||
"${options}"
|
||||
"${one_value_args}"
|
||||
"${multi_value_args}"
|
||||
${ARGN}
|
||||
)
|
||||
target_compile_options(${SB_ADD_SYCL_TARGET} PUBLIC ${DPCPP_FLAGS})
|
||||
target_link_libraries(${SB_ADD_SYCL_TARGET} DPCPP::DPCPP)
|
||||
target_compile_features(${SB_ADD_SYCL_TARGET} PRIVATE cxx_std_17)
|
||||
get_target_property(target_type ${SB_ADD_SYCL_TARGET} TYPE)
|
||||
if (NOT target_type STREQUAL "OBJECT_LIBRARY")
|
||||
target_link_options(${SB_ADD_SYCL_TARGET} PUBLIC ${DPCPP_FLAGS})
|
||||
endif()
|
||||
endfunction()
|
||||
64
cmake/SyclConfigureTesting.cmake
Normal file
64
cmake/SyclConfigureTesting.cmake
Normal file
@@ -0,0 +1,64 @@
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
# Forward CMake options as preprocessor definitions
|
||||
if(EIGEN_SYCL_USE_DEFAULT_SELECTOR)
|
||||
add_definitions(-DEIGEN_SYCL_USE_DEFAULT_SELECTOR=${EIGEN_SYCL_USE_DEFAULT_SELECTOR})
|
||||
endif()
|
||||
if(EIGEN_SYCL_NO_LOCAL_MEM)
|
||||
add_definitions(-DEIGEN_SYCL_NO_LOCAL_MEM=${EIGEN_SYCL_NO_LOCAL_MEM})
|
||||
endif()
|
||||
if(EIGEN_SYCL_LOCAL_MEM)
|
||||
add_definitions(-DEIGEN_SYCL_LOCAL_MEM=${EIGEN_SYCL_LOCAL_MEM})
|
||||
endif()
|
||||
if(EIGEN_SYCL_MAX_GLOBAL_RANGE)
|
||||
add_definitions(-DEIGEN_SYCL_MAX_GLOBAL_RANGE=${EIGEN_SYCL_MAX_GLOBAL_RANGE})
|
||||
endif()
|
||||
if(EIGEN_SYCL_LOCAL_THREAD_DIM0)
|
||||
add_definitions(-DEIGEN_SYCL_LOCAL_THREAD_DIM0=${EIGEN_SYCL_LOCAL_THREAD_DIM0})
|
||||
endif()
|
||||
if(EIGEN_SYCL_LOCAL_THREAD_DIM1)
|
||||
add_definitions(-DEIGEN_SYCL_LOCAL_THREAD_DIM1=${EIGEN_SYCL_LOCAL_THREAD_DIM1})
|
||||
endif()
|
||||
if(EIGEN_SYCL_REG_M)
|
||||
add_definitions(-DEIGEN_SYCL_REG_M=${EIGEN_SYCL_REG_M})
|
||||
endif()
|
||||
if(EIGEN_SYCL_REG_N)
|
||||
add_definitions(-DEIGEN_SYCL_REG_N=${EIGEN_SYCL_REG_N})
|
||||
endif()
|
||||
if(EIGEN_SYCL_ASYNC_EXECUTION)
|
||||
add_definitions(-DEIGEN_SYCL_ASYNC_EXECUTION=${EIGEN_SYCL_ASYNC_EXECUTION})
|
||||
endif()
|
||||
if(EIGEN_SYCL_DISABLE_SKINNY)
|
||||
add_definitions(-DEIGEN_SYCL_DISABLE_SKINNY=${EIGEN_SYCL_DISABLE_SKINNY})
|
||||
endif()
|
||||
if(EIGEN_SYCL_DISABLE_DOUBLE_BUFFER)
|
||||
add_definitions(-DEIGEN_SYCL_DISABLE_DOUBLE_BUFFER=${EIGEN_SYCL_DISABLE_DOUBLE_BUFFER})
|
||||
endif()
|
||||
if(EIGEN_SYCL_DISABLE_SCALAR)
|
||||
add_definitions(-DEIGEN_SYCL_DISABLE_SCALAR=${EIGEN_SYCL_DISABLE_SCALAR})
|
||||
endif()
|
||||
if(EIGEN_SYCL_DISABLE_GEMV)
|
||||
add_definitions(-DEIGEN_SYCL_DISABLE_GEMV=${EIGEN_SYCL_DISABLE_GEMV})
|
||||
endif()
|
||||
if(EIGEN_SYCL_DISABLE_ARM_GPU_CACHE_OPTIMISATION)
|
||||
add_definitions(-DEIGEN_SYCL_DISABLE_ARM_GPU_CACHE_OPTIMISATION=${EIGEN_SYCL_DISABLE_ARM_GPU_CACHE_OPTIMISATION})
|
||||
endif()
|
||||
|
||||
if(EIGEN_SYCL_ComputeCpp)
|
||||
if(MSVC)
|
||||
list(APPEND COMPUTECPP_USER_FLAGS -DWIN32)
|
||||
else()
|
||||
list(APPEND COMPUTECPP_USER_FLAGS -Wall)
|
||||
endif()
|
||||
# The following flags are not supported by Clang and can cause warnings
|
||||
# if used with -Werror so they are removed here.
|
||||
if(COMPUTECPP_USE_COMPILER_DRIVER)
|
||||
set(CMAKE_CXX_COMPILER ${ComputeCpp_DEVICE_COMPILER_EXECUTABLE})
|
||||
string(REPLACE "-Wlogical-op" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
string(REPLACE "-Wno-psabi" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
endif()
|
||||
list(APPEND COMPUTECPP_USER_FLAGS
|
||||
-DEIGEN_NO_ASSERTION_CHECKING=1
|
||||
-no-serial-memop
|
||||
-Xclang
|
||||
-cl-mad-enable)
|
||||
endif(EIGEN_SYCL_ComputeCpp)
|
||||
Reference in New Issue
Block a user