blob: 6b163936d49f6aec9017b4f278dafab80a9b09e1 [file] [log] [blame]
Ryan Prichard7aea7e92022-01-13 17:30:17 -08001# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2# file Copyright.txt or https://cmake.org/licensing for details.
3
4
5
6if(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()
11endif()
12
13include(CMakeTestCompilerCommon)
14
15# Make sure we try to compile as a STATIC_LIBRARY
16set(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
17set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
18
19# # Try to identify the ABI and configure it into CMakeISPCCompiler.cmake
20include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
21CMAKE_DETERMINE_COMPILER_ABI(ISPC ${CMAKE_ROOT}/Modules/CMakeISPCCompilerABI.ispc)
22if(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")
26endif()
27
28# Re-configure to save learned information.
29configure_file(
30 ${CMAKE_ROOT}/Modules/CMakeISPCCompiler.cmake.in
31 ${CMAKE_PLATFORM_INFO_DIR}/CMakeISPCCompiler.cmake
32 @ONLY
33 )
34include(${CMAKE_PLATFORM_INFO_DIR}/CMakeISPCCompiler.cmake)
35
36if(CMAKE_ISPC_SIZEOF_DATA_PTR)
37 foreach(f ${CMAKE_ISPC_ABI_FILES})
38 include(${f})
39 endforeach()
40 unset(CMAKE_ISPC_ABI_FILES)
41endif()
42
43set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE})