HIP: Add support for [CMAKE_]HIP_LINKER_LAUNCHER

`CMAKE_<LANG>_LINKER_LAUNCHER` and `<LANG>_LINKER_LAUNCHER` are
already support for C, CXX, CUDA, OBJC, OBJCXX, and Fortran.  Add HIP.

Closes: #26967
This commit is contained in:
Maximilian Sander
2025-05-30 14:48:27 +02:00
committed by Brad King
parent 77312cc636
commit cdf2a36f48
15 changed files with 39 additions and 1 deletions

View File

@@ -21,6 +21,10 @@ This property is implemented only when ``<LANG>`` is one of:
.. 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

View File

@@ -2,6 +2,6 @@ linker-launcher
---------------
* :ref:`Makefile Generators` and :ref:`Ninja Generators` gained support
for adding a linker launcher with ``Fortran`` and ``CUDA``.
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.

View File

@@ -23,5 +23,9 @@ This is done only when ``<LANG>`` is one of:
.. versionadded:: 4.1
* ``HIP``
.. versionadded:: 4.1
This variable is initialized to the :envvar:`CMAKE_<LANG>_LINKER_LAUNCHER`
environment variable if it is set.

View File

@@ -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)

View File

@@ -453,6 +453,7 @@ TargetProperty const StaticTargetProperties[] = {
{ "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 },

View File

@@ -0,0 +1,5 @@
enable_language(HIP)
enable_language(CXX)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
add_executable(main main.hip)

View File

@@ -0,0 +1 @@
.*-E env USED_LAUNCHER=1 TARGET_NAME=main LANGUAGE=HIP.*

View File

@@ -0,0 +1 @@
include(HIP-common.cmake)

View File

@@ -0,0 +1 @@
.*-E env USED_LAUNCHER=1.*

View File

@@ -0,0 +1 @@
.*-E env USED_LAUNCHER=1 TARGET_NAME=main LANGUAGE=HIP.*

View File

@@ -0,0 +1,3 @@
set(CTEST_USE_LAUNCHERS 1)
include(CTestUseLaunchers)
include(HIP-env.cmake)

View File

@@ -0,0 +1,3 @@
set(CTEST_USE_LAUNCHERS 1)
include(CTestUseLaunchers)
include(HIP.cmake)

View File

@@ -0,0 +1,2 @@
set(CMAKE_HIP_LINKER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1")
include(HIP-common.cmake)

View File

@@ -30,6 +30,9 @@ 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()

View File

@@ -0,0 +1,4 @@
int main()
{
return 0;
}