diff options
author | Brad King <brad.king@kitware.com> | 2020-10-07 11:13:14 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-10-07 11:13:21 (GMT) |
commit | c61f820a7fb1b191fe5591805f7e53fc52424f93 (patch) | |
tree | 22d9ffd25ab39d2fd836656fcc69c0a29554abbc /Tests | |
parent | 026beeb620f8f8c3939e128eb07c879133bf7d1c (diff) | |
parent | e17e2c6a517cf40b41014cdf3e239c0b21da868e (diff) | |
download | CMake-c61f820a7fb1b191fe5591805f7e53fc52424f93.zip CMake-c61f820a7fb1b191fe5591805f7e53fc52424f93.tar.gz CMake-c61f820a7fb1b191fe5591805f7e53fc52424f93.tar.bz2 |
Merge topic 'add_ispc_to_check_helpers'
e17e2c6a51 ISPC: CheckCompilerFlags and CheckSourceCompiles support ISPC
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5337
Diffstat (limited to 'Tests')
5 files changed, 45 insertions, 1 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index cd8cbc1..557808e 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() |