mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-12 20:39:49 -05:00
Merge topic 'linker-launcher'
cdf2a36f48HIP: Add support for [CMAKE_]HIP_LINKER_LAUNCHER77312cc636CUDA: Add support for [CMAKE_]CUDA_LINKER_LAUNCHER Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !10847
This commit is contained in:
@@ -6,13 +6,25 @@
|
||||
This property is implemented only when ``<LANG>`` is one of:
|
||||
|
||||
* ``C``
|
||||
|
||||
* ``CXX``
|
||||
|
||||
* ``CUDA``
|
||||
|
||||
.. versionadded:: 4.1
|
||||
|
||||
* ``OBJC``
|
||||
|
||||
* ``OBJCXX``
|
||||
|
||||
* ``Fortran``
|
||||
|
||||
.. versionadded:: 4.1
|
||||
|
||||
* ``HIP``
|
||||
|
||||
.. versionadded:: 4.1
|
||||
|
||||
Specify a :ref:`semicolon-separated list <CMake Language Lists>` containing a
|
||||
command line for a linker launching tool. The :ref:`Makefile Generators` and the
|
||||
:generator:`Ninja` generator will run this tool and pass the linker and its
|
||||
|
||||
@@ -2,6 +2,6 @@ linker-launcher
|
||||
---------------
|
||||
|
||||
* :ref:`Makefile Generators` and :ref:`Ninja Generators` gained support
|
||||
for adding a linker launcher with ``Fortran``.
|
||||
for adding a linker launcher with ``Fortran``, ``CUDA``, and ``HIP``.
|
||||
See the :variable:`CMAKE_<LANG>_LINKER_LAUNCHER` variable
|
||||
and :prop_tgt:`<LANG>_LINKER_LAUNCHER` target property for details.
|
||||
|
||||
@@ -8,12 +8,24 @@ variable is used to initialize the property on each target as it is created.
|
||||
This is done only when ``<LANG>`` is one of:
|
||||
|
||||
* ``C``
|
||||
|
||||
* ``CXX``
|
||||
|
||||
* ``CUDA``
|
||||
|
||||
.. versionadded:: 4.1
|
||||
|
||||
* ``OBJC``
|
||||
|
||||
* ``OBJCXX``
|
||||
|
||||
* ``Fortran``
|
||||
|
||||
.. versionadded:: 4.1
|
||||
|
||||
* ``HIP``
|
||||
|
||||
.. versionadded:: 4.1
|
||||
|
||||
This variable is initialized to the :envvar:`CMAKE_<LANG>_LINKER_LAUNCHER`
|
||||
environment variable if it is set.
|
||||
|
||||
@@ -75,6 +75,11 @@ if(NOT CMAKE_CUDA_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_CUDA_COMPILER_LAUNCHER
|
||||
CACHE STRING "Compiler launcher for CUDA.")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CUDA_LINKER_LAUNCHER AND DEFINED ENV{CMAKE_CUDA_LINKER_LAUNCHER})
|
||||
set(CMAKE_CUDA_LINKER_LAUNCHER "$ENV{CMAKE_CUDA_LINKER_LAUNCHER}"
|
||||
CACHE STRING "Linker launcher for CUDA.")
|
||||
endif()
|
||||
|
||||
include(CMakeCommonLanguageInclude)
|
||||
_cmake_common_language_platform_flags(CUDA)
|
||||
|
||||
|
||||
@@ -55,6 +55,11 @@ if(NOT CMAKE_HIP_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_HIP_COMPILER_LAUNCHER})
|
||||
CACHE STRING "Compiler launcher for HIP.")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_HIP_LINKER_LAUNCHER AND DEFINED ENV{CMAKE_HIP_LINKER_LAUNCHER})
|
||||
set(CMAKE_HIP_LINKER_LAUNCHER "$ENV{CMAKE_HIP_LINKER_LAUNCHER}"
|
||||
CACHE STRING "Linker launcher for HIP.")
|
||||
endif()
|
||||
|
||||
include(CMakeCommonLanguageInclude)
|
||||
_cmake_common_language_platform_flags(HIP)
|
||||
|
||||
|
||||
@@ -449,9 +449,11 @@ TargetProperty const StaticTargetProperties[] = {
|
||||
// ---- C++
|
||||
{ "CXX_LINKER_LAUNCHER"_s, IC::CanCompileSources },
|
||||
// ---- CUDA
|
||||
{ "CUDA_LINKER_LAUNCHER"_s, IC::CanCompileSources },
|
||||
{ "CUDA_RESOLVE_DEVICE_SYMBOLS"_s, IC::CanCompileSources },
|
||||
{ "CUDA_RUNTIME_LIBRARY"_s, IC::CanCompileSources },
|
||||
// ---- HIP
|
||||
{ "HIP_LINKER_LAUNCHER"_s, IC::CanCompileSources },
|
||||
{ "HIP_RUNTIME_LIBRARY"_s, IC::CanCompileSources },
|
||||
// ---- Objective C
|
||||
{ "OBJC_LINKER_LAUNCHER"_s, IC::CanCompileSources },
|
||||
|
||||
1
Tests/RunCMake/LinkerLauncher/CUDA-Build-stdout.txt
Normal file
1
Tests/RunCMake/LinkerLauncher/CUDA-Build-stdout.txt
Normal file
@@ -0,0 +1 @@
|
||||
.*-E env USED_LAUNCHER=1.*
|
||||
4
Tests/RunCMake/LinkerLauncher/CUDA-common.cmake
Normal file
4
Tests/RunCMake/LinkerLauncher/CUDA-common.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
cmake_policy(SET CMP0104 NEW)
|
||||
enable_language(CUDA)
|
||||
set(CMAKE_VERBOSE_MAKEFILE TRUE)
|
||||
add_executable(main main.cu)
|
||||
1
Tests/RunCMake/LinkerLauncher/CUDA-env-Build-stdout.txt
Normal file
1
Tests/RunCMake/LinkerLauncher/CUDA-env-Build-stdout.txt
Normal file
@@ -0,0 +1 @@
|
||||
.*-E env USED_LAUNCHER=1 TARGET_NAME=main LANGUAGE=CUDA.*
|
||||
1
Tests/RunCMake/LinkerLauncher/CUDA-env.cmake
Normal file
1
Tests/RunCMake/LinkerLauncher/CUDA-env.cmake
Normal file
@@ -0,0 +1 @@
|
||||
include(CUDA-common.cmake)
|
||||
@@ -0,0 +1 @@
|
||||
.*-E env USED_LAUNCHER=1.*
|
||||
@@ -0,0 +1 @@
|
||||
.*-E env USED_LAUNCHER=1 TARGET_NAME=main LANGUAGE=CUDA.*
|
||||
3
Tests/RunCMake/LinkerLauncher/CUDA-launch-env.cmake
Normal file
3
Tests/RunCMake/LinkerLauncher/CUDA-launch-env.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
set(CTEST_USE_LAUNCHERS 1)
|
||||
include(CTestUseLaunchers)
|
||||
include(CUDA-env.cmake)
|
||||
3
Tests/RunCMake/LinkerLauncher/CUDA-launch.cmake
Normal file
3
Tests/RunCMake/LinkerLauncher/CUDA-launch.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
set(CTEST_USE_LAUNCHERS 1)
|
||||
include(CTestUseLaunchers)
|
||||
include(CUDA.cmake)
|
||||
2
Tests/RunCMake/LinkerLauncher/CUDA.cmake
Normal file
2
Tests/RunCMake/LinkerLauncher/CUDA.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
set(CMAKE_CUDA_LINKER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1")
|
||||
include(CUDA-common.cmake)
|
||||
5
Tests/RunCMake/LinkerLauncher/HIP-common.cmake
Normal file
5
Tests/RunCMake/LinkerLauncher/HIP-common.cmake
Normal file
@@ -0,0 +1,5 @@
|
||||
enable_language(HIP)
|
||||
enable_language(CXX)
|
||||
set(CMAKE_VERBOSE_MAKEFILE TRUE)
|
||||
|
||||
add_executable(main main.hip)
|
||||
1
Tests/RunCMake/LinkerLauncher/HIP-env-Build-stdout.txt
Normal file
1
Tests/RunCMake/LinkerLauncher/HIP-env-Build-stdout.txt
Normal file
@@ -0,0 +1 @@
|
||||
.*-E env USED_LAUNCHER=1 TARGET_NAME=main LANGUAGE=HIP.*
|
||||
1
Tests/RunCMake/LinkerLauncher/HIP-env.cmake
Normal file
1
Tests/RunCMake/LinkerLauncher/HIP-env.cmake
Normal file
@@ -0,0 +1 @@
|
||||
include(HIP-common.cmake)
|
||||
@@ -0,0 +1 @@
|
||||
.*-E env USED_LAUNCHER=1.*
|
||||
@@ -0,0 +1 @@
|
||||
.*-E env USED_LAUNCHER=1 TARGET_NAME=main LANGUAGE=HIP.*
|
||||
3
Tests/RunCMake/LinkerLauncher/HIP-launch-env.cmake
Normal file
3
Tests/RunCMake/LinkerLauncher/HIP-launch-env.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
set(CTEST_USE_LAUNCHERS 1)
|
||||
include(CTestUseLaunchers)
|
||||
include(HIP-env.cmake)
|
||||
3
Tests/RunCMake/LinkerLauncher/HIP-launch.cmake
Normal file
3
Tests/RunCMake/LinkerLauncher/HIP-launch.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
set(CTEST_USE_LAUNCHERS 1)
|
||||
include(CTestUseLaunchers)
|
||||
include(HIP.cmake)
|
||||
2
Tests/RunCMake/LinkerLauncher/HIP.cmake
Normal file
2
Tests/RunCMake/LinkerLauncher/HIP.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
set(CMAKE_HIP_LINKER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1")
|
||||
include(HIP-common.cmake)
|
||||
@@ -24,9 +24,15 @@ function(run_linker_launcher_env lang)
|
||||
endfunction()
|
||||
|
||||
set(langs C CXX)
|
||||
if(CMake_TEST_CUDA)
|
||||
list(APPEND langs CUDA)
|
||||
endif()
|
||||
if(CMake_TEST_Fortran)
|
||||
list(APPEND langs Fortran)
|
||||
endif()
|
||||
if(CMake_TEST_HIP)
|
||||
list(APPEND langs HIP)
|
||||
endif()
|
||||
if(CMake_TEST_OBJC)
|
||||
list(APPEND langs OBJC OBJCXX)
|
||||
endif()
|
||||
|
||||
4
Tests/RunCMake/LinkerLauncher/main.cu
Normal file
4
Tests/RunCMake/LinkerLauncher/main.cu
Normal file
@@ -0,0 +1,4 @@
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
4
Tests/RunCMake/LinkerLauncher/main.hip
Normal file
4
Tests/RunCMake/LinkerLauncher/main.hip
Normal file
@@ -0,0 +1,4 @@
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user