summaryrefslogtreecommitdiffstats
path: root/Tests/ISPC
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-05-09 18:05:32 (GMT)
committerBrad King <brad.king@kitware.com>2023-05-10 14:04:48 (GMT)
commit3a9b8ef0477a41e0146d7ab82f761fdc57f8b351 (patch)
treee7c3e75450b1f420dbd987a952fd3a7467b921bb /Tests/ISPC
parent6aae34ec53daf92a5ff272fb56757109003edb99 (diff)
downloadCMake-3a9b8ef0477a41e0146d7ab82f761fdc57f8b351.zip
CMake-3a9b8ef0477a41e0146d7ab82f761fdc57f8b351.tar.gz
CMake-3a9b8ef0477a41e0146d7ab82f761fdc57f8b351.tar.bz2
Tests: Teach ISPC tests to run on macOS arm64 host
Diffstat (limited to 'Tests/ISPC')
-rw-r--r--Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt11
-rw-r--r--Tests/ISPC/CustomHeaderSuffix/CMakeLists.txt6
-rw-r--r--Tests/ISPC/Defines/CMakeLists.txt7
-rw-r--r--Tests/ISPC/DynamicLibrary/CMakeLists.txt9
-rw-r--r--Tests/ISPC/ObjectGenex/CMakeLists.txt11
-rw-r--r--Tests/ISPC/ObjectLibrary/CMakeLists.txt6
-rw-r--r--Tests/ISPC/ResponseAndDefine/CMakeLists.txt12
-rw-r--r--Tests/ISPC/StaticLibrary/CMakeLists.txt10
-rw-r--r--Tests/ISPC/SystemIncludes/CMakeLists.txt11
9 files changed, 60 insertions, 23 deletions
diff --git a/Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt b/Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt
index 9a255a0..a09f638 100644
--- a/Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt
+++ b/Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt
@@ -11,10 +11,15 @@ add_library(ispc_objects1 STATIC extra.ispc extra.cxx)
add_library(ispc_objects2 STATIC simple.ispc)
set_target_properties(ispc_objects1 PROPERTIES POSITION_INDEPENDENT_CODE ON)
-set_target_properties(ispc_objects1 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;avx1-i32x16;avx2-i32x4")
-
set_target_properties(ispc_objects2 PROPERTIES POSITION_INDEPENDENT_CODE ON)
-set_target_properties(ispc_objects2 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4")
+
+if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ set_property(TARGET ispc_objects1 PROPERTY ISPC_INSTRUCTION_SETS "neon-i32x4")
+ set_property(TARGET ispc_objects2 PROPERTY ISPC_INSTRUCTION_SETS "neon-i32x4")
+else()
+ set_property(TARGET ispc_objects1 PROPERTY ISPC_INSTRUCTION_SETS "sse2-i32x4;avx1-i32x16;avx2-i32x4")
+ set_property(TARGET ispc_objects2 PROPERTY ISPC_INSTRUCTION_SETS "sse2-i32x4")
+endif()
target_link_libraries(ispc_objects2 PRIVATE ispc_objects1)
diff --git a/Tests/ISPC/CustomHeaderSuffix/CMakeLists.txt b/Tests/ISPC/CustomHeaderSuffix/CMakeLists.txt
index d20f88e..4cf5ca1 100644
--- a/Tests/ISPC/CustomHeaderSuffix/CMakeLists.txt
+++ b/Tests/ISPC/CustomHeaderSuffix/CMakeLists.txt
@@ -6,7 +6,11 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(CMAKE_ISPC_FLAGS "--arch=x86")
endif()
-set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i8x16")
+if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ set(CMAKE_ISPC_INSTRUCTION_SETS "neon-i32x4")
+else()
+ set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i8x16")
+endif()
set(CMAKE_ISPC_HEADER_SUFFIX ".ispc.h")
diff --git a/Tests/ISPC/Defines/CMakeLists.txt b/Tests/ISPC/Defines/CMakeLists.txt
index 7645804..2b99469 100644
--- a/Tests/ISPC/Defines/CMakeLists.txt
+++ b/Tests/ISPC/Defines/CMakeLists.txt
@@ -1,7 +1,12 @@
cmake_minimum_required(VERSION 3.18)
project(ISPCDefines CXX ISPC)
-set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4;avx512knl-i32x16;avx512skx-i32x8")
+if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ set(CMAKE_ISPC_INSTRUCTION_SETS "neon-i32x4")
+else()
+ set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4;avx512knl-i32x16;avx512skx-i32x8")
+endif()
+
set(CMAKE_ISPC_FLAGS -DM_PI=3.1415926535f)
add_compile_definitions([==[STRUCT_DEFINE=struct{uniform int a]==])
diff --git a/Tests/ISPC/DynamicLibrary/CMakeLists.txt b/Tests/ISPC/DynamicLibrary/CMakeLists.txt
index 4655090..516cdc1 100644
--- a/Tests/ISPC/DynamicLibrary/CMakeLists.txt
+++ b/Tests/ISPC/DynamicLibrary/CMakeLists.txt
@@ -13,8 +13,13 @@ target_sources(ispc_objects2 PRIVATE simple.cxx)
set_target_properties(ispc_objects1 PROPERTIES POSITION_INDEPENDENT_CODE ON)
-set_target_properties(ispc_objects1 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;avx1-i32x16;avx2-i32x4")
-set_target_properties(ispc_objects2 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4")
+if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ set_property(TARGET ispc_objects1 PROPERTY ISPC_INSTRUCTION_SETS "neon-i32x4")
+ set_property(TARGET ispc_objects2 PROPERTY ISPC_INSTRUCTION_SETS "neon-i32x4")
+else()
+ set_property(TARGET ispc_objects1 PROPERTY ISPC_INSTRUCTION_SETS "sse2-i32x4;avx1-i32x16;avx2-i32x4")
+ set_property(TARGET ispc_objects2 PROPERTY ISPC_INSTRUCTION_SETS "sse2-i32x4")
+endif()
target_link_libraries(ispc_objects2 PUBLIC ispc_objects1)
diff --git a/Tests/ISPC/ObjectGenex/CMakeLists.txt b/Tests/ISPC/ObjectGenex/CMakeLists.txt
index bc0cbf6..5e64004 100644
--- a/Tests/ISPC/ObjectGenex/CMakeLists.txt
+++ b/Tests/ISPC/ObjectGenex/CMakeLists.txt
@@ -1,7 +1,14 @@
cmake_minimum_required(VERSION 3.18)
project(ISPCObjectGenex CXX ISPC)
-set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4;avx512knl-i32x16;avx512skx-i32x8")
+if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ set(CMAKE_ISPC_INSTRUCTION_SETS "neon-i32x4")
+ set(numberOfTargets 1)
+else()
+ set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4;avx512knl-i32x16;avx512skx-i32x8")
+ list(LENGTH CMAKE_ISPC_INSTRUCTION_SETS numberOfTargets)
+ math(EXPR numberOfTargets "${numberOfTargets}+1")
+endif()
add_library(ispc_objects OBJECT
simple.ispc
@@ -35,8 +42,6 @@ static std::string obj_paths = "$<TARGET_OBJECTS:ispc_objects>";
add_executable(ISPCObjectGenex main.cxx)
add_dependencies(ISPCObjectGenex ispc_objects)
-list(LENGTH CMAKE_ISPC_INSTRUCTION_SETS numberOfTargets)
-math(EXPR numberOfTargets "${numberOfTargets}+1")
target_compile_definitions(ISPCObjectGenex PRIVATE
"ExpectedISPCObjects=${numberOfTargets}"
"CONFIG_TYPE=gen_$<LOWER_CASE:$<CONFIG>>"
diff --git a/Tests/ISPC/ObjectLibrary/CMakeLists.txt b/Tests/ISPC/ObjectLibrary/CMakeLists.txt
index a4c81a9..60ce920 100644
--- a/Tests/ISPC/ObjectLibrary/CMakeLists.txt
+++ b/Tests/ISPC/ObjectLibrary/CMakeLists.txt
@@ -11,8 +11,12 @@ endif()
add_library(ispc_objects OBJECT simple.ispc subdir/extra.ispc)
set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
-set_target_properties(ispc_objects PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i8x16")
+if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ set_property(TARGET ispc_objects PROPERTY ISPC_INSTRUCTION_SETS "neon-i32x4")
+else()
+ set_property(TARGET ispc_objects PROPERTY ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i8x16")
+endif()
add_executable(ISPCObjectLibrary main.cxx extra.cxx)
target_link_libraries(ISPCObjectLibrary PRIVATE ispc_objects)
diff --git a/Tests/ISPC/ResponseAndDefine/CMakeLists.txt b/Tests/ISPC/ResponseAndDefine/CMakeLists.txt
index 7539209..d29cb2a 100644
--- a/Tests/ISPC/ResponseAndDefine/CMakeLists.txt
+++ b/Tests/ISPC/ResponseAndDefine/CMakeLists.txt
@@ -14,13 +14,15 @@ add_executable(ISPCResponseAndDefine main.cxx simple.ispc)
set_target_properties(ISPCResponseAndDefine PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories(ISPCResponseAndDefine PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
-target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>")
-if(CMAKE_SIZEOF_VOID_P EQUAL 4)
- target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>")
+if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=neon-i32x4>")
+else()
+ target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>")
+ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>")
+ endif()
endif()
-
-
target_compile_definitions(ISPCResponseAndDefine PRIVATE
"$<$<COMPILE_LANGUAGE:ISPC>:STRUCT_DEFINE=struct{uniform int a>;M_PI=3.14159f")
target_include_directories(ISPCResponseAndDefine PRIVATE
diff --git a/Tests/ISPC/StaticLibrary/CMakeLists.txt b/Tests/ISPC/StaticLibrary/CMakeLists.txt
index ebe5960..76f78e5 100644
--- a/Tests/ISPC/StaticLibrary/CMakeLists.txt
+++ b/Tests/ISPC/StaticLibrary/CMakeLists.txt
@@ -4,9 +4,13 @@ project(ISPCStaticLibrary CXX ISPC)
add_library(ispc_objects STATIC simple.ispc)
-target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>")
-if(CMAKE_SIZEOF_VOID_P EQUAL 4)
- target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>")
+if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=neon-i32x4>")
+else()
+ target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>")
+ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>")
+ endif()
endif()
set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
diff --git a/Tests/ISPC/SystemIncludes/CMakeLists.txt b/Tests/ISPC/SystemIncludes/CMakeLists.txt
index d94e75e..3b4c289 100644
--- a/Tests/ISPC/SystemIncludes/CMakeLists.txt
+++ b/Tests/ISPC/SystemIncludes/CMakeLists.txt
@@ -7,8 +7,11 @@ set_target_properties(ISPCSystemIncludes PROPERTIES POSITION_INDEPENDENT_CODE ON
set_target_properties(ISPCSystemIncludes PROPERTIES ISPC_HEADER_SUFFIX ".ispc.h")
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>")
+if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ target_compile_options(ISPCSystemIncludes PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=neon-i32x4>")
+else()
+ 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()
endif()