1# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2# file Copyright.txt or https://cmake.org/licensing for details.
3
4if(UNIX)
5  set(CMAKE_ISPC_OUTPUT_EXTENSION .o)
6else()
7  set(CMAKE_ISPC_OUTPUT_EXTENSION .obj)
8endif()
9set(CMAKE_INCLUDE_FLAG_ISPC "-I")
10
11# Load compiler-specific information.
12if(CMAKE_ISPC_COMPILER_ID)
13  include(Compiler/${CMAKE_ISPC_COMPILER_ID}-ISPC OPTIONAL)
14endif()
15
16# load the system- and compiler specific files
17if(CMAKE_ISPC_COMPILER_ID)
18  # load a hardware specific file, mostly useful for embedded compilers
19  if(CMAKE_SYSTEM_PROCESSOR)
20    include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_ISPC_COMPILER_ID}-ISPC-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
21  endif()
22  include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_ISPC_COMPILER_ID}-ISPC OPTIONAL)
23endif()
24
25# add the flags to the cache based
26# on the initial values computed in the platform/*.cmake files
27# use _INIT variables so that this only happens the first time
28# and you can set these flags in the cmake cache
29set(CMAKE_ISPC_FLAGS_INIT "$ENV{ISPCFLAGS} ${CMAKE_ISPC_FLAGS_INIT}")
30
31cmake_initialize_per_config_variable(CMAKE_ISPC_FLAGS "Flags used by the ISPC compiler")
32
33if(CMAKE_ISPC_STANDARD_LIBRARIES_INIT)
34  set(CMAKE_ISPC_STANDARD_LIBRARIES "${CMAKE_ISPC_STANDARD_LIBRARIES_INIT}"
35    CACHE STRING "Libraries linked by default with all ISPC applications.")
36  mark_as_advanced(CMAKE_ISPC_STANDARD_LIBRARIES)
37endif()
38
39if(NOT CMAKE_ISPC_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_ISPC_COMPILER_LAUNCHER})
40  set(CMAKE_ISPC_COMPILER_LAUNCHER "$ENV{CMAKE_ISPC_COMPILER_LAUNCHER}"
41    CACHE STRING "Compiler launcher for ISPC.")
42endif()
43
44include(CMakeCommonLanguageInclude)
45
46# now define the following rules:
47# CMAKE_ISPC_COMPILE_OBJECT
48
49# Create a static archive incrementally for large object file counts.
50if(NOT DEFINED CMAKE_ISPC_ARCHIVE_CREATE)
51  set(CMAKE_ISPC_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
52endif()
53if(NOT DEFINED CMAKE_ISPC_ARCHIVE_APPEND)
54  set(CMAKE_ISPC_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
55endif()
56if(NOT DEFINED CMAKE_ISPC_ARCHIVE_FINISH)
57  set(CMAKE_ISPC_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
58endif()
59
60if(NOT CMAKE_ISPC_COMPILE_OBJECT)
61  set(CMAKE_ISPC_COMPILE_OBJECT
62    "<CMAKE_ISPC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> --emit-obj <SOURCE> -h <ISPC_HEADER>")
63endif()
64
65set(CMAKE_ISPC_INFORMATION_LOADED 1)
66