mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-18 17:31:57 +08:00
ISPC: CheckCompilerFlags and CheckSourceCompiles support ISPC
This commit is contained in:
8
Help/release/dev/ispc-check-support.rst
Normal file
8
Help/release/dev/ispc-check-support.rst
Normal file
@@ -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'.
|
@@ -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()
|
||||
|
@@ -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")
|
||||
|
@@ -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)"
|
||||
|
13
Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake
Normal file
13
Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake
Normal file
@@ -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()
|
@@ -14,3 +14,7 @@ endif()
|
||||
if (CMAKE_Fortran_COMPILER_ID)
|
||||
run_cmake(CheckFortranCompilerFlag)
|
||||
endif()
|
||||
|
||||
if(CMake_TEST_ISPC)
|
||||
run_cmake(CheckISPCCompilerFlag)
|
||||
endif()
|
||||
|
@@ -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()
|
@@ -14,3 +14,7 @@ endif()
|
||||
if (CMAKE_Fortran_COMPILER_ID)
|
||||
run_cmake(CheckFortranSourceCompiles)
|
||||
endif()
|
||||
|
||||
if(CMake_TEST_ISPC)
|
||||
run_cmake(CheckISPCSourceCompiles)
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user