summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-09-24 19:39:00 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2020-10-06 14:47:20 (GMT)
commite17e2c6a517cf40b41014cdf3e239c0b21da868e (patch)
tree214a35d04a2214d1aa9d074cad80672ce1cb0f18 /Tests
parenta12da6fb5ece6baf3b4540d8204b8b29dde92538 (diff)
downloadCMake-e17e2c6a517cf40b41014cdf3e239c0b21da868e.zip
CMake-e17e2c6a517cf40b41014cdf3e239c0b21da868e.tar.gz
CMake-e17e2c6a517cf40b41014cdf3e239c0b21da868e.tar.bz2
ISPC: CheckCompilerFlags and CheckSourceCompiles support ISPC
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake13
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckISPCSourceCompiles.cmake20
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake4
5 files changed, 45 insertions, 1 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 9d5c8fb..9e9448f 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -539,8 +539,11 @@ add_RunCMake_test(target_compile_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILE
add_RunCMake_test(target_include_directories)
add_RunCMake_test(target_sources)
add_RunCMake_test(CheckCompilerFlag)
-add_RunCMake_test(CheckSourceCompiles)
+add_RunCMake_test(CheckSourceCompiles -DCMake_TEST_ISPC=${CMake_TEST_ISPC})
add_RunCMake_test(CheckSourceRuns)
+set_property(TEST RunCMake.CheckSourceCompiles
+ RunCMake.CheckCompilerFlag
+ APPEND PROPERTY LABELS "ISPC")
add_RunCMake_test(CheckModules)
add_RunCMake_test(CheckIPOSupported)
if (CMAKE_SYSTEM_NAME MATCHES "(Linux|Darwin)"
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake
new file mode 100644
index 0000000..662319a
--- /dev/null
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake
@@ -0,0 +1,13 @@
+
+enable_language (ISPC)
+include(CheckCompilerFlag)
+
+check_compiler_flag(ISPC "-_this_is_not_a_flag_" SHOULD_FAIL)
+if(SHOULD_FAIL)
+ message(SEND_ERROR "invalid ISPC compile flag didn't fail.")
+endif()
+
+check_compiler_flag(ISPC "--woff" SHOULD_WORK)
+if(NOT SHOULD_WORK)
+ message(SEND_ERROR "${CMAKE_ISPC_COMPILER_ID} compiler flag '--woff' check failed")
+endif()
diff --git a/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake b/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake
index d56b8a9..e4d65b8 100644
--- a/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake
@@ -14,3 +14,7 @@ endif()
if (CMAKE_Fortran_COMPILER_ID)
run_cmake(CheckFortranCompilerFlag)
endif()
+
+if(CMake_TEST_ISPC)
+ run_cmake(CheckISPCCompilerFlag)
+endif()
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckISPCSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckISPCSourceCompiles.cmake
new file mode 100644
index 0000000..74b83c0
--- /dev/null
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckISPCSourceCompiles.cmake
@@ -0,0 +1,20 @@
+
+enable_language (ISPC)
+include(CheckSourceCompiles)
+
+check_source_compiles(ISPC "I don't build" SHOULD_FAIL)
+if(SHOULD_FAIL)
+ message(SEND_ERROR "invalid ISPC source didn't fail.")
+endif()
+
+check_source_compiles(ISPC [=[
+
+float func(uniform int32, float a)
+{
+ return a / 2.25;
+}
+]=]
+ SHOULD_BUILD)
+if(NOT SHOULD_BUILD)
+ message(SEND_ERROR "Test fail for valid ISPC source.")
+endif()
diff --git a/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake b/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake
index bf32828..a574d7d 100644
--- a/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake
@@ -14,3 +14,7 @@ endif()
if (CMAKE_Fortran_COMPILER_ID)
run_cmake(CheckFortranSourceCompiles)
endif()
+
+if(CMake_TEST_ISPC)
+ run_cmake(CheckISPCSourceCompiles)
+endif()