From 8da25e4a3c0583a940abcbfede8ceb915fd976e0 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 9 Dec 2020 10:55:30 -0500 Subject: ISPC: Treat system includes as '-I' includes ISPC doesn't have specific syntax for system includes. --- Modules/Compiler/Intel-ISPC.cmake | 2 -- Tests/ISPC/CMakeLists.txt | 1 + Tests/ISPC/SystemIncludes/CMakeLists.txt | 12 ++++++++++++ Tests/ISPC/SystemIncludes/main.cxx | 15 +++++++++++++++ Tests/ISPC/SystemIncludes/simple.ispc | 9 +++++++++ 5 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 Tests/ISPC/SystemIncludes/CMakeLists.txt create mode 100644 Tests/ISPC/SystemIncludes/main.cxx create mode 100644 Tests/ISPC/SystemIncludes/simple.ispc diff --git a/Modules/Compiler/Intel-ISPC.cmake b/Modules/Compiler/Intel-ISPC.cmake index 2e9792a..aa9ecea 100644 --- a/Modules/Compiler/Intel-ISPC.cmake +++ b/Modules/Compiler/Intel-ISPC.cmake @@ -14,8 +14,6 @@ string(APPEND CMAKE_ISPC_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG") set(CMAKE_ISPC_COMPILE_OPTIONS_PIE --pic) set(CMAKE_ISPC_COMPILE_OPTIONS_PIC --pic) -set(CMAKE_INCLUDE_SYSTEM_FLAG_ISPC -isystem=) - set(CMAKE_ISPC_RESPONSE_FILE_FLAG "@") set(CMAKE_ISPC_USE_RESPONSE_FILE_FOR_INCLUDES 1) set(CMAKE_ISPC_USE_RESPONSE_FILE_FOR_LIBRARIES 1) 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 "$<$:--target=sse2-i32x4>") +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + target_compile_options(ISPCSystemIncludes PRIVATE "$<$:--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 + +#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; + } +} -- cgit v0.12