Merge topic 'cuda_add_12.8_new_sm_support'
[kiteware-cmake.git] / Modules / CMakeTestISPCCompiler.cmake
blob6b163936d49f6aec9017b4f278dafab80a9b09e1
1 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2 # file Copyright.txt or https://cmake.org/licensing for details.
6 if(CMAKE_ISPC_COMPILER_FORCED)
7   # The compiler configuration was forced by the user.
8   # Assume the user has configured all compiler information.
9   set(CMAKE_ISPC_COMPILER_WORKS TRUE)
10   return()
11 endif()
13 include(CMakeTestCompilerCommon)
15 # Make sure we try to compile as a STATIC_LIBRARY
16 set(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
17 set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
19 # # Try to identify the ABI and configure it into CMakeISPCCompiler.cmake
20 include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
21 CMAKE_DETERMINE_COMPILER_ABI(ISPC ${CMAKE_ROOT}/Modules/CMakeISPCCompilerABI.ispc)
22 if(CMAKE_ISPC_ABI_COMPILED)
23 #   # The compiler worked so skip dedicated test below.
24   set(CMAKE_ISPC_COMPILER_WORKS TRUE)
25   message(STATUS "Check for working ISPC compiler: ${CMAKE_ISPC_COMPILER} - skipped")
26 endif()
28 # Re-configure to save learned information.
29 configure_file(
30   ${CMAKE_ROOT}/Modules/CMakeISPCCompiler.cmake.in
31   ${CMAKE_PLATFORM_INFO_DIR}/CMakeISPCCompiler.cmake
32   @ONLY
33   )
34 include(${CMAKE_PLATFORM_INFO_DIR}/CMakeISPCCompiler.cmake)
36 if(CMAKE_ISPC_SIZEOF_DATA_PTR)
37   foreach(f ${CMAKE_ISPC_ABI_FILES})
38     include(${f})
39   endforeach()
40   unset(CMAKE_ISPC_ABI_FILES)
41 endif()
43 set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE})