diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2020-09-24 19:39:00 (GMT) |
---|---|---|
committer | Robert Maynard <robert.maynard@kitware.com> | 2020-10-06 14:47:20 (GMT) |
commit | e17e2c6a517cf40b41014cdf3e239c0b21da868e (patch) | |
tree | 214a35d04a2214d1aa9d074cad80672ce1cb0f18 | |
parent | a12da6fb5ece6baf3b4540d8204b8b29dde92538 (diff) | |
download | CMake-e17e2c6a517cf40b41014cdf3e239c0b21da868e.zip CMake-e17e2c6a517cf40b41014cdf3e239c0b21da868e.tar.gz CMake-e17e2c6a517cf40b41014cdf3e239c0b21da868e.tar.bz2 |
ISPC: CheckCompilerFlags and CheckSourceCompiles support ISPC
-rw-r--r-- | Help/release/dev/ispc-check-support.rst | 8 | ||||
-rw-r--r-- | Modules/CheckCompilerFlag.cmake | 2 | ||||
-rw-r--r-- | Modules/CheckSourceCompiles.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake | 13 | ||||
-rw-r--r-- | Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/CheckSourceCompiles/CheckISPCSourceCompiles.cmake | 20 | ||||
-rw-r--r-- | Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake | 4 |
8 files changed, 58 insertions, 1 deletions
diff --git a/Help/release/dev/ispc-check-support.rst b/Help/release/dev/ispc-check-support.rst new file mode 100644 index 0000000..0023f0c --- /dev/null +++ b/Help/release/dev/ispc-check-support.rst @@ -0,0 +1,8 @@ +ispc-check-support +------------------ + +* The :module:`CheckCompilerFlag` module was extended to + support 'ISPC'. + +* The :module:`CheckSourceCompiles` module was extended to + support 'ISPC'. diff --git a/Modules/CheckCompilerFlag.cmake b/Modules/CheckCompilerFlag.cmake index 9223009..cca933e 100644 --- a/Modules/CheckCompilerFlag.cmake +++ b/Modules/CheckCompilerFlag.cmake @@ -68,6 +68,8 @@ int main(void) { return 0; }]=]) int main(void) { return 0; }]=]) set(_lang_fail_regex FAIL_REGEX "command line option .* is valid for .* but not for Objective-C\\+\\+" # GNU FAIL_REGEX "argument unused during compilation: .*") # Clang + elseif(_lang STREQUAL ISPC) + set(_lang_src "float func(uniform int32, float a) { return a / 2.25; }") else() message (SEND_ERROR "check_compiler_flag: ${_lang}: unknown language.") return() diff --git a/Modules/CheckSourceCompiles.cmake b/Modules/CheckSourceCompiles.cmake index 13ec9db..70a733d 100644 --- a/Modules/CheckSourceCompiles.cmake +++ b/Modules/CheckSourceCompiles.cmake @@ -92,6 +92,9 @@ function(CHECK_SOURCE_COMPILES _lang _source _var) elseif(_lang STREQUAL Fortran) set(_lang_textual "Fortran") set(_lang_ext "F") + elseif(_lang STREQUAL ISPC) + set(_lang_textual "ISPC") + set(_lang_ext "ispc") elseif(_lang STREQUAL OBJC) set(_lang_textual "Objective-C") set(_lang_ext "m") 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() |