mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 02:39:48 -06:00
ISPC: Add compiler launcher support
This commit is contained in:
committed by
Brad King
parent
ca5babfd7a
commit
5a1750017e
@@ -4,7 +4,7 @@
|
||||
.. versionadded:: 3.4
|
||||
|
||||
This property is implemented only when ``<LANG>`` is ``C``, ``CXX``,
|
||||
``Fortran``, ``OBJC``, ``OBJCXX``, or ``CUDA``.
|
||||
``Fortran``, ``ISPC``, ``OBJC``, ``OBJCXX``, or ``CUDA``.
|
||||
|
||||
Specify a :ref:`semicolon-separated list <CMake Language Lists>` containing a command line
|
||||
for a compiler launching tool. The :ref:`Makefile Generators` and the
|
||||
|
||||
@@ -6,7 +6,7 @@ CMAKE_<LANG>_COMPILER_LAUNCHER
|
||||
Default value for :prop_tgt:`<LANG>_COMPILER_LAUNCHER` target property.
|
||||
This variable is used to initialize the property on each target as it is
|
||||
created. This is done only when ``<LANG>`` is ``C``, ``CXX``, ``Fortran``,
|
||||
``OBJC``, ``OBJCXX``, or ``CUDA``.
|
||||
``ISPC``, ``OBJC``, ``OBJCXX``, or ``CUDA``.
|
||||
|
||||
This variable is initialized to the :envvar:`CMAKE_<LANG>_COMPILER_LAUNCHER`
|
||||
environment variable if it is set.
|
||||
|
||||
@@ -32,6 +32,11 @@ if(CMAKE_ISPC_STANDARD_LIBRARIES_INIT)
|
||||
mark_as_advanced(CMAKE_ISPC_STANDARD_LIBRARIES)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_ISPC_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_ISPC_COMPILER_LAUNCHER})
|
||||
set(CMAKE_ISPC_COMPILER_LAUNCHER "$ENV{CMAKE_ISPC_COMPILER_LAUNCHER}"
|
||||
CACHE STRING "Compiler launcher for ISPC.")
|
||||
endif()
|
||||
|
||||
include(CMakeCommonLanguageInclude)
|
||||
|
||||
# now define the following rules:
|
||||
|
||||
@@ -832,7 +832,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
|
||||
std::string compilerLauncher;
|
||||
if (!compileCommands.empty() &&
|
||||
(lang == "C" || lang == "CXX" || lang == "Fortran" || lang == "CUDA" ||
|
||||
lang == "OBJC" || lang == "OBJCXX")) {
|
||||
lang == "ISPC" || lang == "OBJC" || lang == "OBJCXX")) {
|
||||
std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER";
|
||||
cmProp clauncher = this->GeneratorTarget->GetProperty(clauncher_prop);
|
||||
if (cmNonempty(clauncher)) {
|
||||
|
||||
@@ -813,7 +813,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
|
||||
std::string compilerLauncher;
|
||||
if (!compileCmds.empty() &&
|
||||
(lang == "C" || lang == "CXX" || lang == "Fortran" || lang == "CUDA" ||
|
||||
lang == "OBJC" || lang == "OBJCXX")) {
|
||||
lang == "ISPC" || lang == "OBJC" || lang == "OBJCXX")) {
|
||||
std::string const clauncher_prop = cmStrCat(lang, "_COMPILER_LAUNCHER");
|
||||
cmProp clauncher = this->GeneratorTarget->GetProperty(clauncher_prop);
|
||||
if (cmNonempty(clauncher)) {
|
||||
|
||||
@@ -367,6 +367,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
||||
initProp("JOB_POOL_COMPILE");
|
||||
initProp("JOB_POOL_LINK");
|
||||
initProp("JOB_POOL_PRECOMPILE_HEADER");
|
||||
initProp("ISPC_COMPILER_LAUNCHER");
|
||||
initProp("ISPC_HEADER_DIRECTORY");
|
||||
initProp("LINK_SEARCH_START_STATIC");
|
||||
initProp("LINK_SEARCH_END_STATIC");
|
||||
|
||||
@@ -629,6 +629,9 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
|
||||
if(DEFINED CMake_TEST_CUDA)
|
||||
list(APPEND CompilerLauncher_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
|
||||
endif()
|
||||
if(DEFINED CMake_TEST_ISPC)
|
||||
list(APPEND CompilerLauncher_ARGS -DCMake_TEST_ISPC=${CMake_TEST_ISPC})
|
||||
endif()
|
||||
if(CMAKE_Fortran_COMPILER)
|
||||
list(APPEND CompilerLauncher_ARGS -DCMake_TEST_Fortran=1)
|
||||
endif()
|
||||
@@ -637,7 +640,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
|
||||
endif()
|
||||
add_RunCMake_test(CompilerLauncher)
|
||||
set_property(TEST RunCMake.CompilerLauncher APPEND
|
||||
PROPERTY LABELS "CUDA")
|
||||
PROPERTY LABELS "CUDA;ISPC")
|
||||
add_RunCMake_test(ctest_labels_for_subprojects)
|
||||
add_RunCMake_test(CompilerArgs)
|
||||
endif()
|
||||
|
||||
1
Tests/RunCMake/CompilerLauncher/ISPC-Build-stdout.txt
Normal file
1
Tests/RunCMake/CompilerLauncher/ISPC-Build-stdout.txt
Normal file
@@ -0,0 +1 @@
|
||||
.*-E env USED_LAUNCHER=1.*
|
||||
4
Tests/RunCMake/CompilerLauncher/ISPC-common.cmake
Normal file
4
Tests/RunCMake/CompilerLauncher/ISPC-common.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
enable_language(ISPC)
|
||||
enable_language(CXX)
|
||||
set(CMAKE_VERBOSE_MAKEFILE TRUE)
|
||||
add_executable(main main.cxx test.ispc)
|
||||
@@ -0,0 +1 @@
|
||||
.*-E env USED_LAUNCHER=1.*
|
||||
@@ -0,0 +1 @@
|
||||
.*-E env USED_LAUNCHER=1.*
|
||||
1
Tests/RunCMake/CompilerLauncher/ISPC-env.cmake
Normal file
1
Tests/RunCMake/CompilerLauncher/ISPC-env.cmake
Normal file
@@ -0,0 +1 @@
|
||||
include(ISPC-common.cmake)
|
||||
@@ -0,0 +1 @@
|
||||
.*-E env USED_LAUNCHER=1.*
|
||||
3
Tests/RunCMake/CompilerLauncher/ISPC-launch-env.cmake
Normal file
3
Tests/RunCMake/CompilerLauncher/ISPC-launch-env.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
set(CTEST_USE_LAUNCHERS 1)
|
||||
include(CTestUseLaunchers)
|
||||
include(ISPC-env.cmake)
|
||||
3
Tests/RunCMake/CompilerLauncher/ISPC-launch.cmake
Normal file
3
Tests/RunCMake/CompilerLauncher/ISPC-launch.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
set(CTEST_USE_LAUNCHERS 1)
|
||||
include(CTestUseLaunchers)
|
||||
include(ISPC.cmake)
|
||||
2
Tests/RunCMake/CompilerLauncher/ISPC.cmake
Normal file
2
Tests/RunCMake/CompilerLauncher/ISPC.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
set(CMAKE_ISPC_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1")
|
||||
include(ISPC-common.cmake)
|
||||
@@ -29,6 +29,9 @@ endif()
|
||||
if(CMake_TEST_Fortran)
|
||||
list(APPEND langs Fortran)
|
||||
endif()
|
||||
if(CMake_TEST_ISPC)
|
||||
list(APPEND langs ISPC)
|
||||
endif()
|
||||
if(CMake_TEST_OBJC)
|
||||
list(APPEND langs OBJC OBJCXX)
|
||||
endif()
|
||||
|
||||
4
Tests/RunCMake/CompilerLauncher/test.ispc
Normal file
4
Tests/RunCMake/CompilerLauncher/test.ispc
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
float func(float a, float b) {
|
||||
return a + b / 2.;
|
||||
}
|
||||
Reference in New Issue
Block a user