diff options
Diffstat (limited to 'Tests/RunCMake')
18 files changed, 85 insertions, 1 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 35a6ab5..906fa8c 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -386,6 +386,7 @@ function(add_RunCMake_test_try_compile) CMAKE_CXX_COMPILER_VERSION CMAKE_CXX_STANDARD_DEFAULT CMake_TEST_CUDA + CMake_TEST_ISPC CMake_TEST_FILESYSTEM_1S CMAKE_OBJC_STANDARD_DEFAULT CMAKE_OBJCXX_STANDARD_DEFAULT @@ -396,7 +397,7 @@ function(add_RunCMake_test_try_compile) endforeach() add_RunCMake_test(try_compile) set_property(TEST RunCMake.try_compile APPEND - PROPERTY LABELS "CUDA") + PROPERTY LABELS "CUDA;ISPC") endfunction() add_RunCMake_test_try_compile() @@ -551,7 +552,10 @@ add_RunCMake_test(install -DNO_NAMELINK=${NO_NAMELINK} -DCYGWIN=${CYGWIN} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG=${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG} -DCMAKE_EXECUTABLE_FORMAT=${CMAKE_EXECUTABLE_FORMAT} + -DCMake_TEST_ISPC=${CMake_TEST_ISPC} ) +set_property(TEST RunCMake.install APPEND + PROPERTY LABELS "ISPC") add_RunCMake_test(file-GET_RUNTIME_DEPENDENCIES -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} diff --git a/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake new file mode 100644 index 0000000..8750a76 --- /dev/null +++ b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake @@ -0,0 +1,11 @@ + +set(objs obj1 obj2) +set(targets sse2 sse4 avx avx2) +foreach(o IN LISTS objs) + set(item "objs/${o}\\.ispc\\.(o|obj)") + check_installed("${item}") + foreach(t IN LISTS targets) + set(item "objs/${o}\\.ispc_${t}\\.(o|obj)") + check_installed("${item}") + endforeach() +endforeach() diff --git a/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake new file mode 100644 index 0000000..ad542ed --- /dev/null +++ b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake @@ -0,0 +1,4 @@ +enable_language(ISPC) +add_library(objs OBJECT obj1.ispc obj2.ispc) +set_target_properties(objs PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4") +install(FILES $<TARGET_OBJECTS:objs> DESTINATION objs) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index d83a07c..3573fbd 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -96,6 +96,11 @@ if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES} run_install_test(FILES-TARGET_OBJECTS) endif() +if(CMake_TEST_ISPC) + run_install_test(FILES-EXTRA_ISPC_TARGET_OBJECTS) +endif() + + run_install_test(TARGETS-InstallFromSubDir) run_install_test(TARGETS-OPTIONAL) run_install_test(FILES-OPTIONAL) diff --git a/Tests/RunCMake/install/obj1.ispc b/Tests/RunCMake/install/obj1.ispc new file mode 100644 index 0000000..0dc983c --- /dev/null +++ b/Tests/RunCMake/install/obj1.ispc @@ -0,0 +1,4 @@ + +float func1(float a, float b) { + return a + b / 2.; +} diff --git a/Tests/RunCMake/install/obj2.ispc b/Tests/RunCMake/install/obj2.ispc new file mode 100644 index 0000000..7b2aeb9 --- /dev/null +++ b/Tests/RunCMake/install/obj2.ispc @@ -0,0 +1,4 @@ + +float func2(float a, float b) { + return a + b / 2.; +} diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTarget-stderr.txt b/Tests/RunCMake/try_compile/ISPCDuplicateTarget-stderr.txt new file mode 100644 index 0000000..7dcb1de --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTarget-stderr.txt @@ -0,0 +1 @@ +.*Error: Can't compile to multiple variants of avx512skx target!.* diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake new file mode 100644 index 0000000..6d29069 --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake @@ -0,0 +1,8 @@ +enable_language(ISPC) +set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 + avx512skx-i32x16) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + OUTPUT_VARIABLE out + ) +message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-result.txt b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt new file mode 100644 index 0000000..99248bf --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt @@ -0,0 +1 @@ +.*ninja: error: .* multiple rules generate.*src.ispc_avx512skx.o.* diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake new file mode 100644 index 0000000..7f59c14 --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake @@ -0,0 +1,11 @@ +enable_language(ISPC) +set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 + avx512skx-i32x16) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + OUTPUT_VARIABLE out + ) +message("try_compile output:\n${out}") +if(NOT result) + message(FATAL_ERROR "making Ninja and Ninja Multi-Config behave the same") +endif() diff --git a/Tests/RunCMake/try_compile/ISPCInvalidTarget-stderr.txt b/Tests/RunCMake/try_compile/ISPCInvalidTarget-stderr.txt new file mode 100644 index 0000000..44543ad --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCInvalidTarget-stderr.txt @@ -0,0 +1 @@ +.*Error: Incorrect targets: avxknl-i32x16.* diff --git a/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake new file mode 100644 index 0000000..c1ab6f2 --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake @@ -0,0 +1,7 @@ +enable_language(ISPC) +set(CMAKE_ISPC_INSTRUCTION_SETS "avxknl-i32x16") +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + OUTPUT_VARIABLE out + ) +message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt b/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt new file mode 100644 index 0000000..72e0a01 --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt @@ -0,0 +1 @@ +.*Linking ISPC static library* diff --git a/Tests/RunCMake/try_compile/ISPCTargets-stdout.txt b/Tests/RunCMake/try_compile/ISPCTargets-stdout.txt new file mode 100644 index 0000000..a731d52 --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCTargets-stdout.txt @@ -0,0 +1 @@ +.*Detecting ISPC compiler ABI info - done.* diff --git a/Tests/RunCMake/try_compile/ISPCTargets.cmake b/Tests/RunCMake/try_compile/ISPCTargets.cmake new file mode 100644 index 0000000..0d3bd43 --- /dev/null +++ b/Tests/RunCMake/try_compile/ISPCTargets.cmake @@ -0,0 +1,7 @@ +enable_language(ISPC) +set(CMAKE_ISPC_INSTRUCTION_SETS avx512knl-i32x16 avx512skx-i32x16) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc + OUTPUT_VARIABLE out + ) +message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index 82c55cc..5b849bf 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -51,6 +51,15 @@ endif() if(CMake_TEST_CUDA) run_cmake(CudaStandard) endif() +if(CMake_TEST_ISPC) + run_cmake(ISPCTargets) + run_cmake(ISPCInvalidTarget) + set(ninja "") + if(RunCMake_GENERATOR MATCHES "Ninja") + set(ninja "Ninja") + endif() + run_cmake(ISPCDuplicateTarget${ninja}) +endif() if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) run_cmake(CStandardGNU) endif() diff --git a/Tests/RunCMake/try_compile/src.ispc b/Tests/RunCMake/try_compile/src.ispc new file mode 100644 index 0000000..b061f40 --- /dev/null +++ b/Tests/RunCMake/try_compile/src.ispc @@ -0,0 +1,4 @@ + +float func(float a, float b) { + return a + b / 2.; +} |