summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeISPCInformation.cmake
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-07-16 19:18:55 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2020-08-28 15:21:31 (GMT)
commit34cc6acc81758e29f8c88607c21ab11d8807f87c (patch)
tree38effcd493f057f6148f4d8f58262dfb27afaa24 /Modules/CMakeISPCInformation.cmake
parent419d70d49000e10c36d9615574ff03513f2edf0d (diff)
downloadCMake-34cc6acc81758e29f8c88607c21ab11d8807f87c.zip
CMake-34cc6acc81758e29f8c88607c21ab11d8807f87c.tar.gz
CMake-34cc6acc81758e29f8c88607c21ab11d8807f87c.tar.bz2
Add ISPC compiler support to CMake
Diffstat (limited to 'Modules/CMakeISPCInformation.cmake')
-rw-r--r--Modules/CMakeISPCInformation.cmake56
1 files changed, 56 insertions, 0 deletions
diff --git a/Modules/CMakeISPCInformation.cmake b/Modules/CMakeISPCInformation.cmake
new file mode 100644
index 0000000..37057d9
--- /dev/null
+++ b/Modules/CMakeISPCInformation.cmake
@@ -0,0 +1,56 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+set(CMAKE_ISPC_OUTPUT_EXTENSION .o)
+set(CMAKE_INCLUDE_FLAG_ISPC "-I")
+
+# Load compiler-specific information.
+if(CMAKE_ISPC_COMPILER_ID)
+ include(Compiler/${CMAKE_ISPC_COMPILER_ID}-ISPC OPTIONAL)
+endif()
+
+# load the system- and compiler specific files
+if(CMAKE_ISPC_COMPILER_ID)
+ # load a hardware specific file, mostly useful for embedded compilers
+ if(CMAKE_SYSTEM_PROCESSOR)
+ include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_ISPC_COMPILER_ID}-ISPC-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
+ endif()
+ include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_ISPC_COMPILER_ID}-ISPC OPTIONAL)
+endif()
+
+# add the flags to the cache based
+# on the initial values computed in the platform/*.cmake files
+# use _INIT variables so that this only happens the first time
+# and you can set these flags in the cmake cache
+set(CMAKE_ISPC_FLAGS_INIT "$ENV{ISPCFLAGS} ${CMAKE_ISPC_FLAGS_INIT}")
+
+cmake_initialize_per_config_variable(CMAKE_ISPC_FLAGS "Flags used by the ISPC compiler")
+
+if(CMAKE_ISPC_STANDARD_LIBRARIES_INIT)
+ set(CMAKE_ISPC_STANDARD_LIBRARIES "${CMAKE_ISPC_STANDARD_LIBRARIES_INIT}"
+ CACHE STRING "Libraries linked by default with all ISPC applications.")
+ mark_as_advanced(CMAKE_ISPC_STANDARD_LIBRARIES)
+endif()
+
+include(CMakeCommonLanguageInclude)
+
+# now define the following rules:
+# CMAKE_ISPC_COMPILE_OBJECT
+
+# Create a static archive incrementally for large object file counts.
+if(NOT DEFINED CMAKE_ISPC_ARCHIVE_CREATE)
+ set(CMAKE_ISPC_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
+endif()
+if(NOT DEFINED CMAKE_ISPC_ARCHIVE_APPEND)
+ set(CMAKE_ISPC_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
+endif()
+if(NOT DEFINED CMAKE_ISPC_ARCHIVE_FINISH)
+ set(CMAKE_ISPC_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
+endif()
+
+if(NOT CMAKE_ISPC_COMPILE_OBJECT)
+ set(CMAKE_ISPC_COMPILE_OBJECT
+ "<CMAKE_ISPC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> --emit-obj <SOURCE>")
+endif()
+
+set(CMAKE_ISPC_INFORMATION_LOADED 1)