diff options
author | Brad King <brad.king@kitware.com> | 2020-12-10 11:56:54 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-12-10 11:57:04 (GMT) |
commit | 9f66eb74a5edbb9480614aecd1e2c8cb915a6bd8 (patch) | |
tree | 8c814dea0430ea3a42b294f34a9b7c5b432c14ad /Tests/ISPC | |
parent | 8a3ecb484fb04aa9fb8b9f6d198b3a6942c26115 (diff) | |
parent | 8da25e4a3c0583a940abcbfede8ceb915fd976e0 (diff) | |
download | CMake-9f66eb74a5edbb9480614aecd1e2c8cb915a6bd8.zip CMake-9f66eb74a5edbb9480614aecd1e2c8cb915a6bd8.tar.gz CMake-9f66eb74a5edbb9480614aecd1e2c8cb915a6bd8.tar.bz2 |
Merge topic 'ispc-system-includes' into release-3.19
8da25e4a3c ISPC: Treat system includes as '-I' includes
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5591
Diffstat (limited to 'Tests/ISPC')
-rw-r--r-- | Tests/ISPC/CMakeLists.txt | 1 | ||||
-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 |
4 files changed, 37 insertions, 0 deletions
diff --git a/Tests/ISPC/CMakeLists.txt b/Tests/ISPC/CMakeLists.txt index c13271a..2c3651d 100644 --- a/Tests/ISPC/CMakeLists.txt +++ b/Tests/ISPC/CMakeLists.txt @@ -13,4 +13,5 @@ add_ispc_test_macro(ISPC.ObjectGenex ISPCObjectGenex) add_ispc_test_macro(ISPC.ObjectLibrary ISPCObjectLibrary) add_ispc_test_macro(ISPC.ResponseAndDefine ISPCResponseAndDefine) add_ispc_test_macro(ISPC.StaticLibrary ISPCStaticLibrary) +add_ispc_test_macro(ISPC.SystemIncludes ISPCSystemIncludes) add_ispc_test_macro(ISPC.TryCompile ISPCTryCompile) 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; + } +} |