CMakeTestISPCCompiler.cmake 1.4 KB

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