diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2020-12-09 15:55:30 (GMT) |
---|---|---|
committer | Robert Maynard <robert.maynard@kitware.com> | 2020-12-09 16:33:44 (GMT) |
commit | 8da25e4a3c0583a940abcbfede8ceb915fd976e0 (patch) | |
tree | ce4042e286216ed4dce40120af99677c973a80e2 /Tests/ISPC/SystemIncludes | |
parent | 64fb825438a2fecb9eab9933d5d1b926bf6f294b (diff) | |
download | CMake-8da25e4a3c0583a940abcbfede8ceb915fd976e0.zip CMake-8da25e4a3c0583a940abcbfede8ceb915fd976e0.tar.gz CMake-8da25e4a3c0583a940abcbfede8ceb915fd976e0.tar.bz2 |
ISPC: Treat system includes as '-I' includes
ISPC doesn't have specific syntax for system includes.
Diffstat (limited to 'Tests/ISPC/SystemIncludes')
-rw-r--r-- | Tests/ISPC/SystemIncludes/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/ISPC/SystemIncludes/main.cxx | 15 | ||||
-rw-r--r-- | Tests/ISPC/SystemIncludes/simple.ispc | 9 |
3 files changed, 36 insertions, 0 deletions
diff --git a/Tests/ISPC/SystemIncludes/CMakeLists.txt b/Tests/ISPC/SystemIncludes/CMakeLists.txt new file mode 100644 index 0000000..95959b2 --- /dev/null +++ b/Tests/ISPC/SystemIncludes/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.18) +project(ispc_spaces_in_path ISPC CXX) + + +add_executable(ISPCSystemIncludes main.cxx simple.ispc) +set_target_properties(ISPCSystemIncludes PROPERTIES POSITION_INDEPENDENT_CODE ON) +target_include_directories(ISPCSystemIncludes SYSTEM PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") + +target_compile_options(ISPCSystemIncludes PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>") +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + target_compile_options(ISPCSystemIncludes PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>") +endif() diff --git a/Tests/ISPC/SystemIncludes/main.cxx b/Tests/ISPC/SystemIncludes/main.cxx new file mode 100644 index 0000000..4f1c9be --- /dev/null +++ b/Tests/ISPC/SystemIncludes/main.cxx @@ -0,0 +1,15 @@ +#include <stdio.h> + +#include "simple.ispc.h" + +int main() +{ + float vin[16], vout[16]; + for (int i = 0; i < 16; ++i) + vin[i] = i; + + ispc::simple(vin, vout, 16); + + for (int i = 0; i < 16; ++i) + printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]); +} diff --git a/Tests/ISPC/SystemIncludes/simple.ispc b/Tests/ISPC/SystemIncludes/simple.ispc new file mode 100644 index 0000000..d539bbe --- /dev/null +++ b/Tests/ISPC/SystemIncludes/simple.ispc @@ -0,0 +1,9 @@ + +export void simple(uniform float vin[], uniform float vout[], + uniform int count) { + foreach (index = 0 ... count) { + float v = vin[index]; + v = sqrt(v); + vout[index] = v; + } +} |